/* ===================================================
   FILE: index.css
   Coffee House – Premium User Dashboard Design System
   =================================================== */

/* ========== DESIGN TOKENS ========== */
:root {
    /* Brand */
    --brand-green: #22c55e;
    --brand-green-dark: #15803d;
    --brand-green-subtle: #f0fdf4;
    --brand-green-muted: #dcfce7;
    --brand-emerald: #10b981;
    --brand-amber: #f59e0b;

    /* Neutrals */
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Surface */
    --bg:       #f6f8f5;
    --surface:  #ffffff;
    --surface-2: #f9fbf8;

    /* Text */
    --text-primary:   #0f1f0f;
    --text-secondary: #4b5563;
    --text-muted:     #9ca3af;

    /* Borders */
    --border:       rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);

    /* Effects */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-lg:  0 16px 48px rgba(0,0,0,0.1), 0 4px 16px rgba(0,0,0,0.06);
    --shadow-xl:  0 32px 64px rgba(0,0,0,0.12);

    /* Radius */
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  20px;
    --r-xl:  28px;
    --r-full: 9999px;

    /* Transitions */
    --t-fast: 0.15s ease;
    --t-med:  0.25s ease;
    --t-slow: 0.4s ease;

    /* Header */
    --header-h: 68px;
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

.nav-link { text-decoration: none; color: inherit; }

/* ========== UTILITY ========== */
.w-full { width: 100%; }

/* ========== ICON BUTTON ========== */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    transition: background var(--t-fast), color var(--t-fast);
    cursor: pointer;
}
.icon-btn:hover { background: var(--gray-100); color: var(--brand-green-dark); }


/* ========== HEADER ========== */
.user-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    text-decoration: none;
}

.logo-mark {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, #a3e635, #22c55e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 16px rgba(34,197,94,0.35);
    flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-primary); }
.logo-tagline { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }

/* Desktop nav */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.main-nav__link {
    padding: 8px 14px;
    border-radius: var(--r-full);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
    white-space: nowrap;
}
.main-nav__link:hover,
.main-nav__link.active {
    background: var(--brand-green-muted);
    color: var(--brand-green-dark);
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.header-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--r-full);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.header-login-btn:hover {
    background: var(--brand-green-muted);
    color: var(--brand-green-dark);
    border-color: #bbf7d0;
    transform: translateY(-1px);
}

/* Search */
.search-wrap { position: relative; }
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    width: 300px;
    background: var(--surface);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 10px 14px;
    align-items: center;
    gap: 10px;
}
.search-dropdown.show { display: flex; animation: fadeSlideDown 0.2s ease; }
.search-dropdown i { color: var(--text-muted); flex-shrink: 0; }
.search-dropdown input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    color: var(--text-primary);
}

/* Cart button overrides */
.cart-btn { position: relative; }
.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: var(--r-full);
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    pointer-events: none;
}

/* User menu */
.user-menu { position: relative; }
.user-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--brand-green-muted);
    background: linear-gradient(135deg, #bbf7d0, #4ade80);
    color: var(--brand-green-dark);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.user-avatar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(34,197,94,0.3);
    border-color: var(--brand-green);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: fadeSlideDown 0.2s ease;
}
.user-dropdown.show { display: block; }

.user-dropdown__header {
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border-light);
    background: var(--brand-green-subtle);
}
.user-dropdown__name { display: block; font-weight: 700; font-size: 0.95rem; }
.user-dropdown__role { font-size: 0.78rem; color: var(--brand-green-dark); font-weight: 600; }

.user-dropdown__body, .user-dropdown__footer {
    padding: 8px;
}
.user-dropdown__footer { border-top: 1px solid var(--border-light); }

.user-dropdown__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
.user-dropdown__link:hover { background: var(--gray-100); color: var(--text-primary); }
.user-dropdown__link i { width: 16px; text-align: center; color: var(--text-muted); }

