:root {
    --pwa-bg: #0a0a0b;
    --pwa-surface: #141416;
    --pwa-surface-2: #1e1e21;
    --pwa-card: rgba(20, 20, 22, 0.7);
    --pwa-primary: #fe2c55;
    --pwa-secondary: #ff0050;
    --pwa-accent: #f472b6;
    --pwa-success: #10b981;
    --pwa-warning: #f59e0b;
    --pwa-danger: #ef4444;
    --pwa-text: #f3f4f6;
    --pwa-text-muted: #9ca3af;
    --pwa-border: rgba(255, 255, 255, 0.08);
    --header-h: 64px;
    --nav-h: 72px;
    --sidebar-w: 260px;
    --card-radius: 20px;
    --glass: blur(12px) saturate(180%);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent; 
}

html, body { 
    height: 100%; 
    background: var(--pwa-bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--pwa-text);
    overflow-x: hidden;
    line-height: 1.5;
}

/* ============================
   LAYOUT & CONTAINERS
   ============================ */
.pwa-body { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

/* Container for responsive layout */
.app-container {
    display: flex;
    flex: 1;
    width: 100%;
}

.pwa-main {
    flex: 1;
    padding-top: var(--header-h);
    padding-bottom: var(--nav-h);
    width: 100%;
}

@media (min-width: 1024px) {
    .pwa-main {
        padding-bottom: 0;
        margin-left: var(--sidebar-w);
        padding-top: 0; /* Header might be different or part of sidebar */
    }
}

/* ============================
   HEADER
   ============================ */
.pwa-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--pwa-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

@media (min-width: 1024px) {
    .pwa-header {
        left: var(--sidebar-w);
    }
}

.pwa-header-left { display: flex; align-items: center; min-width: 48px; gap: 12px; }
.pwa-brand { font-weight: 800; font-size: 18px; color: var(--pwa-text); }
.pwa-header-title { font-weight: 600; font-size: 16px; color: var(--pwa-text); }
.pwa-header-right { display: flex; align-items: center; justify-content: flex-end; min-width: 48px; }

/* Burger Menu */
.burger-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--pwa-text);
    border-radius: 2px;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-open .burger-menu span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-open .burger-menu span:nth-child(2) { opacity: 0; }
.sidebar-open .burger-menu span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 1024px) {
    .burger-menu { display: none; }
}

/* ============================
   SIDEBAR (Desktop)
   ============================ */
.pwa-sidebar {
    display: flex;
    position: fixed;
    top: 0; bottom: 0;
    left: calc(-1 * var(--sidebar-w));
    width: var(--sidebar-w);
    background: var(--pwa-surface);
    border-right: 1px solid var(--pwa-border);
    flex-direction: column;
    padding: 24px 16px;
    z-index: 1200;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-open .pwa-sidebar {
    transform: translateX(var(--sidebar-w));
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
}

@media (min-width: 1024px) {
    .pwa-sidebar { 
        left: 0;
        transform: none;
        box-shadow: none;
    }
    .sidebar-open .pwa-sidebar { transform: none; }
}

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 32px;
    text-decoration: none;
    color: var(--pwa-text);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--pwa-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link i, .sidebar-link img, .sidebar-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-icon {
    font-size: 16px;
    line-height: 1;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--pwa-text);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(254, 44, 85, 0.1), rgba(254, 44, 85, 0.05));
    color: var(--pwa-primary);
    border: 1px solid rgba(254, 44, 85, 0.2);
}

.sidebar-link.active i, .sidebar-link.active img {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(254, 44, 85, 0.4));
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--pwa-border);
}

/* ============================
   BOTTOM NAV (Mobile)
   ============================ */
