/* Global Variables & Themes - Premium Design System */
:root {
    --bg: #f8fafc;
    --bg-secondary: #ffffff;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --border: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-rgb: 79, 70, 229;
    --primary-hover: #4338ca;
    --accent: #10b981;
    --accent-rgb: 16, 185, 129;
    --error: #ef4444;
    --error-rgb: 239, 68, 68;
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --link: #4f46e5;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
}

[data-theme='dark'] {
    --bg: #020617;
    --bg-secondary: #0f172a;
    --surface: #0f172a;
    --surface-glass: rgba(15, 23, 42, 0.8);
    --border: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --link: #818cf8;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { 
    font-weight: 800; 
    margin: 0; 
    letter-spacing: -0.025em;
    color: var(--text-main);
}

a { color: var(--link); text-decoration: none; transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
a:hover { color: var(--primary-hover); }

/* Unified Navigation & Header */
.nav-container {
    backdrop-filter: blur(12px);
    background: var(--surface-glass);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none !important;
    white-space: nowrap;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-divider {
    height: 24px;
    width: 1px;
    background: var(--border);
    margin: 0 0.5rem;
}

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1.5rem;
    margin-left: 1.5rem;
    border-left: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.nav-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.nav-breadcrumb a:hover { color: var(--primary); }
.nav-breadcrumb .active { color: var(--text-main); }

.nav-icon-btn, .theme-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.nav-icon-btn:hover, .theme-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.nav-icon-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Nav Search Form (Specific to site layout) */
.nav-search-form {
    max-width: 400px;
    width: 100%;
    position: relative;
    margin-left: 1rem;
}

.nav-search-form .search-bar {
    width: 100% !important;
    padding: 0.8rem 1rem 0.8rem 2.8rem !important;
    border-radius: 999px !important;
    border: 1px solid var(--border) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    font-size: 0.95rem !important;
    outline: none !important;
    height: auto !important;
    box-shadow: none !important;
}

.nav-search-form .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 10;
}

/* Global Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    transition: 0.2s;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    text-decoration: none;
}

.btn:hover { background: var(--bg-secondary); border-color: var(--text-muted); }

.btn-primary {
    background: var(--primary);
    color: white !important;
    border: none;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: var(--radius-sm); }

.btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2) !important;
}

.btn-outline-primary { border-color: var(--primary); color: var(--primary); border: 1px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-outline-primary.active { background: var(--primary) !important; color: white !important; }

.form-group { margin-bottom: 1.5rem; width: 100%; }
.form-label { display: block; margin-bottom: 0.65rem; font-weight: 700; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.form-input {
    width: 100% !important;
    display: block;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-size: 1rem;
    transition: 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.badge {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-success { background: rgba(var(--accent-rgb), 0.15); color: var(--accent); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.text-muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.fw-bold { font-weight: 700; }
.d-block { display: block; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.ms-2 { margin-left: 0.5rem; }
.me-2 { margin-right: 0.5rem; }

.d-none { display: none !important; }
.hide-mobile { display: block; }
/* Mobile Navigation (Hamburger) */
.nav-mobile-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1100;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--surface);
    z-index: 1100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border-left: 1px solid var(--border);
}

.mobile-menu-drawer.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.mobile-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    color: var(--text-main);
    font-weight: 600;
    transition: 0.2s;
    text-decoration: none !important;
}

.mobile-nav-link i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.mobile-nav-link:hover, .mobile-nav-link.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.mobile-nav-link:hover i, .mobile-nav-link.active i {
    color: var(--primary);
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .nav-mobile-toggle { display: block; }
    .nav-breadcrumb, .nav-search-form, .nav-right .nav-icon-btn:not(.theme-btn), .nav-right .nav-divider { display: none !important; }
    .hide-mobile { display: none !important; }
    
    .logo { font-size: 1.25rem !important; }
}

/* Layout & Grid System */
.container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
    max-width: 1200px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -1rem;
    margin-left: -1rem;
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
}

@media (min-width: 768px) {
    .col-md-4 { flex: 0 0 auto; width: 33.333333%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-8 { flex: 0 0 auto; width: 66.666667%; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-container {
    min-height: calc(100vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    color: var(--text-main);
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }

.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 1rem !important; }
.gap-3 { gap: 1.5rem !important; }

.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.p-4 { padding: 1.5rem !important; }

.logout-btn { color: var(--error) !important; border-color: rgba(239, 68, 68, 0.2) !important; }
.logout-btn:hover { background: rgba(239, 68, 68, 0.05) !important; border-color: var(--error) !important; }

/* Role Selector (Register Page) */
.role-selector { display: flex; gap: 1rem; margin-bottom: 2rem; }
.role-option { flex: 1; cursor: pointer; }
.role-option input[type="radio"] { display: none; }
.role-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: 0.2s;
}
.role-option input[type="radio"]:checked + .role-card {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}
.role-option input[type="radio"]:checked + .role-card i,
.role-option input[type="radio"]:checked + .role-card .role-title {
    color: var(--primary);
}
.role-card i { font-size: 1.5rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.role-title { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
.role-info { display: block; font-size: 0.7rem; color: var(--text-muted); opacity: 0.7; }

.hidden { display: none !important; }

@media (max-width: 480px) {
    .role-selector { flex-direction: column; gap: 0.75rem; }
}

/* Premium Sidebar Layout System (Shared) */
.admin-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    flex: 1;
    margin-top: 1rem;
}

.menu-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 0 1rem 0.5rem 1rem;
    opacity: 0.8;
}

.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-decoration: none;
}

.admin-sidebar .nav-item:hover {
    background: var(--bg);
    color: var(--primary);
}

.admin-sidebar .nav-item.active {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    font-weight: 700;
}

.admin-sidebar i { font-size: 1.25rem; }

.admin-main {
    margin-left: 280px;
    padding: 2.5rem 3rem;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Mobile Adjustments for Sidebar */
.mobile-nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        visibility: hidden;
    }

    .admin-sidebar.active {
        transform: translateX(0);
        visibility: visible;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .admin-main {
        margin-left: 0;
        padding: 2rem 1.5rem;
    }

    .mobile-nav-toggle { display: flex; }
}

@media (max-width: 768px) {
    .admin-main h1 { font-size: 1.5rem !important; }
}
