/* ═══════════════════════════════════════════
   assets/css/style.css — WassapShop v2
   ═══════════════════════════════════════════
   
   REMOVED from v1:
   ✗ @import font (already loaded via <link> in header.php)
   ✗ Duplicate .sidebar block (first dark-themed definition was dead code)
   ✗ Duplicate .nav-link block (first display:block definition was dead code)
   ✗ .brand class (orphaned — sidebar uses .sidebar-brand)
   ✗ .btn-add.in-cart (never applied — cart uses show/hide, not class toggle)
   ✗ --glass CSS variable (defined but never referenced)
   ✗ body { display: flex } (sidebar is position:fixed, so flex was unnecessary)
   
   CONSOLIDATED:
   ✓ Mobile sidebar rules (from header.php inline <style> into this file)
   ✓ Mobile menu button styles (from header.php inline <style> into this file)
   → header.php inline <style> block can now be removed
   
   ═══════════════════════════════════════════ */


/* ─────────────────────────────────────────
   1. DESIGN TOKENS
   ───────────────────────────────────────── */
:root {
    --primary:      #25D366;
    --primary-dark:  #128c7e;
    --dark:         #0f172a;
    --light:        #f1f5f9;
    --white:        #ffffff;
    --border:       #e2e8f0;
    --text:         #334155;
    --text-muted:   #64748b;
    --text-faint:   #94a3b8;
    --danger:       #ef4444;
    --shadow:       0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 16px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:    0 10px 25px rgba(0, 0, 0, 0.12);
    --radius:       12px;
    --radius-sm:    8px;
    --transition:   0.2s ease;
}


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

html { scroll-behavior: smooth; }

::selection { background: rgba(37, 211, 102, 0.15); color: var(--dark); }

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

img, video { display: block; max-width: 100%; }

a { color: inherit; }


/* ─────────────────────────────────────────
   3. DASHBOARD LAYOUT
   (sidebar is position:fixed — no flex needed on body)
   ───────────────────────────────────────── */

/* ── Sidebar ── */
.sidebar {
    width: 250px;
    background: var(--white);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 30px;
    display: block;
    text-decoration: none;
}

.sidebar-close-btn { display: none; }

/* ── Sidebar Scrollbar ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.1) transparent; }

/* ── Main Content ── */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 2rem;
    max-width: 1200px;
}


/* ─────────────────────────────────────────
   4. COMPONENTS — Cards
   ───────────────────────────────────────── */
.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

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


/* ─────────────────────────────────────────
   5. COMPONENTS — Forms
   ───────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--dark);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
}

textarea { resize: vertical; }

/* ── Autofill Override (prevents Chrome yellow/blue) ── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--dark);
    -webkit-box-shadow: 0 0 0 1000px var(--white) inset;
    transition: background-color 5000s ease-in-out 0s;
}


/* ─────────────────────────────────────────
   6. COMPONENTS — Buttons
   ───────────────────────────────────────── */
.btn {
    display: inline-block;
    background: var(--dark);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    text-align: center;
    transition: background var(--transition), transform var(--transition);
}

.btn:hover { background: #1e293b; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.btn:disabled, .btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
.btn:disabled:hover { background: var(--dark); transform: none; }
.btn-primary:disabled:hover { background: var(--primary); transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }


/* ─────────────────────────────────────────
   7. COMPONENTS — Tables
   ───────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: #dcfce7; color: #166534; }
.badge-suspended { background: #fee2e2; color: #991b1b; }


/* ─────────────────────────────────────────
   8. NAVIGATION — Sidebar Links
   ───────────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    min-height: 44px; /* Accessible tap target */
}

.nav-link:hover, .nav-link.active {
    background: var(--light);
    color: var(--dark);
}

.nav-link.active {
    border-left: 3px solid var(--primary);
    padding-left: 12px; /* compensate for 3px border so text doesn't shift */
}

.nav-icon { margin-right: 10px; font-size: 1.1rem; }

