/* ===================================
   Auth System - Bold Geometric Theme
   Light & Dark Mode Support
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

/* ===================================
   Dark Mode (Default)
   =================================== */
:root {
    --bg-dark: #050508;
    --bg-card: #0c0c12;
    --bg-elevated: #141420;
    --bg-input: #1a1a28;
    
    --coral: #ff6b6b;
    --coral-dim: rgba(255, 107, 107, 0.15);
    --mint: #4ecdc4;
    --mint-dim: rgba(78, 205, 196, 0.15);
    --gold: #ffd93d;
    --gold-dim: rgba(255, 217, 61, 0.15);
    --electric: #6c5ce7;
    
    --text-white: #ffffff;
    --text-light: #e8e8f0;
    --text-mid: #8888a0;
    --text-dim: #555566;
    
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.12);
    
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-strong: rgba(0, 0, 0, 0.5);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --sidebar-width: 280px;
    
    --logo-inner-bg: var(--bg-card);
}

/* ===================================
   Light Mode
   =================================== */
[data-theme="light"] {
    --bg-dark: #f5f5f8;
    --bg-card: #ffffff;
    --bg-elevated: #f0f0f5;
    --bg-input: #e8e8f0;
    
    --coral: #e55555;
    --coral-dim: rgba(229, 85, 85, 0.12);
    --mint: #2db5ad;
    --mint-dim: rgba(45, 181, 173, 0.12);
    --gold: #d4a800;
    --gold-dim: rgba(212, 168, 0, 0.12);
    --electric: #5a4ad1;
    
    --text-white: #0a0a12;
    --text-light: #1a1a28;
    --text-mid: #606080;
    --text-dim: #9090a8;
    
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.12);
    
    --shadow-color: rgba(0, 0, 0, 0.08);
    --shadow-strong: rgba(0, 0, 0, 0.15);
    
    --logo-inner-bg: var(--bg-card);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

a {
    color: var(--coral);
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: var(--text-white);
}

/* ===================================
   Theme Toggle Button
   =================================== */
.theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--bg-input);
    border: 2px solid var(--border-light);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.theme-toggle:hover {
    border-color: var(--coral);
}

.theme-toggle-thumb {
    width: 18px;
    height: 18px;
    background: var(--coral);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.68, -0.15, 0.32, 1.15);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-toggle-thumb svg {
    width: 12px;
    height: 12px;
    color: var(--bg-dark);
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

[data-theme="light"] .theme-toggle-thumb {
    transform: translateX(22px);
    background: var(--gold);
}

[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* Theme toggle for auth pages */
.auth-theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
}

/* ===================================
   Auth Pages
   =================================== */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: var(--bg-dark);
    position: relative;
    transition: background 0.3s;
}

.auth-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        conic-gradient(from 0deg at 50% 50%, 
            transparent 0deg, 
            var(--coral-dim) 60deg,
            transparent 120deg,
            var(--mint-dim) 180deg,
            transparent 240deg,
            var(--gold-dim) 300deg,
            transparent 360deg
        );
    animation: slowRotate 60s linear infinite;
    pointer-events: none;
}

@keyframes slowRotate {
    to { transform: rotate(360deg); }
}

.auth-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow-strong);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--coral), var(--mint), var(--gold));
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* Auth Logo - Custom Image */
.auth-logo {
    display: block;
    margin: 0 auto 1.5rem;
    border-radius: 12px;
    object-fit: contain;
    transition: transform 0.3s;
}

.auth-logo:hover {
    transform: scale(1.05);
}

/* Auth Logo - CSS Generated (fallback) */
.auth-header .logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.auth-header .logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--coral), var(--mint));
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.auth-header .logo::after {
    content: '';
    position: absolute;
    inset: 8px;
    background: var(--logo-inner-bg);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    transition: background 0.3s;
}

.auth-header .logo svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    z-index: 1;
    color: var(--coral);
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    color: var(--text-white);
}

.auth-header p {
    color: var(--text-mid);
    font-size: 1rem;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-error {
    background: var(--coral-dim);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--coral);
}

.alert-success {
    background: var(--mint-dim);
    border-color: rgba(78, 205, 196, 0.3);
    color: var(--mint);
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-mid);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > svg:first-of-type {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--text-dim);
    transition: 0.2s;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 1rem;
    font-family: inherit;
    transition: 0.2s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--coral);
    background: var(--bg-elevated);
}

.input-wrapper input:focus ~ svg:first-of-type,
.input-wrapper:focus-within > svg:first-of-type {
    color: var(--coral);
}

