:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-input: #22222e;
    --bg-hover: #2a2a38;
    --border: #2a2a3a;
    --border-focus: #00d4aa;
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555568;
    --accent: #00d4aa;
    --accent-hover: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --danger: #ff4757;
    --danger-hover: #ff3344;
    --warning: #ffa502;
    --success: #00d4aa;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--bg-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: white;
}

.brand-name span { color: var(--accent); }

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
}

.menu-header {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 2rem 0 1rem 1rem;
    font-weight: 700;
}

.sidebar-nav ul { list-style: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-link i { width: 20px; font-size: 1.1rem; }

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0; /* Critical: prevents flex child from overflowing */
    margin-left: 280px;
    min-height: 100vh;
    width: calc(100% - 280px);
    overflow-x: hidden;
}

/* Responsive Table Wrapper */
.responsive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
    border-radius: var(--radius-sm);
}

.responsive-table-wrapper table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

.responsive-table-wrapper th,
.responsive-table-wrapper td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.responsive-table-wrapper th {
    background: var(--bg-input);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.responsive-table-wrapper tbody tr:hover { background: var(--bg-hover); }

.topbar {
    padding: 1rem 2rem;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info { text-align: right; }
.user-name { font-size: 0.9rem; font-weight: 600; display: block; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

/* Page Content */
.page-content {
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

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

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

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

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    background: radial-gradient(circle at top right, var(--accent-glow), transparent 70%);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: white;
}

.stat-icon {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    opacity: 0.1;
    color: var(--accent);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

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

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tr:hover td { background: rgba(255,255,255,0.02); }

/* Forms & Inputs */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: rgba(0, 212, 170, 0.1); color: var(--accent); }
.badge-pending { background: rgba(255, 165, 2, 0.1); color: var(--warning); }
.badge-danger { background: rgba(255, 71, 87, 0.1); color: var(--danger); }

.type-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.type-update { background: rgba(0, 212, 170, 0.1); color: var(--accent); }
.type-warning { background: rgba(255, 71, 87, 0.1); color: var(--danger); }

/* Auth Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1a1a26, #0a0a0f);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow);
}

.auth-header { text-align: center; margin-bottom: 2.5rem; }
.auth-logo {
    width: 60px; height: 60px;
    background: var(--accent);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--bg-primary);
    margin: 0 auto 1.5rem;
}

.auth-title { font-size: 1.5rem; font-weight: 800; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: -150px;
    left: 15px;
    right: 15px;
    max-width: 450px;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, visibility 0.4s;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(150%);
}
.cookie-banner.active { 
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    bottom: 20px;
}
.cookie-content { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.cookie-content strong { color: white; display: block; margin-bottom: 5px; font-size: 0.95rem; }
.cookie-actions { display: flex; gap: 10px; }
.cookie-btns { flex: 1; justify-content: center; font-size: 0.75rem; padding: 10px; height: 40px; }

@media (min-width: 768px) {
    .cookie-banner { left: auto; right: 30px; width: 380px; transform: translateX(120%); bottom: 30px; }
    .cookie-banner.active { transform: translateX(0); bottom: 30px; }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; min-width: 0; max-width: 100vw; }
    .app-wrapper { overflow-x: hidden; }
    .sidebar-overlay {
        display: none;
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.7); z-index: 1000; backdrop-filter: blur(4px);
    }
    .sidebar-overlay.active { display: block; }
}

.mobile-header {
    display: none;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 1024px) {
    .mobile-header { display: flex; }
    .topbar { display: none; }
    .page-content { padding: 1rem; }
}