/* ── Sidebar Header ── */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-brand-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Plan Badge ── */
.plan-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.plan-badge-free { background: var(--light); color: var(--text-muted); }
.plan-badge-pro  { background: #dcfce7; color: #166534; }

/* ── Nav Section Label ── */
.nav-section-label {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 700;
    letter-spacing: 1px;
}

/* ── Nav Dividers ── */
.nav-divider {
    border-top: 1px solid var(--light);
    margin: 10px 0;
}

.nav-divider-lg { margin: 20px 0; }

/* ── Nav Link Color Variants ── */
.nav-link.link-store   { color: #3b82f6; }
.nav-link.link-upgrade { color: var(--primary); }
.nav-link.link-danger  { color: var(--danger); }

.nav-link.link-store:hover   { background: #eff6ff; }
.nav-link.link-upgrade:hover { background: #f0fdf4; }
.nav-link.link-danger:hover  { background: #fef2f2; }

/* ── Store Link Row (link + copy button) ── */
.nav-link-row {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 5px;
}

.nav-link-row .nav-link {
    flex: 1;
    margin-bottom: 0;
}

.copy-link-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    flex-shrink: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.copy-link-sm:hover { background: var(--light); }


/* ─────────────────────────────────────────
   9. STOREFRONT — Store Header
   ───────────────────────────────────────── */
.store-header {
    background: var(--white);
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.store-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #333;
    text-transform: capitalize;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.store-header p { color: #888; font-size: 0.9rem; margin-top: 5px; }


/* ─────────────────────────────────────────
   10. STOREFRONT — Product Grid & Cards
   ───────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 15px;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 100px;
}

@media (min-width: 600px) {
    .product-grid { grid-template-columns: 1fr 1fr; }
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #eee;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img { transform: scale(1.03); }

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

.product-title {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 4px;
    line-height: 1.2;
}

.product-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
}

/* ── Add to Cart Button ── */
.btn-add {
    width: 100%;
    padding: 10px;
    background: #edf2f7;
    color: #333;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), transform var(--transition);
    min-height: 44px;
}

.btn-add:active { transform: scale(0.97); }


/* ─────────────────────────────────────────
   11. STOREFRONT — Floating Cart Bar
   ───────────────────────────────────────── */
.floating-cart {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: opacity 0.3s, bottom 0.3s;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

.floating-cart.visible { opacity: 1; pointer-events: all; animation: cartPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes cartPulse {
    0%   { transform: translateX(-50%) scale(0.9); opacity: 0; }
    60%  { transform: translateX(-50%) scale(1.03); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
.cart-total { font-weight: 700; font-size: 1.1rem; }
.cart-action { font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }


/* ─────────────────────────────────────────
   12. STATS PAGE
   ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: 5px;
}


/* ─────────────────────────────────────────
   13. MOBILE MENU BUTTON
   (consolidated from header.php inline styles)
   ───────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: var(--dark);
    color: white;
    border: none;
    width: auto;
    height: auto;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition);
}

.mobile-menu-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* ── Sidebar Overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

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


/* ─────────────────────────────────────────
   14. RESPONSIVE — Mobile (≤900px)
   ───────────────────────────────────────── */
@media (max-width: 900px) {
    /* Show mobile menu button */
    .mobile-menu-btn { display: flex; }

    /* Sidebar: hidden off-screen, slides in */
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 320px;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 9999;
    }

    .sidebar.active { transform: translateX(0); }

    /* Show close button inside sidebar */
    .sidebar-close-btn {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-muted);
        cursor: pointer;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px 15px;
    }
}


/* ─────────────────────────────────────────
   15. UTILITIES — Skeleton Loading
   ───────────────────────────────────────── */

/* Usage: <div class="skeleton" style="height:200px;"></div> */
.skeleton {
    background: linear-gradient(
        90deg,
        #e2e8f0 25%,
        #f1f5f9 50%,
        #e2e8f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
}

.skeleton * { visibility: hidden; }

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ─────────────────────────────────────────
   16. UTILITIES — Toast Notifications
   ───────────────────────────────────────── */

/*
   Usage (JS):
   showToast('Product saved!', 'success');

   function showToast(msg, type = 'success') {
       const t = document.createElement('div');
       t.className = 'toast toast-' + type;
       t.textContent = msg;
       document.body.appendChild(t);
       setTimeout(() => t.remove(), 4000);
   }
*/
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    z-index: 10001;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), toastOut 0.3s ease 3.5s forwards;
    pointer-events: none;
    max-width: 350px;
}

.toast-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.toast-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

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

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


/* ─────────────────────────────────────────
   17. UTILITIES — Visually Hidden
   (for screen reader-only text)
   ───────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ─────────────────────────────────────────
   18. PRINT
   ───────────────────────────────────────── */
@media print {
    .sidebar,
    .mobile-menu-btn,
    .sidebar-overlay,
    .floating-cart,
    .store-cta,
    .btn-add,
    .qty-control {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    body { background: white; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }

    .product-grid { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
    .product-card { box-shadow: none; border: 1px solid #ddd; }
}