/* =========================================
   Premium Admin Dashboard - Professional Dark
   Design Philosophy: "Linear-style" - Clean, High Contrast, Subtle Borders
   ========================================= */

:root {
    /* --- Base Palette (Neutral Cool Grays) --- */
    --bg-root: #0b0c0e;       /* Deepest background */
    --bg-surface: #131416;    /* Card background */
    --bg-surface-hover: #1b1c1e;
    --bg-surface-active: #232426;
    
    /* --- Borders & Separators --- */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.12);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* --- Text Colors --- */
    --text-primary: #ededef;
    --text-secondary: #a0a0a2;
    --text-tertiary: #707073;
    --text-on-accent: #ffffff;

    /* --- Brand Accents --- */
    --accent-primary: #5e6ad2;    /* Refined Indigo */
    --accent-primary-hover: #6f7bf0;
    --accent-glow: rgba(94, 106, 210, 0.15);
    
    /* --- Functional Colors --- */
    --color-success: #27c9a9;
    --color-success-bg: rgba(39, 201, 169, 0.1);
    --color-warning: #f5a623;
    --color-warning-bg: rgba(245, 166, 35, 0.1);
    --color-danger: #f2555a;
    --color-danger-bg: rgba(242, 85, 90, 0.1);
    --color-info: #5292ff;
    --color-info-bg: rgba(82, 146, 255, 0.1);

    /* --- Metrics & Layout --- */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* --- Animations --- */
    --ease-out: cubic-bezier(0.21, 0.95, 0.35, 1.00); /* Smooth snap */
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: color var(--duration-fast) ease; }
ul { list-style: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-active); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ==================== Login Screen ==================== */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-root);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.6;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--space-xl);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    position: relative;
    z-index: 2;
    animation: fadeUp 0.6s var(--ease-out);
}

.login-header { text-align: center; margin-bottom: var(--space-xl); }
.login-header i { 
    font-size: 48px; 
    color: var(--accent-primary); 
    margin-bottom: var(--space-md);
    filter: drop-shadow(0 0 10px var(--accent-primary));
}
.login-header h1 { font-size: 24px; font-weight: 600; margin-bottom: var(--space-xs); }
.login-header p { color: var(--text-tertiary); }

/* ==================== Layout Structure ==================== */
.dashboard {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ==================== Sidebar ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 50;
    transition: transform var(--duration-normal) var(--ease-out);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-sm);
}

.sidebar-header i { color: var(--accent-primary); font-size: 20px; }
.sidebar-header h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md) var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    transition: all var(--duration-fast) ease;
    position: relative;
}

.nav-item i { 
    width: 20px; 
    margin-right: var(--space-md); 
    text-align: center; 
    color: var(--text-tertiary);
    transition: color var(--duration-fast) ease;
}

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

.nav-item:hover i { color: var(--text-primary); }

.nav-item.active {
    background: var(--bg-surface-active);
    color: var(--text-primary);
}

.nav-item.active i { color: var(--accent-primary); }

.nav-item .badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--duration-fast);
}

.logout-btn:hover {
    background: rgba(242, 85, 90, 0.1);
    color: var(--color-danger);
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-root);
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* --- Header --- */
.header {
    height: var(--header-height);
    padding: 0 var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 12, 14, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 40;
}

.header h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); }

/* --- Content Area --- */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    display: none;
    animation: fadeIn 0.3s var(--ease-out);
}

.tab-content.active { display: block; }

/* ==================== Components ==================== */

/* --- Cards --- */
.section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.section h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transition: transform var(--duration-fast), border-color var(--duration-fast);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bg-blue { background: rgba(82, 146, 255, 0.1); color: #5292ff; }
.bg-green { background: rgba(39, 201, 169, 0.1); color: #27c9a9; }
.bg-orange { background: rgba(245, 166, 35, 0.1); color: #f5a623; }
.bg-red { background: rgba(242, 85, 90, 0.1); color: #f2555a; }
.bg-purple { background: rgba(111, 123, 247, 0.1); color: #6f7bf7; }

.stat-info h3 { font-size: 24px; font-weight: 700; margin-bottom: 2px; }
.stat-info p { font-size: 13px; color: var(--text-secondary); }
.stat-info small { display: block; margin-top: 4px; font-size: 11px; color: var(--text-tertiary); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-fast);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-primary:hover { background: var(--accent-primary-hover); }

.btn-secondary {
    background: var(--bg-surface-active);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--border-hover); }

.btn-success { background: rgba(39, 201, 169, 0.15); color: #27c9a9; border-color: rgba(39, 201, 169, 0.2); }
.btn-success:hover { background: rgba(39, 201, 169, 0.25); }

.btn-danger { background: rgba(242, 85, 90, 0.15); color: #f2555a; border-color: rgba(242, 85, 90, 0.2); }
.btn-danger:hover { background: rgba(242, 85, 90, 0.25); }

/* --- Inputs --- */
input, select, textarea {
    width: 100%;
    background: var(--bg-root);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: border-color var(--duration-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--bg-surface-active);
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface-hover); }

/* --- Status Badges --- */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-active, .status-accepted, .status-completed, .status-open, .status-win {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(39, 201, 169, 0.2);
}

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(245, 166, 35, 0.2);
}

.status-banned, .status-suspended, .status-refuse, .status-refused, .status-cancelled, .status-lose {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid rgba(242, 85, 90, 0.2);
}

.status-closed, .status-inactive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* --- Quick Actions --- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    gap: var(--space-md);
    transition: all var(--duration-fast);
}

.action-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.action-btn i { font-size: 24px; color: var(--accent-primary); }
.action-btn span { font-weight: 500; }

/* ==================== Modals ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--duration-normal);
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-surface);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--duration-normal) var(--ease-out);
}

.modal.show .modal-content { transform: scale(1); }

.modal-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { font-size: 16px; font-weight: 600; }

.close-btn {
    font-size: 24px;
    color: var(--text-tertiary);
    line-height: 1;
}
.close-btn:hover { color: var(--text-primary); }

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
}

.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

/* ==================== Mobile Responsiveness ==================== */
.mobile-menu-toggle { display: none; font-size: 20px; color: var(--text-primary); margin-right: 15px; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        transition: transform var(--duration-normal) var(--ease-out);
        z-index: 50; /* Ensure strictly above overlay */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 45;
        display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }

    .header { padding: 0 var(--space-md); }
    .tab-content { padding: var(--space-md); }
    
    .stats-grid { grid-template-columns: 1fr; }
    .header-actions span { display: none; } /* Hide button text if needed */
}

/* ==================== Utilities ==================== */
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-center { text-align: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    min-width: 300px;
    animation: fadeUp 0.3s var(--ease-out);
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.info { border-left: 3px solid var(--color-info); }