﻿/* ============================================================
   THEME VARIABLES
   ============================================================ */

:root {
    --background: #F8F9FB;
    --surface: #FFFFFF;
    --text: #111;
    --text-muted: #666;
    --primary: #4A6CF7;
    --primary-hover: #3A56C9;
    --border: rgba(0,0,0,0.08);
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
    --success: #22c55e;
    --success-hover: #16a34a;
}

[data-theme="dark"] {
    --background: #121212;
    --surface: #1E1E1E;
    --text: #EEE;
    --text-muted: #AAA;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 4px 20px rgba(0,0,0,0.2);
    --success: #22c55e;
    --success-hover: #16a34a;
}

/* ============================================================
   GLOBAL BACKGROUND (PREMIUM GRADIENT)
   Applies to the entire application
   ============================================================ */

html, body {
    min-height: 100vh;
    background: linear-gradient( 135deg, var(--background) 0%, color-mix(in srgb, var(--primary) 12%, var(--background)) 40%, var(--background) 100% );
    background-attachment: fixed;
    background-size: cover;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    transition: background 0.35s ease, color 0.25s ease;
}

/* DARK MODE VERSION */
[data-theme="dark"] body {
    background: linear-gradient( 135deg, var(--background) 0%, color-mix(in srgb, var(--primary) 18%, var(--background)) 45%, var(--background) 100% );
    background-attachment: fixed;
    background-size: cover;
}

/* Smooth transitions for all major UI elements */
html, body, .content, .theme-navbar, footer, .card, .sidebar {
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* ============================================================
   NAVBAR
   ============================================================ */

.theme-navbar {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-bottom: none !important;
    box-shadow: var(--shadow);
}

    .theme-navbar .nav-link,
    .theme-navbar .navbar-brand {
        color: var(--text) !important;
    }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    background: var(--surface);
    color: var(--text);
    border-right: none !important;
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.sidebar-spacer {
    flex-grow: 1;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */

.content {
    margin-left: 240px;
    padding: 20px;
    background: transparent; /* IMPORTANT: allow gradient to show */
    min-height: calc(100vh - 70px);
    overflow: visible;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--surface);
    color: var(--text);
    border: none !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
    background: var(--primary);
    border: none;
}

    .btn-primary:hover {
        background: var(--primary-hover);
    }

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text);
}

    .btn-outline-secondary:hover {
        background: var(--surface);
        border-color: var(--primary);
        color: var(--primary);
    }

/* ============================================================
   FORMS
   ============================================================ */

input, select, textarea {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

    input:focus, select:focus, textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 2px rgba(74,108,247,0.15);
    }

/* ============================================================
   MODALS
   ============================================================ */

.modal-content {
    background: var(--surface);
    color: var(--text);
    border: none !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ============================================================
   SELECT2 DARK MODE FIXES
   ============================================================ */

[data-theme="dark"] .select2-container--default .select2-selection--single {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .select2-container--default .select2-selection__rendered {
    color: var(--text) !important;
}

[data-theme="dark"] .select2-container--default .select2-selection__arrow b {
    border-color: var(--text) transparent transparent transparent !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option {
    background-color: var(--surface) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option--highlighted {
    background-color: var(--primary) !important;
    color: #fff !important;
}

[data-theme="dark"] .select2-dropdown {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
}
