/* 
   WeSafe Admin - High-End Design System v2.0
   Design: Compact, Glassmorphism, Dynamic
*/

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Variables that change with theme */
    --bg-main: #0b0f1a;
    --sidebar-bg: #111827;
    --card-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: rgba(15, 23, 42, 0.8);
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Light Mode */
[data-theme="light"] {
    --bg-main: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.06);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --input-bg: #ffffff;
    --shadow-main: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* Midnight Mode */
[data-theme="midnight"] {
    --bg-main: #020617;
    --sidebar-bg: #000000;
    --card-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(56, 189, 248, 0.1);
    --primary: #38bdf8;
    --text-main: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Refined */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    background: var(--bg-main);
    min-width: 0;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1.25rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-main);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Stats Grid - Fixed Size & Professional */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Tables */
.data-table-container {
    overflow: hidden;
    margin-top: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Inputs */
.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-main);
    outline: none;
    font-size: 0.9rem;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Theme Switcher Bottom */
.appearance-box {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.theme-btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
}

.theme-btn.active {
    border-color: var(--primary);
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 1rem;
    }

    .sidebar .logo-container h2,
    .sidebar .nav-link span,
    .sidebar .appearance-box {
        display: none;
    }

    .logo-container {
        padding: 0;
        justify-content: center;
    }
}