.logout-link { color: #dc2626 !important; }
.logout-link:hover { background: #fef2f2 !important; }

/* Hamburger (mobile) */
.hamburger-btn { display: none; }

/* Mobile Nav */
.mobile-nav {
    display: none;
    flex-direction: column;
    border-top: 1px solid var(--border-light);
    padding: 8px 16px 12px;
    gap: 2px;
}
.mobile-nav.show { display: flex; }
.mobile-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast);
}
.mobile-nav__link:hover { background: var(--brand-green-muted); color: var(--brand-green-dark); }
.mobile-nav__link i { width: 18px; text-align: center; }
.mobile-nav .logout-link { color: #dc2626 !important; }
.mobile-nav .logout-link:hover { background: #fef2f2 !important; }


/* ========== MAIN CONTENT ========== */
.user-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    min-height: calc(100vh - var(--header-h));
}

.page-container {
    animation: pageFadeIn 0.35s ease;
}

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

/* ========== FOOTER ========== */
.user-footer {
    background: #0b1d10;
    color: rgba(255,255,255,0.85);
    padding: 60px 24px 0;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.6fr 1fr 1.3fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
}
.footer-logo i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #a3e635, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}
.footer-brand p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.55);
    margin-bottom: 20px;
}
.footer-socials { display: flex; gap: 10px; }
.footer-social-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    transition: background var(--t-fast), color var(--t-fast);
}
.footer-social-btn:hover { background: var(--brand-green); color: #fff; border-color: var(--brand-green); }

.footer-col h4 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 16px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col ul li a {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: color var(--t-fast);
}
.footer-col ul li a:hover { color: #fff; }

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
}
.footer-contact li i { color: var(--brand-green); width: 14px; margin-top: 2px; flex-shrink: 0; }

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
}


/* ========== CART DRAWER ========== */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-med);
}
.cart-overlay.show { opacity: 1; pointer-events: all; }

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 100vw;
    background: var(--surface);
    z-index: 800;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform var(--t-slow) cubic-bezier(0.4, 0, 0.2, 1);
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.cart-drawer__head h2 { font-size: 1.1rem; font-weight: 800; }
.cart-drawer__count { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; display: block; margin-top: 2px; }

.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-item-list { display: flex; flex-direction: column; gap: 12px; }

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    transition: box-shadow var(--t-fast);
}
.cart-item:hover { box-shadow: var(--shadow-sm); }

.cart-item__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--brand-green-muted), var(--brand-green-subtle));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.cart-item__info { flex: 1; min-width: 0; }
.cart-item-name {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.cart-item-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast), color var(--t-fast);
    flex-shrink: 0;
}
.cart-item-remove:hover { background: #fef2f2; color: #dc2626; }

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
}
.cart-empty-icon { font-size: 3rem; opacity: 0.3; }
.cart-empty p { color: var(--text-muted); font-size: 0.9rem; }

.cart-drawer__foot {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: var(--surface);
}
.cart-drawer__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}
.cart-drawer__total span { color: var(--text-secondary); font-weight: 500; }
.cart-drawer__total strong { font-size: 1.2rem; font-weight: 800; color: var(--brand-green-dark); }
.cart-drawer__shipping-note {
    font-size: 0.78rem;
    color: var(--brand-green-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}


/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--r-md);
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), opacity var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #052e10;
    box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34,197,94,0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-300); color: var(--text-primary); }

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

/* ========== SHARED SURFACE ========== */
.surface-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

/* ========== SECTION HEADING ========== */
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.section-eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-green-dark);
    margin-bottom: 6px;
}
.section-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.section-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-green-dark);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap var(--t-fast);
}
.section-link:hover { gap: 10px; }
.section-link::after { content: '→'; }

/* ========== MODAL (legacy fallback) ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 600;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
    animation: pageFadeIn 0.25s ease;
    overflow: hidden;
}
.modal-header, .modal-footer {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.modal-header { border-bottom: 1px solid var(--border-light); }
.modal-footer { border-top: 1px solid var(--border-light); flex-wrap: wrap; }
.modal-title { font-size: 1.1rem; font-weight: 800; }
.modal-close {
    border: none;
    background: transparent;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.modal-body {
    padding: 20px 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .main-nav { display: none; }
    .hamburger-btn { display: inline-flex; }
    .search-wrap { display: none; }
}

@media (max-width: 640px) {
    .header-inner { padding: 0 16px; }
    .logo-tagline { display: none; }
    .header-login-btn span { display: none; }
    .header-login-btn { width: 40px; justify-content: center; padding: 0; border-radius: var(--r-sm); }
    .user-main { padding: 20px 16px 60px; }
    .cart-drawer { width: 100vw; }
    .footer-inner { grid-template-columns: 1fr; gap: 32px; }
    .footer-bottom { flex-direction: column; text-align: center; }
}

/* ========== SHARED PRODUCT CARD ========== */
.hp-product-card {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}
.hp-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.1);
    border-color: #bbf7d0;
}
.hp-product-img {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    overflow: hidden;
}
.hp-product-img::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.5), transparent 60%);
}
.hp-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1; /* Above the radial gradient */
}
.hp-quick-add {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(34,197,94,0.4);
    background: #22c55e;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.hp-product-card:hover .hp-quick-add {
    opacity: 1;
    transform: scale(1);
}
.hp-quick-add:hover { background: #16a34a; }

.hp-product-body { 
    padding: 14px 16px; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}
.hp-product-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f1f0f;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.hp-product-price {
    font-size: 1rem;
    font-weight: 800;
    color: #15803d;
    margin-top: auto;
}
