:root {
    --bg: #121212;
    --surface: #1E1E1E;
    --surface-hover: #2A2A2A;
    --border: #333333;
    --text: #E0E0E0;
    --muted: #A0A0A0;
    --primary: #FF0000; /* Red as per screenshot-like style (e.g., Netflix/Youtube dark mode vibes) or just standard primary */
    --primary-hover: #CC0000;
    --success: #00C853;
    --warning: #FFD600;
    --danger: #FF3D00;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utilities */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--muted) !important; }

.bg-surface { background-color: var(--surface); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-column { flex-direction: column; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

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

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-nav {
    padding: 1.5rem 0;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--surface-hover);
    color: #fff;
}

.nav-item.active {
    background-color: var(--surface-hover);
    color: #fff;
    border-left-color: var(--primary);
}

.nav-icon {
    width: 24px;
    display: inline-block;
    text-align: center;
    margin-right: 10px;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.admin-header {
    height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.admin-content {
    padding: 2rem;
    flex: 1;
}

/* Mobile Page Title */
.mobile-page-title {
    display: none;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text);
}

/* Components */
.card {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 0.9rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background-color: var(--surface-hover);
    color: #fff;
    border-color: var(--text);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

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

.table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:last-child td {
    border-bottom: none;
}

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

/* Select2 Dark Mode Override */
.select2-container .select2-selection--single {
    height: 45px !important;
    background-color: var(--bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text) !important;
    line-height: normal !important;
    padding-left: 0.75rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 43px !important;
    position: absolute !important;
    top: 1px !important;
    right: 1px !important;
    width: 20px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--muted) transparent transparent transparent !important;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    left: 50%;
    margin-left: -4px;
    margin-top: -2px;
    position: absolute;
    top: 50%;
    width: 0;
}

.select2-dropdown {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

.select2-search--dropdown .select2-search__field {
    background-color: var(--bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    padding: 0.5rem !important;
    border-radius: 4px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--surface-hover) !important;
}

/* Responsive */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

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

    /* Ensure toggle button is visible when sidebar is collapsed */
    #sidebar-toggle {
        display: block !important;
    }
}

@media (max-width: 576px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .admin-content { padding: 1rem; }
    .admin-header { padding: 0 1rem; }

    /* Hide header title on mobile */
    .header-title {
        display: none !important;
    }
    
    /* Show page title on mobile */
    .mobile-page-title {
        display: block;
    }
}
