/* =====================================================
   Prima Bakery — Admin Panel Styles
   Sidebar, layout, dashboard, and admin-specific styles
   ===================================================== */

/* ── Admin Layout ── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1F2937 0%, #111827 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
    overflow: hidden;
}
.sidebar-header {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
.sidebar-brand {
    flex: 1;
    min-width: 0;
}
.sidebar-brand h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-brand span {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem;
}
.sidebar-menu::-webkit-scrollbar {
    width: 3px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.menu-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    padding: 1rem 0.75rem 0.375rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    position: relative;
    user-select: none;
}
.menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}
.menu-item.active {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.menu-item .menu-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.menu-item .menu-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}
.menu-item .menu-badge {
    margin-left: auto;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
}
.menu-item.active .menu-badge {
    background: rgba(255,255,255,0.25);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #DC2626, #F87171);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}
.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

/* ── Main Content ── */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── Top Header Bar ── */
.top-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.top-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.mobile-toggle {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
}
.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}
.header-btn:hover {
    background: #F3F4F6;
    color: var(--text-primary);
}
.header-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid white;
}

/* ── Content Area ── */
.content-area {
    padding: 1.5rem;
}

/* ── Dashboard Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.chart-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
}
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.chart-card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.chart-filter-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.chart-filter-btn:hover,
.chart-filter-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

/* ── Data Card / Section ── */
.section-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}
.section-card > .overflow-x-auto {
    overflow-x: auto;
}
.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    min-height: 56px;
    flex-wrap: nowrap;
}
.section-card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.section-card-body {
    padding: 1.25rem 1.5rem;
}
.section-card-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Header Actions (filters + button grouped right) ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    margin-left: auto;
    flex-shrink: 1;
    min-width: 0;
}
.header-actions > .btn {
    flex-shrink: 0;
    white-space: nowrap;
    height: 36px;
    display: inline-flex;
    align-items: center;
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
}
.filter-bar .form-input,
.filter-bar .form-select {
    min-width: 0;
    width: 150px;
    padding: 0.4375rem 0.75rem;
    font-size: 0.8125rem;
    height: 36px;
    flex-shrink: 1;
    box-sizing: border-box;
}

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #991B1B 0%, #DC2626 30%, #EF4444 60%, #FCA5A5 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -200px;
    right: -200px;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    bottom: -150px;
    left: -100px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: modalSlideUp 0.5s ease;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
}
.login-logo h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
}
.login-logo p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-toggle {
        display: flex;
    }
    .content-area {
        padding: 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .section-card-header {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    .section-card-body {
        padding: 1rem;
    }
    /* Mobile overlay when sidebar open */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .top-header {
        padding: 0 1rem;
    }
    .filter-bar {
        flex-wrap: wrap;
        width: 100%;
    }
    .filter-bar .form-input {
        width: auto;
        flex: 1;
        min-width: 120px;
    }
    .filter-bar .form-select {
        width: auto;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stat-card .stat-value {
        font-size: 1.375rem;
    }
    .login-card {
        margin: 1rem;
        padding: 1.75rem;
    }
}
