/* ============================================
   DOCMANAGER PREMIUM DASHBOARD CSS
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary: #030712;
    --bg-secondary: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-card-hover: rgba(15, 23, 42, 0.95);
    --border-color: rgba(56, 189, 248, 0.15);
    --border-glow: rgba(56, 189, 248, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-cyan: #22d3ee;
    --accent-cyan-glow: rgba(34, 211, 238, 0.4);
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: #ffffff;
    --border-color: rgba(148, 163, 184, 0.2);
    --border-glow: rgba(34, 211, 238, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-cyan: #0891b2;
    --accent-cyan-glow: rgba(34, 211, 238, 0.2);
    --accent-blue: #2563eb;
    --accent-purple: #7c3aed;
    --accent-green: #059669;
    --accent-red: #dc2626;
    --accent-orange: #ea580c;
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #f0fdf4 100%);
}

[data-theme="light"] .bg-animation {
    display: none;
}

[data-theme="light"] .glass-overlay {
    display: none;
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-link:hover {
    background: rgba(34, 211, 238, 0.1);
}

[data-theme="light"] .sidebar-link.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(124, 58, 237, 0.1));
    color: #0891b2;
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    color: #1e293b;
}

[data-theme="light"] .navbar-brand {
    color: #1e293b;
}

[data-theme="light"] .navbar-links a {
    color: #475569;
}

[data-theme="light"] .navbar-links a:hover,
[data-theme="light"] .navbar-links a.active {
    color: #0891b2;
    background: rgba(34, 211, 238, 0.1);
}

[data-theme="light"] .card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .card:hover {
    border-color: rgba(34, 211, 238, 0.3);
}

[data-theme="light"] .form-control {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #1e293b;
}

[data-theme="light"] .form-control:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

[data-theme="light"] .form-control::placeholder {
    color: #94a3b8;
}

[data-theme="light"] h1, 
[data-theme="light"] h2, 
[data-theme="light"] h3, 
[data-theme="light"] h4, 
[data-theme="light"] h5, 
[data-theme="light"] h6 {
    color: #1e293b;
}

[data-theme="light"] .text-muted {
    color: #64748b !important;
}

[data-theme="light"] .table {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    color: #1e293b;
}

[data-theme="light"] .table th {
    color: #475569;
    font-weight: 600;
}

[data-theme="light"] .table td {
    color: #1e293b;
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .btn-secondary {
    background: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.3);
    color: #475569;
}

[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-item {
    color: #475569;
}

[data-theme="light"] .dropdown-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

[data-theme="light"] .page-content {
    color: #1e293b;
}

[data-theme="light"] .stat-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .stat-value {
    color: #1e293b;
}

[data-theme="light"] .stat-label {
    color: #64748b;
}

/* ===== THEME SWITCH BUTTON ===== */
.theme-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    width: 52px;
    height: 28px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 4px;
    transition: all 0.3s ease;
}

.theme-switch:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(34, 211, 238, 0.3);
}

.theme-switch__sun,
.theme-switch__moon {
    font-size: 14px;
    transition: all 0.3s ease;
}

.theme-switch__sun {
    opacity: 1;
    transform: scale(1);
}

.theme-switch__moon {
    opacity: 0;
    transform: scale(0.5);
    position: absolute;
    right: 6px;
}

.theme-switch__knob {
    position: absolute;
    left: 4px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #22d3ee, #8b5cf6);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(34, 211, 238, 0.4);
}

[data-theme="light"] .theme-switch {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .theme-switch:hover {
    border-color: #0891b2;
}

[data-theme="light"] .theme-switch__sun {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="light"] .theme-switch__moon {
    opacity: 1;
    transform: scale(1);
}

[data-theme="light"] .theme-switch__knob {
    left: calc(100% - 24px);
    background: linear-gradient(135deg, #f97316, #eab308);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #f1f5f9;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.4);
    color: #22d3ee;
}

[data-theme="light"] .sidebar-toggle {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sidebar-toggle:hover {
    background: #f1f5f9;
    border-color: #0891b2;
    color: #0891b2;
}

/* Sidebar user section */
.sidebar-user-btn {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0;
}

.sidebar-user-caret {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.sidebar-user-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-user-menu .sidebar-user-item {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.sidebar-user-menu .sidebar-user-item:hover {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent-cyan);
}

.sidebar-user-menu .sidebar-user-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.sidebar-user-sep {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.is-open .sidebar-user-caret {
    transform: rotate(180deg);
}

.is-open .sidebar-user-menu {
    display: block;
}

[data-theme="light"] .sidebar-user-menu {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sidebar-user-menu .sidebar-user-item:hover {
    background: rgba(34, 211, 238, 0.1);
    color: #0891b2;
}

/* Badge styles for light mode */
[data-theme="light"] .badge {
    background: rgba(34, 211, 238, 0.15);
    color: #0891b2;
}

[data-theme="light"] .detail-label {
    color: #64748b;
}

[data-theme="light"] .detail-value {
    color: #1e293b;
}

[data-theme="light"] .empty-state h3 {
    color: #1e293b;
}

[data-theme="light"] .empty-state p {
    color: #64748b;
}

[data-theme="light"] .auth-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .auth-title {
    color: #1e293b;
}

[data-theme="light"] .auth-subtitle,
[data-theme="light"] .auth-footer {
    color: #64748b;
}

[data-theme="light"] .search-box {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #1e293b;
}

[data-theme="light"] .search-box:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: #67e8f9;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    background: linear-gradient(135deg, #030712 0%, #0c1929 50%, #051e14 100%);
}

.bg-grid {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(60px);
    }
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: orbFloat 15s ease-in-out infinite;
}

.glow-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.glow-orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: 60%;
    right: 15%;
    animation-delay: -5s;
}

.glow-orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: 20%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

/* Glass overlay */
.glass-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.75);
    z-index: -1;
    backdrop-filter: blur(3px);
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

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

.sidebar-section {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 0.25rem;
}

.sidebar-link:hover {
    background: rgba(34, 211, 238, 0.08);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--accent-cyan);
    border: 1px solid var(--border-glow);
}

.sidebar-link-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* User section in sidebar */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    animation: fadeSlideDown 0.4s ease;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(12px);
    transition: all var(--transition-normal);
    animation: fadeSlideUp 0.4s ease;
}