.pwa-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-top: 1px solid var(--pwa-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

@media (min-width: 1024px) {
    .pwa-bottom-nav { display: none; }
}

.pwa-nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; text-decoration: none; color: var(--pwa-text-muted);
    padding: 8px; flex: 1; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-nav-item.active { color: var(--pwa-primary); }
.pwa-nav-icon { 
    width: 24px; height: 24px; 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.pwa-nav-icon img { width: 100%; height: 100%; object-fit: contain; }
.pwa-nav-item.active .pwa-nav-icon { transform: translateY(-4px) scale(1.1); }
.pwa-nav-label { font-size: 11px; font-weight: 600; }

/* ============================
   COMPONENTS
   ============================ */
.pwa-page { 
    padding: 24px 16px; 
    max-width: 1200px; 
    margin: 0 auto;
}

.pwa-section-title {
    font-size: 14px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--pwa-text-muted); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.pwa-section-title::after { content: ""; flex: 1; height: 1px; background: var(--pwa-border); }

.pwa-card {
    background: var(--pwa-card);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--pwa-border);
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 24px;
    transition: transform 0.2s, border-color 0.2s;
}
.pwa-card:hover { border-color: rgba(254, 44, 85, 0.3); }

/* Tabs */
.pwa-tabs {
    display: flex;
    background: var(--pwa-surface-2);
    border: 1px solid var(--pwa-border);
    padding: 4px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.pwa-tab-item {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--pwa-text-muted);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-tab-item.active {
    background: var(--pwa-primary);
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}


/* Grid for stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
}

.stat-card {
    background: var(--pwa-surface);
    border: 1px solid var(--pwa-border);
    border-radius: var(--card-radius);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-value { font-size: 28px; font-weight: 800; color: var(--pwa-text); line-height: 1; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--pwa-text-muted); }

/* Avatar & Dropdown */
.pwa-avatar {
    width: 38px; height: 38px; border-radius: 12px;
    background: linear-gradient(135deg, var(--pwa-primary), var(--pwa-secondary));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #ffffff;
    cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}
.pwa-avatar:active { transform: scale(0.95); }

.pwa-dropdown {
    position: absolute;
    top: calc(100% + 12px); right: 0;
    width: 220px;
    background: rgba(20, 20, 22, 0.95);
    backdrop-filter: var(--glass);
    border: 1px solid var(--pwa-border);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    display: none; flex-direction: column;
    z-index: 1000;
    animation: dropDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.pwa-dropdown.show { display: flex; }

@keyframes dropDown {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.pwa-dropdown-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    color: var(--pwa-text); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: background 0.2s;
}
.pwa-dropdown-item:hover { background: rgba(255,255,255,0.05); }

/* ============================
   AUTH PAGES
   ============================ */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-visual {
    display: none;
    flex: 1.2;
    background: linear-gradient(135deg, #0a0a0b 0%, #1e1e21 100%);
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .auth-visual { display: flex; align-items: center; justify-content: center; padding: 60px; }
}

.auth-visual-content {
    z-index: 2;
    max-width: 500px;
    text-align: center;
}

.auth-visual-img {
    width: 100%;
    max-width: 480px;
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    margin-bottom: 40px;
}

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--pwa-bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    z-index: 2;
}

.auth-title { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.auth-subtitle { color: var(--pwa-text-muted); font-size: 16px; margin-bottom: 40px; }

.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--pwa-text-muted); }
.form-input {
    width: 100%;
    background: var(--pwa-surface);
    border: 1px solid var(--pwa-border);
    border-radius: 14px;
    padding: 14px 18px;
    color: var(--pwa-text);
    font-size: 16px;
    transition: all 0.2s;
}
.form-input:focus { 
    outline: none; 
    border-color: var(--pwa-primary); 
    box-shadow: 0 0 0 4px rgba(254, 44, 85, 0.15); 
    background: #1a1a1d;
}

.btn-premium {
    width: 100%;
    background: linear-gradient(135deg, var(--pwa-primary), var(--pwa-secondary));
    color: white;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(254, 44, 85, 0.2);
}
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(254, 44, 85, 0.3); }
.btn-premium:active { transform: translateY(0); }

/* ============================
   UTILITIES
   ============================ */
.animate-fade-up {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.badge {
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.badge-primary { background: rgba(254, 44, 85, 0.15); color: var(--pwa-primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--pwa-success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--pwa-warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--pwa-danger); }

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

.responsive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
        align-items: start;
    }
}

/* List Rows & Item Styling */
.pwa-list-group {
    background: var(--pwa-card);
    border: 1px solid var(--pwa-border);
    border-radius: var(--card-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.pwa-alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--pwa-border);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pwa-alert-row:last-child {
    border-bottom: none;
}

.pwa-alert-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.pwa-alert-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.pwa-alert-icon {
    width: 44px;
    height: 44px;
    background: var(--pwa-surface-2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.pwa-alert-body {
    flex: 1;
    min-width: 0;
}

.pwa-alert-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pwa-text);
    margin-bottom: 2px;
}

.pwa-alert-desc {
    font-size: 12px;
    color: var(--pwa-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================
   PWA BUTTONS
   ============================ */
.btn-pwa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--pwa-primary), #0ea5e9);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 15px rgba(254, 44, 85, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-pwa::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-pwa:hover::after {
    left: 100%;
}

.btn-pwa:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(254, 44, 85, 0.3);
    filter: brightness(1.1);
}

.btn-pwa:active {
    transform: translateY(0) scale(0.97);
}

.btn-pwa-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--pwa-text);
    border: 1px solid var(--pwa-border);
    box-shadow: none;
}

.btn-pwa-success {
    background: linear-gradient(135deg, var(--pwa-success), #059669);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.2);
}