:root {
    --calbet-red: #d90f1c;
    --calbet-red-dark: #b10914;
    --calbet-black: #141414;
    --calbet-text: #232323;
    --calbet-muted: #6b7280;
    --calbet-border: #e6e7eb;
    --surface: #ffffff;
    --surface-soft: #f6f7f9;
    --radius: 12px;
    --shadow-soft: 0 6px 20px rgba(20, 20, 20, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #f2f3f5 0%, #fbfcfd 100%);
    color: var(--calbet-text);
    height: 100vh;
    overflow: hidden;
}

.brand-bar {
    height: 58px;
    background: var(--calbet-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 2px solid #fff;
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 1.05rem;
}

.brand-env {
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    padding: 3px 9px;
}

.brand-version {
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(0, 0, 0, 0.18);
}

.brand-right {
    font-size: 0.82rem;
    opacity: 0.95;
}

.app-container {
    display: flex;
    height: calc(100vh - 58px);
    max-width: 1600px;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--calbet-border);
    position: relative;
    max-width: 62%;
}

.chat-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--calbet-border);
    background: var(--surface);
    z-index: 10;
}

.chat-header h1 {
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--calbet-black);
}

.chat-header p {
    margin-top: 3px;
    font-size: 0.86rem;
    color: var(--calbet-muted);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #eceef2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message.assistant .avatar {
    background-color: var(--calbet-red);
    color: white;
}

.message.user .avatar {
    background-color: var(--calbet-black);
    color: white;
}

.message .bubble {
    padding: 12px 14px;
    border-radius: var(--radius);
    background-color: #f3f4f6;
    line-height: 1.5;
    font-size: 0.93rem;
    position: relative;
}

.message.user .bubble {
    background-color: var(--calbet-black);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.assistant .bubble {
    background-color: #f4f5f8;
    color: var(--calbet-text);
    border-bottom-left-radius: 2px;
    border: 1px solid #eceff3;
}

.message.assistant .bubble a {
    color: #0f4c81;
    text-decoration: underline;
    word-break: break-all;
}

.suggestion-chips {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    font-size: 0.8rem;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.suggestion-chip:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.inline-suggestions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 4px;
}

.suggestions-msg {
    margin-top: -12px !important; /* Pull chips closer to the text bubble */
}

.avatar.ghost {
    visibility: hidden;
}

.input-area {
    padding: 16px 22px 20px;
    background: var(--surface);
    border-top: 1px solid var(--calbet-border);
}

#chat-form {
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid #d7dae1;
    transition: border-color 0.2s;
}

#chat-form:focus-within {
    border-color: var(--calbet-red);
    box-shadow: 0 0 0 2px rgba(217, 15, 28, 0.12);
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 1rem;
    outline: none;
}

#send-btn {
    background-color: var(--calbet-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

#send-btn:hover {
    background-color: var(--calbet-red-dark);
}

#send-btn:disabled {
    background-color: #e5e7eb;
    cursor: not-allowed;
}

/* Products Panel */
.products-panel {
    flex: 1;
    background-color: var(--surface-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--calbet-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
}

.panel-header h2 {
    font-size: 1.03rem;
    font-weight: 700;
    color: var(--calbet-black);
}

.badge {
    background-color: #1f2937;
    color: #fff;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.products-grid {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Responsive grid */
    gap: 16px;
    align-content: start;
}

.product-card {
    background: var(--surface);
    border: 1px solid #dfe3ea;
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card.recommended-product {
    border: 2px solid var(--calbet-red);
    box-shadow: 0 4px 12px rgba(217, 15, 28, 0.15);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.product-image {
    height: 180px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-bottom: 1px solid #edf0f4;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 12px 12px 11px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
    background-color: #f3f4f6;
    color: #4b5563;
}

.tag.energy {
    background-color: #dcfce7;
    color: #166534;
    font-weight: bold;
}

.tag.stock {
    background-color: #ede9fe;
    color: #5b21b6;
}

.product-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--calbet-red);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.view-btn {
    text-decoration: none;
    background-color: var(--calbet-black);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.2s;
}

.view-btn:hover {
    background-color: #000;
}

.view-btn-secondary {
    background-color: #374151;
}

.view-btn-secondary:hover {
    background-color: #1f2937;
}

.product-highlights {
    margin: 0 0 8px;
    padding-left: 18px;
    color: #4b5563;
    font-size: 0.74rem;
    line-height: 1.35;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--calbet-muted);
}

/* Loading animation dots */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .brand-bar {
        height: 52px;
        padding: 0 12px;
    }
    .brand-right {
        display: none;
    }
    .app-container {
        flex-direction: column;
        height: calc(100vh - 52px);
    }
    .chat-area {
        max-width: 100%;
        height: 60vh;
    }
    .products-panel {
        height: 40vh;
        border-top: 1px solid var(--calbet-border);
    }
}