.card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 30px rgba(34, 211, 238, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #030712;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(34, 211, 238, 0.45);
    color: #030712;
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

th,
td {
    padding: 1rem 1.25rem;
    text-align: left;
}

th {
    background: rgba(34, 211, 238, 0.05);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

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

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: all var(--transition-fast);
}

tbody tr:hover {
    background: rgba(34, 211, 238, 0.05);
}

tbody tr:hover td {
    color: var(--text-primary);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.form-error {
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

/* ===== SEARCH ===== */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    padding-left: 2.75rem;
}

.search-box-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-normal);
    animation: fadeSlideUp 0.4s ease;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.cyan {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(34, 211, 238, 0.05));
}

.stat-icon.purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
}

.stat-icon.green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
}

.stat-icon.orange {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.05));
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cyan {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-orange {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ===== DETAIL LIST ===== */
.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.detail-item {}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* ===== TOAST / FLASH ===== */
.flash {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.4s ease, fadeOut 0.4s ease 4.6s forwards;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

.flash-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ===== AUTH PAGES ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(20px);
    animation: fadeSlideUp 0.5s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-forgot-password {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.auth-forgot-password a {
    color: var(--accent-cyan);
    font-weight: 500;
}

.auth-forgot-password a:hover {
    text-decoration: underline;
}

/* ===== FLASH MESSAGES ===== */
.flash {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    animation: fadeSlideDown 0.3s ease;
}

.flash-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.flash-cyan {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: var(--accent-cyan);
}

.flash-icon {
    font-size: 1.1rem;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--accent-red);
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--accent-red);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Stagger animations for lists */
.card:nth-child(1) {
    animation-delay: 0s;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.2s;
}

tr:nth-child(1) {
    animation-delay: 0s;
}

tr:nth-child(2) {
    animation-delay: 0.05s;
}

tr:nth-child(3) {
    animation-delay: 0.1s;
}

tr:nth-child(4) {
    animation-delay: 0.15s;
}

tr:nth-child(5) {
    animation-delay: 0.2s;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 101;
        width: 44px;
        height: 44px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        color: var(--text-primary);
        cursor: pointer;
    }

    .page-content {
        padding: 1.5rem;
        padding-top: 5rem;
    }
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    th,
    td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

/* ===== UTILITIES ===== */
.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-primary {
    color: var(--text-primary);
}

.text-cyan {
    color: var(--accent-cyan);
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}  
  
 /* ============================================================
   THEME SWITCH (TOP RIGHT) — PREMIUM
   ============================================================ */
.theme-switch{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200000;

  width: 72px;
  height: 36px;
  border-radius: 999px;

  border: 1px solid rgba(60,179,113,.22);
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow: 0 12px 30px rgba(0,0,0,.25), 0 0 22px rgba(60,179,113,.12);
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;

  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.theme-switch:hover{
  transform: translateY(-1px);
  border-color: rgba(60,179,113,.35);
  box-shadow: 0 14px 34px rgba(0,0,0,.28), 0 0 28px rgba(60,179,113,.18);
}

.theme-switch:active{ transform: translateY(0); }

.theme-switch__sun,
.theme-switch__moon{
  font-size: 14px;
  opacity: .95;
  user-select: none;
}

.theme-switch__knob{
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 999px;

  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.75));
  box-shadow: 0 10px 18px rgba(0,0,0,.25);
  transition: left .22s ease, background .22s ease;
}

/* dark visuals */
html[data-theme="dark"] .theme-switch__sun{ opacity:.45; }
html[data-theme="dark"] .theme-switch__moon{ opacity:1; }

/* light visuals */
html[data-theme="light"] .theme-switch{
  background: rgba(255,255,255,.78);
  border-color: rgba(2,6,23,.12);
  box-shadow: 0 14px 34px rgba(2,6,23,.10);
}

html[data-theme="light"] .theme-switch__knob{
  left: calc(100% - 32px);
  background: linear-gradient(135deg, rgba(15,23,42,.92), rgba(15,23,42,.72));
}

html[data-theme="light"] .theme-switch__sun{ opacity:1; }
html[data-theme="light"] .theme-switch__moon{ opacity:.45; }
/* FORCE THEME BUTTON TOP-RIGHT (OVERRIDE ANY CONFLICT) */
.theme-switch{
  position: fixed !important;
  top: 16px !important;
  right: 16px !important;
  left: auto !important;   /* مهم باش مايبقاش كيديه لليسار */
  bottom: auto !important;

  z-index: 999999 !important;

  width: 72px;
  height: 36px;
  border-radius: 999px;

  border: 1px solid rgba(60,179,113,.22);
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow: 0 12px 30px rgba(0,0,0,.25), 0 0 22px rgba(60,179,113,.12);
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.theme-switch__knob{
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.75));
  box-shadow: 0 10px 18px rgba(0,0,0,.25);
  transition: left .22s ease, background .22s ease;
}
/* page background in light */
html[data-theme="light"] body{
  background: var(--bg-deep);
  color: var(--text-primary);
}

/* cards */
html[data-theme="light"] .card,
html[data-theme="light"] .table-wrapper,
html[data-theme="light"] .stat-card{
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

/* tables header */
html[data-theme="light"] th{
  background: rgba(60,179,113,0.06);
  color: var(--text-secondary);
}

/* inputs */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15,23,42,0.12);
}