.input-wrapper input::placeholder {
    color: var(--text-dim);
}

.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.toggle-password svg {
    position: static;
    width: 18px;
    height: 18px;
    color: var(--text-dim);
}

.toggle-password:hover svg {
    color: var(--text-mid);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Password Strength */
.password-strength {
    margin-top: -0.75rem;
}

.strength-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: 0.3s;
}

.strength-fill.weak { width: 33%; background: var(--coral); }
.strength-fill.medium { width: 66%; background: var(--gold); }
.strength-fill.strong { width: 100%; background: var(--mint); }

.strength-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: 'Space Mono', monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--coral);
    color: var(--bg-dark);
}

[data-theme="light"] .btn-primary {
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px var(--coral-dim);
}

.btn-block { width: 100%; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-light);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: var(--coral);
    color: var(--coral);
}

.btn-sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.6rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: 0.2s;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--text-white);
    background: var(--bg-input);
}

.btn-icon.danger:hover {
    color: var(--coral);
    background: var(--coral-dim);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.auth-footer p {
    color: var(--text-mid);
}

/* Decoration - Hidden */
.auth-decoration { display: none; }

/* ===================================
   Dashboard
   =================================== */

.dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s, background 0.3s, border-color 0.3s;
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Sidebar Logo - Image from URL */
.sidebar-logo {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.2s, filter 0.2s;
}

.sidebar-brand:hover .sidebar-logo {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Fallback for old .logo class (CSS-generated) */
.sidebar-header .logo {
    width: 44px;
    height: 44px;
    position: relative;
    flex-shrink: 0;
}

.sidebar-header .logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--coral), var(--mint));
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.sidebar-header .logo::after {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--logo-inner-bg);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    transition: background 0.3s;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-white);
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    min-height: 0; /* Important for flex scroll */
    -webkit-overflow-scrolling: touch;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-mid);
    font-weight: 500;
    transition: 0.15s;
    position: relative;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-white);
    background: var(--bg-elevated);
}

.nav-item.active {
    color: #fff;
    background: var(--coral);
}

.nav-item.active svg {
    color: #fff;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: auto;
    background: var(--bg-card);
    position: sticky;
    bottom: 0;
}

/* Logout button styles moved to sidebar.php */

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0;
}

.nav-badge {
    margin-left: auto;
    padding: 0.2rem 0.55rem;
    background: var(--coral);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.3s, border-color 0.3s;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-white);
}

.menu-toggle {
    display: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    cursor: pointer;
    color: var(--text-mid);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover,
.menu-toggle:active {
    background: var(--coral);
    border-color: var(--coral);
    color: #fff;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--coral), var(--gold));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.user-avatar.small {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
}

.user-avatar.large {
    width: 90px;
    height: 90px;
    font-size: 2.25rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-white);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
}

/* Content */
.content-wrapper {
    flex: 1;
    padding: 2rem;
    background: var(--bg-dark);
    transition: background 0.3s;
}

/* Welcome Banner */
.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--coral-dim) 0%, transparent 70%);
    transform: translate(30%, -30%);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--mint-dim) 0%, transparent 70%);
    transform: translateY(50%);
}

.welcome-text {
    position: relative;
    z-index: 1;
}

.welcome-text h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: var(--text-white);
}

.welcome-text p {
    color: var(--text-mid);
    font-size: 1.05rem;
}

.welcome-illustration { display: none; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--coral);
    opacity: 0;
    transition: 0.2s;
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(2)::before { background: var(--mint); }
.stat-card:nth-child(3)::before { background: var(--gold); }
.stat-card:nth-child(4)::before { background: var(--electric); }

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--coral-dim);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card:nth-child(2) .stat-icon { background: var(--mint-dim); }
.stat-card:nth-child(2) .stat-icon svg { color: var(--mint); }
.stat-card:nth-child(3) .stat-icon { background: var(--gold-dim); }
.stat-card:nth-child(3) .stat-icon svg { color: var(--gold); }
.stat-card:nth-child(4) .stat-icon { background: rgba(108, 92, 231, 0.15); }
.stat-card:nth-child(4) .stat-icon svg { color: var(--electric); }

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--coral);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Space Mono', monospace;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-white);
}

/* Permissions */
.permissions-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: background 0.3s, border-color 0.3s;
}

.permissions-section h3 {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-white);
}

.permissions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.permission-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    transition: 0.2s;
}

.permission-badge:hover {
    border-color: var(--mint);
}

