:root {
    /* Premium Color Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #64748b;
    --dark: #0f172a;
    --white: #ffffff;
    --bg-main: #f8fafc;
    --bg-side: #ffffff;

    /* Semantic Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Awards Colors */
    --gold: #fbbf24;
    --silver: #cbd5e1;
    --bronze: #d97706;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --radius: 1rem;
    --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Layout */
.admin-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-side);
    border-right: 1px solid #e2e8f0;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--dark);
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger-btn svg {
    width: 24px;
    height: 24px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.025em;
}

.nav-menu {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.5rem;
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Main Content */
.main-content {
    padding: 2.5rem 3.5rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
}

.page-title h1 {
    font-size: 2.25rem;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.page-title p {
    color: var(--secondary);
    font-weight: 500;
}

.admin-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 3rem;
    align-items: start;
}

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

.stat-box {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-label {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.05em;
    line-height: 1;
}

/* Data Sections */
.section-wrapper {
    background: white;
    border-radius: 2rem;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
}

.section-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.section-header h2 {
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

/* Table Style */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    padding: 1.25rem 2.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--secondary);
    background: #f8fafc;
}

.premium-table td {
    padding: 1.5rem 2.5rem;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
}

.premium-table tr:hover td {
    background-color: #fcfcfc;
}

/* Badges */
.badge {
    padding: 0.375rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

/* Buttons */
.btn-premium {
    background: var(--dark);
    color: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-premium:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -10px rgba(79, 70, 229, 0.4);
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    border-radius: 0.75rem;
}

/* Animations */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInSlide 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .admin-container {
        grid-template-columns: 240px 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-container {
        grid-template-columns: 1fr;
        display: block;
    }

    /* Top Mobile Sidebar styling */
    .sidebar {
        position: static;
        height: auto;
        padding: 1rem 1.5rem;
        display: block;
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
        background: white;
    }

    .brand {
        margin-bottom: 0;
    }
    
    .hamburger-btn {
        display: block;
    }

    /* Hide menus by default on mobile */
    .nav-menu,
    .sidebar > .nav-item {
        display: none;
    }

    /* Show menus when sidebar has .active class */
    .sidebar.active .nav-menu {
        display: flex;
        flex-direction: column;
        margin-top: 1rem;
    }
    .sidebar.active > .nav-item {
        display: flex;
        margin-top: 1rem;
        justify-content: flex-start;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-title h1 {
        font-size: 1.75rem;
    }

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

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

    .section-header {
        padding: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .premium-table th,
    .premium-table td {
        padding: 1rem;
    }

    /* Table Responsive Wrapper */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =========================================================================
   SIDEBAR COLLAPSE SYSTEM (DESKTOP COLLAPSE & MOBILE DRAWER)
   ========================================================================= */

/* Enable hamburger button on all screen sizes */
.hamburger-btn {
    display: block !important;
}

/* Transitions for smooth sliding animations */
.admin-container {
    transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar {
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state behavior on Desktop (>= 769px) */
@media (min-width: 769px) {
    body.sidebar-collapsed .admin-container {
        grid-template-columns: 80px 1fr;
    }
    
    body.sidebar-collapsed .sidebar {
        padding: 2rem 0.5rem;
        align-items: center;
    }
    
    body.sidebar-collapsed .brand {
        justify-content: center;
        padding: 0;
        margin-bottom: 2rem;
        width: 100%;
    }
    
    body.sidebar-collapsed .brand-wrapper {
        display: none !important;
    }
    
    body.sidebar-collapsed .nav-item {
        justify-content: center;
        padding: 0.875rem 0;
        gap: 0;
        width: 50px;
        height: 50px;
        margin-left: auto;
        margin-right: auto;
    }
    
    body.sidebar-collapsed .nav-item span {
        display: none !important;
    }
    
    body.sidebar-collapsed .nav-menu div {
        display: none !important; /* Hide category headers like "Menu Utama" */
    }
}

/* Mobile responsive fixes to prevent duplicate buttons */
@media (max-width: 768px) {
    body.sidebar-collapsed .admin-container {
        grid-template-columns: 1fr;
    }
}

/* Tablet & Medium Screen Responsive Enhancements */
@media (max-width: 1024px) {
    .main-content {
        padding: 2rem 1.75rem;
    }
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.25rem;
    }
}