/* sidebar */
html[data-theme="light"] .sidebar{
  background: #ffffff;
  border-right: 1px solid rgba(0,0,0,0.08);
}

/* animated background OFF in light */
html[data-theme="light"] .bg-animation{
  display: none;
}

html[data-theme="light"] .glass-overlay{
  display: none;
}/* ============================================================
   LIGHT MODE — STRONGER TYPO (BLACK TEXT)
   ============================================================ */
html[data-theme="light"]{
  /* نص كحل قوي */
  --text-primary: #0b1220;
  --text-heading: #050b16;

  /* secondary مايبقاش فاتح بزاف */
  --text-secondary: #1f2937; /* قريب للكحل */
  --text-muted: #334155;     /* واضح */
}

/* Force text color everywhere important */
html[data-theme="light"] body,
html[data-theme="light"] .page-content,
html[data-theme="light"] .main-content{
  color: var(--text-primary);
}

/* Sidebar links */
html[data-theme="light"] .sidebar-link{
  color: #0b1220 !important;
}
html[data-theme="light"] .sidebar-section-title{
  color: #1f2937 !important;
  opacity: .9;
}

/* Cards + paragraphs */
html[data-theme="light"] .card,
html[data-theme="light"] .card p,
html[data-theme="light"] .detail-value,
html[data-theme="light"] .empty-state p{
  color: #0b1220 !important;
}

/* Tables */
html[data-theme="light"] td{
  color: #0b1220 !important;
}
html[data-theme="light"] th{
  color: #111827 !important;
}

/* Forms labels */
html[data-theme="light"] label,
html[data-theme="light"] .form-label,
html[data-theme="light"] .form-group label{
  color: #111827 !important;
}

/* Buttons secondary text */
html[data-theme="light"] .btn-secondary{
  color: #0b1220 !important;
}
/* Sidebar user dropdown */
.sidebar-user{
  position: relative;
}

.sidebar-user-btn{
  width: 100%;
  display:flex;
  align-items:center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.sidebar-user-caret{
  margin-left: auto;
  opacity: .75;
  transition: transform .2s ease;
}

.sidebar-user.is-open .sidebar-user-caret{
  transform: rotate(180deg);
}

.sidebar-user-menu{
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  background: rgba(10, 18, 30, .92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  display: none;
  backdrop-filter: blur(10px);
  z-index: 50;
}

.sidebar-user.is-open .sidebar-user-menu{
  display: block;
}

.sidebar-user-item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  opacity: .9;
}

.sidebar-user-item:hover{
  background: rgba(255,255,255,.06);
  opacity: 1;
}

.sidebar-user-sep{
  height: 1px;
  background: rgba(255,255,255,.10);
  margin: 6px 6px;
}

.sidebar-user-item-danger:hover{
  background: rgba(255,80,80,.10);
}/* FIX: sidebar-user dropdown wrapper must not be flex */
.sidebar-user{
  display: block !important;
  position: relative;
}

/* button هو اللي يكون flex */
.sidebar-user-btn{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.sidebar-user{
  display: block !important;
  position: relative;
}

.sidebar-user-btn{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.sidebar-user-menu{
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  display: none;
  z-index: 999;
}

.sidebar-user.is-open .sidebar-user-menu{
  display: block;
}