.permission-badge svg {
    width: 14px;
    height: 14px;
    color: var(--mint);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated);
    transition: background 0.3s;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-white);
}

.card-body {
    padding: 1.5rem;
}

.badge {
    display: inline-flex;
    padding: 0.35rem 0.85rem;
    background: var(--coral);
    color: #fff;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-elevated);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Space Mono', monospace;
}

.data-table tbody tr {
    transition: 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-elevated);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.user-cell .user-name {
    font-weight: 600;
    color: var(--text-white);
}

.user-cell .user-username {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: 'Space Mono', monospace;
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge.role-admin {
    background: var(--coral);
    color: #fff;
}

.role-badge.role-moderator {
    background: var(--gold);
    color: #1a1a28;
}

.role-badge.role-user {
    background: var(--mint);
    color: #1a1a28;
}

/* Status */
.status-badge {
    display: inline-flex;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background: var(--mint-dim);
    color: var(--mint);
}

.status-badge.inactive {
    background: var(--coral-dim);
    color: var(--coral);
}

/* Select */
.role-select {
    padding: 0.5rem 0.9rem;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: 0.2s;
}

.role-select:focus {
    outline: none;
    border-color: var(--coral);
}

/* Actions */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.inline-form { display: inline; }
.text-muted { color: var(--text-dim); }

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Form Vertical */
.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-vertical input,
.form-vertical textarea,
.form-vertical select {
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 0.95rem;
    font-family: inherit;
    transition: 0.2s;
}

.form-vertical input:focus,
.form-vertical textarea:focus,
.form-vertical select:focus {
    outline: none;
    border-color: var(--coral);
}

.form-vertical input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: -0.5rem;
    font-family: 'Space Mono', monospace;
}

.form-vertical textarea {
    resize: vertical;
    min-height: 100px;
}

/* Roles List */
.roles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.role-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: 0.2s;
}

.role-item:hover {
    border-color: var(--border-light);
}

.role-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.role-description {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: 0.2s, background 0.3s;
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-white);
}

.modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: 0.2s;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--text-white);
    background: var(--bg-elevated);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Checkboxes */
.permissions-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: 0.2s;
}

.checkbox-item:hover {
    border-color: var(--border-light);
}

.checkbox-item input { display: none; }

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-dim);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: 0.2s;
    margin-top: 2px;
}

.checkbox-item input:checked + .checkbox-custom {
    background: var(--coral);
    border-color: var(--coral);
}

.checkbox-item input:checked + .checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

.checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.permission-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-white);
}

.permission-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Permission Matrix */
.permission-matrix .text-center {
    text-align: center;
}

.permission-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.check-mark svg {
    width: 22px;
    height: 22px;
    color: var(--mint);
}

.x-mark svg {
    width: 18px;
    height: 18px;
    color: var(--text-dim);
    opacity: 0.4;
}

/* Info Box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--gold-dim);
    border: 1px solid rgba(255, 217, 61, 0.2);
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
}

.info-box svg {
    width: 22px;
    height: 22px;
    color: var(--gold);
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box p {
    font-size: 0.95rem;
    color: var(--text-light);
}

.info-box a {
    color: var(--gold);
    font-weight: 600;
}

/* Profile Header */
.profile-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.profile-header-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: conic-gradient(from 45deg, var(--coral-dim), var(--mint-dim), var(--gold-dim), var(--coral-dim));
    filter: blur(80px);
    opacity: 0.5;
    transform: translate(30%, -50%);
}

.profile-avatar.large {
    position: relative;
    z-index: 1;
}

.profile-info {
    position: relative;
    z-index: 1;
}

.profile-info h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
    color: var(--text-white);
}

.profile-info p {
    color: var(--text-dim);
    margin-bottom: 1rem;
    font-family: 'Space Mono', monospace;
}

/* ===================================
   Additional Components
   =================================== */

/* Form Options (Remember Me + Forgot) */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -0.5rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-mid);
}

.checkbox-inline input {
    width: 18px;
    height: 18px;
    accent-color: var(--coral);
}

.forgot-link {
    font-size: 0.9rem;
    color: var(--coral);
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Filter Form */
.filter-form {
    width: 100%;
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group.search-group {
    flex: 2;
    min-width: 250px;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.filter-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--coral);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-mid);
    font-weight: 500;
    transition: 0.2s;
}

.page-link:hover {
    border-color: var(--coral);
    color: var(--coral);
}

