:root {
    --sage: #3B5E4F;
    --sage-dark: #243D32;
    --sage-light: #EBF1ED;
    --gold: #C5A059;
    --gold-light: #E8D8B8;
    --ivory: #FAF8F5;
    --charcoal: #1E2621;
    --text-muted: #6B7B72;
    --white: #FFFFFF;
    --border: #E0E7E2;
    --sidebar-width: clamp(240px, 19vw, 290px);
    --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    --font-family: Verdana, Geneva, Tahoma, sans-serif;
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: var(--font-family) !important;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--ivory);
    color: var(--charcoal);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: clamp(1.75rem, 3.2vw + 0.6rem, 2.7rem); line-height: 1.25; }
h2 { font-size: clamp(1.35rem, 2.2vw + 0.4rem, 2.05rem); line-height: 1.3; }
h3 { font-size: clamp(1.1rem, 1.4vw + 0.35rem, 1.45rem); line-height: 1.35; }
h4 { font-size: 1.05rem; }

h1, h2, h3, h4, h5, h6 { 
    font-weight: 700; 
    color: var(--sage-dark); 
    letter-spacing: -0.2px;
}

p, span, a, input, button, select, textarea, li, small, strong, td, th { 
    font-family: var(--font-family) !important; 
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Mobile Sticky Topbar */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--sage-dark);
    padding: 0 1.2rem;
    align-items: center;
    justify-content: space-between;
    z-index: 1050;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.mobile-brand {
    color: var(--gold-light);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-decoration: none;
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: var(--ivory);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

/* Mobile Background Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 25, 21, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1090;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Left Sidebar Layout */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sage-dark);
    color: var(--ivory);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 1.4rem;
    z-index: 1100;
    box-shadow: 3px 0 18px rgba(0,0,0,0.06);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.brand-badge {
    text-align: center;
    margin-bottom: 1.8rem;
}
.brand-badge h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
    color: var(--gold-light);
    margin: 0;
}
.brand-badge span {
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ivory);
    opacity: 0.75;
    display: block;
    margin-top: 4px;
}

.sidebar-nav { list-style: none; margin-top: 0.8rem; }
.sidebar-nav li { margin-bottom: 0.35rem; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 0.84rem;
    border-radius: 8px;
    transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: var(--sage);
    color: var(--gold-light);
    transform: translateX(3px);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* App Main Surface */
.app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    flex: 1;
}

.container { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: clamp(1.5rem, 3vw, 2.8rem) clamp(1rem, 2.5vw, 2rem); 
}

/* Hero Section */
.hero-banner {
    padding: clamp(3.5rem, 7vw, 6rem) clamp(1rem, 3vw, 2rem); 
    color: #fff; 
    text-align: center;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.8rem;
}

/* Global Buttons */
.btn-gold {
    background-color: var(--gold);
    color: var(--white);
    padding: 11px 22px;
    border-radius: 30px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.84rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.btn-gold:hover { 
    background-color: #B28E46; 
    transform: translateY(-2px); 
    box-shadow: 0 6px 15px rgba(197, 160, 89, 0.35); 
}

.btn-outline-sage {
    border: 1px solid var(--sage);
    color: var(--sage);
    padding: 9px 18px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.btn-outline-sage:hover { 
    background-color: var(--sage); 
    color: var(--white); 
}

/* Fluid Auto-fit Card Grids */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(1rem, 2vw, 2rem);
    margin-top: 1.8rem;
}

.product-card, .blog-card, .wellness-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: clamp(1.2rem, 2vw, 1.8rem);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.product-card:hover, .blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(59, 94, 79, 0.08);
}

/* Aspect Ratio Locked Product Images */
.product-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1.2rem;
}

/* Forms */
.form-box {
    background: var(--white);
    padding: clamp(1.4rem, 3.5vw, 2.5rem);
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 650px;
    margin: 1.5rem auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.form-group { margin-bottom: 1.2rem; }
.form-group label { 
    display: block; 
    font-size: 0.8rem; 
    font-weight: 700; 
    margin-bottom: 5px; 
    color: var(--sage-dark); 
}
.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    background-color: #fff;
    color: var(--charcoal);
}
.form-control:focus { border-color: var(--sage); }

/* Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    margin-top: 1rem;
}
.table-responsive table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
}

/* Interactive Brew Timer Modal */
#brewModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 38, 33, 0.8);
    backdrop-filter: blur(2px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.brew-content {
    background: var(--white);
    border-radius: 18px;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    text-align: center;
    width: min(100%, 390px);
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.timer-display {
    font-size: clamp(2.4rem, 6vw, 3.4rem);
    font-weight: 700;
    color: var(--sage);
    margin: 1.2rem 0;
    font-variant-numeric: tabular-nums;
}

/* Floating AI Chat Components */
#aiChatBubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--sage-dark);
    border: 2px solid var(--gold);
    color: #FAF8F5;
    padding: 12px 18px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(30, 38, 33, 0.25);
    cursor: pointer;
    z-index: 9999;
    transition: var(--transition);
}
#aiChatBubble:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(197, 160, 89, 0.35);
}
.chat-pill-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#aiChatPanel {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 25px;
    width: 360px;
    max-width: calc(100vw - 30px);
    height: 520px;
    max-height: 80vh;
    max-height: 80dvh;
    background: #fff;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 15px 40px rgba(0,0,0,0.18);
    z-index: 10000;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-header {
    background: var(--sage-dark);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--gold);
}
.ai-avatar-badge {
    background: var(--sage);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.1rem;
    border: 1px solid var(--gold-light);
}

.ai-prompts-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 12px;
    background: var(--ivory);
    border-bottom: 1px solid var(--border);
}
.ai-prompts-bar::-webkit-scrollbar { display: none; }
.ai-chip {
    white-space: nowrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--sage-dark);
    cursor: pointer;
    transition: 0.2s ease;
}
.ai-chip:hover {
    background: var(--sage-light);
    border-color: var(--sage);
}

.ai-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #FAF8F5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-msg {
    max-width: 82%;
    padding: 10px 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    border-radius: 14px;
}
.ai-bot {
    background: #fff;
    color: var(--charcoal);
    align-self: flex-start;
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}
.ai-user {
    background: var(--sage);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-footer {
    display: flex;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid var(--border);
    gap: 8px;
}
#aiUserInput {
    flex: 1;
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
}
#aiUserInput:focus { border-color: var(--sage); }
#aiSendBtn {
    background: var(--gold);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
#aiSendBtn:hover { background: #B28E46; }

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    }
}

@media (max-width: 860px) {
    .mobile-topbar { 
        display: flex; 
    }

    .app-sidebar {
        transform: translateX(-100%);
        width: min(82vw, 310px);
        box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    }

    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .app-main {
        margin-left: 0;
        width: 100%;
        padding-top: 60px;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .hero-actions {
        flex-direction: column;
    }
    .hero-actions .btn-gold,
    .hero-actions .btn-outline-sage {
        width: 100%;
    }

    #aiChatBubble {
        bottom: 16px !important;
        right: 16px !important;
        padding: 10px 14px !important;
    }
    .chat-pill-label {
        font-size: 0.78rem !important;
    }
    #aiChatPanel {
        right: 12px !important;
        left: 12px !important;
        bottom: 72px !important;
        width: auto !important;
        height: 72vh !important;
        height: 72dvh !important;
        max-width: none !important;
    }
}

@media (max-width: 380px) {
    html { font-size: 14px; }
    .btn-gold, .btn-outline-sage {
        padding: 8px 14px;
        font-size: 0.78rem;
    }
}