:root {
    --primary: #0a0a1a;
    --surface: rgba(20, 20, 45, 0.7);
    --secondary: #ff6b35;
    --accent: #ffd700;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --radius: 16px;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --glow: 0 0 20px rgba(255, 107, 53, 0.2);
    --bg-body: #0a0a1a;
}

[data-theme="light"] {
    --primary: #f1f5f9;
    --surface: rgba(255, 255, 255, 0.9);
    --secondary: #ff6b35;
    --accent: #d97706;
    --border: rgba(0, 0, 0, 0.08);
    --text: #0f172a;
    --text-muted: #64748b;
    --bg-body: #f1f5f9;
    --glow: 0 0 20px rgba(255, 107, 53, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-body);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    transition: background 0.3s ease;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(10, 10, 26, 0.95);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo i {
    color: var(--secondary);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background: var(--surface);
    color: #fff;
    border-color: var(--border);
    transform: translateX(5px);
    box-shadow: var(--glow);
}

.nav-link.active i {
    color: var(--secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    opacity: 0.5;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    margin: 0.5rem 0;
}

.stat-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trend-up {
    color: #10b981;
}

/* Content Sections */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(20px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), #d9480f);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.prod-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prod-img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-shipped {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-delivered {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.status-processing {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}
.status-cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Order filter chips */
.order-filter-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.order-chip {
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text);
}
.order-chip:hover { border-color: var(--secondary); color: var(--secondary); }
.order-chip.active { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.order-chip .chip-count {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 0 6px;
    margin-left: 4px;
    font-size: 0.7rem;
}

/* Expanded order detail row */
.expand-row-content {
    background: rgba(255,107,53,0.04);
    border: 1px solid rgba(255,107,53,0.15);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 0.25rem 0;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.expand-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}
.expand-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.tracking-input-row { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.tracking-input-row input { flex: 1; }
@media (max-width: 768px) { .expand-detail-grid { grid-template-columns: 1fr; } }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: #111122;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    padding: 3rem;
    position: relative;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

select.form-control option {
    background: var(--bg-body);
    color: var(--text);
}

/* Auth Screen */
#authScreen {
    position: fixed;
    inset: 0;
    background: #050510;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2rem;
}

.auth-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 450px;
    text-align: center;
    backdrop-filter: blur(30px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Toast */
#toastContainer {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--secondary);
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    box-shadow: var(--glow);
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        padding: 2rem 1rem;
    }

    .sidebar .logo span,
    .sidebar .nav-link span {
        display: none;
    }

    .main-content {
        margin-left: 80px;
        padding: 2rem 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