.page-link.active {
    background: var(--coral);
    border-color: var(--coral);
    color: #fff;
}

/* Action Badge */
.action-badge {
    display: inline-flex;
    padding: 0.35rem 0.75rem;
    background: var(--bg-elevated);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
}

.action-badge.action-user-login { background: var(--mint-dim); color: var(--mint); }
.action-badge.action-user-logout { background: var(--gold-dim); color: var(--gold); }
.action-badge.action-password-reset { background: var(--coral-dim); color: var(--coral); }

/* Date Time */
.date-time {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.date-time small {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Session Card */
.sessions-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: 0.2s;
}

.session-card:hover {
    border-color: var(--border-light);
}

.session-card.current {
    border-color: var(--mint);
    background: var(--mint-dim);
}

.session-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.session-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-mid);
}

.session-info {
    flex: 1;
}

.session-device {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.current-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    background: var(--mint);
    color: #1a1a28;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.session-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.session-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.session-meta svg {
    width: 14px;
    height: 14px;
}

.session-action {
    flex-shrink: 0;
}

/* Notifications Dropdown */
.notification-dropdown {
    position: relative;
}

.notification-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    position: relative;
    color: var(--text-mid);
    transition: 0.2s;
}

.notification-btn:hover {
    color: var(--text-white);
}

.notification-btn svg {
    width: 22px;
    height: 22px;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--coral);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: 0.2s;
    z-index: 100;
    margin-top: 0.5rem;
}

.notification-dropdown:hover .notification-menu,
.notification-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.notification-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.notification-header a {
    font-size: 0.8rem;
    color: var(--coral);
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: 0.15s;
}

.notification-item:hover {
    background: var(--bg-elevated);
}

.notification-item.unread {
    background: var(--coral-dim);
}

.notification-item .notification-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-item .notification-icon svg {
    width: 18px;
    height: 18px;
    color: var(--coral);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-white);
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
}

.notification-footer {
    display: block;
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--coral);
    border-top: 1px solid var(--border);
}

/* Nav Badge */
.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    background: var(--coral);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Notifications Page */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: 0.2s;
}

.notification-card:hover {
    border-color: var(--border-light);
}

.notification-card.unread {
    border-left: 3px solid var(--coral);
}

.notification-card .notification-icon {
    width: 44px;
    height: 44px;
    background: var(--coral-dim);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-card .notification-icon svg {
    width: 22px;
    height: 22px;
    color: var(--coral);
}

.notification-body {
    flex: 1;
}

.notification-body h4 {
    font-size: 7px;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-white);
}

.notification-body p {
    color: var(--text-mid);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.notification-body .notification-time {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: 'Space Mono', monospace;
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-dim);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-mid);
    margin-bottom: 0.5rem;
}

/* Avatar Upload */
.avatar-upload-form {
    text-align: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--text-dim);
}

.avatar-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.btn-upload {
    cursor: pointer;
}

/* User Avatar with Image */
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

/* Code */
code {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-mid);
}

/* User Mini */
.user-mini {
    font-weight: 500;
}

/* PWA & Real-time Notification Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--coral-dim); }
    50% { box-shadow: 0 0 20px 5px var(--coral-dim); }
}

/* Notification bell shake animation */
.notif-trigger.has-new {
    animation: shake 0.5s ease-in-out;
}

/* Notification item new animation */
.notif-item.new {
    animation: slideIn 0.3s ease-out;
}

/* PWA Standalone Mode Adjustments */
@media (display-mode: standalone) {
    .top-header {
        padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
    }
    
    .sidebar {
        padding-top: env(safe-area-inset-top, 0px);
    }
    
    .auth-page {
        padding-top: calc(2rem + env(safe-area-inset-top, 0px));
    }
}

/* Safe area padding for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    .pwa-install-banner {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
    
    .pwa-toast {
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 280px;
        max-width: 85vw;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
        box-shadow: none;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 160px);
        padding-bottom: 0.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar-footer {
        padding: 0.75rem 1rem;
    }
    
    .sidebar-footer .nav-item {
        padding: 0.875rem 1rem;
    }
    
    /* Sidebar overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    .auth-card {
        padding: 2rem 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .content-wrapper {
        padding: 1.25rem;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-header {
        padding: 1rem 1.25rem;
    }
    
    .user-details { display: none; }
    
    .profile-header-card {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1.5rem;
    }
    
    .welcome-banner {
        padding: 2rem 1.5rem;
    }
    
    .auth-theme-toggle {
        top: 1rem;
        right: 1rem;
    }
}
