/* =========================================
   GLOBAL THEME VARIABLES & BASE STYLES
========================================= */
:root {
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --warning-gradient: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --success-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);

    /* Base Colors */
    --text-color: #212529;
    --text-muted: #6c757d;

    /* Cards */
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-hover-bg: rgba(255, 255, 255, 0.98);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-hover-border: rgba(102, 126, 234, 0.3);

    /* Navbar */
    --navbar-bg: #ffc107;
    --navbar-text: #212529;

    /* Buttons */
    --btn-text: #212529;
    --btn-bg: #ffffff;

    /* Alerts */
    --alert-bg: #f8f9fa;
    --alert-text: #212529;

    /* Dropdowns */
    --dropdown-bg: #ffffff;
    --dropdown-text: #212529;
    --dropdown-border: #dee2e6;

    /* Borders & Shadows */
    --border-color: #dee2e6;
    --shadow-soft: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);

    /* Layout */
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Table */
    --table-header-bg: var(--card-hover-bg);
    --table-border: var(--border-color);
    --table-stripe: rgba(255, 255, 255, 0.02);
    --table-hover: rgba(255, 255, 255, 0.05);
}

/* =========================================
   LIGHT THEME
========================================= */
[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --text-color: #212529;
    --text-muted: #6c757d;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-hover-bg: rgba(255, 255, 255, 0.98);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-hover-border: rgba(102, 126, 234, 0.3);
    --navbar-bg: #ffc107;
    --navbar-text: #212529;
    --btn-text: #212529;
    --btn-bg: #ffffff;
    --alert-bg: #f8f9fa;
    --alert-text: #212529;
    --dropdown-bg: #ffffff;
    --dropdown-text: #212529;
    --dropdown-border: #dee2e6;
    --border-color: #dee2e6;
}

/* =========================================
   DARK THEME
========================================= */
[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    --text-color: #f8f9fa; /* Brighter text for better contrast */
    --text-muted: #adb5bd;
    --card-bg: rgba(33, 37, 41, 0.95);
    --card-hover-bg: rgba(52, 58, 64, 0.95);
    --card-border: rgba(255, 255, 255, 0.125);
    --card-hover-border: rgba(255, 193, 7, 0.5);
    --navbar-bg: rgba(33, 37, 41, 0.95);
    --navbar-text: #f8f9fa;
    --btn-text: #f8f9fa;
    --btn-bg: #495057;
    --alert-bg: #495057;
    --alert-text: #f8f9fa;
    --border-color: #6c757d; /* Lighter border for better visibility */
    --dropdown-bg: #343a40;
    --dropdown-text: #f8f9fa;
    --dropdown-border: #495057;
    --table-stripe: rgba(255, 255, 255, 0.03);
    
    /* Force text color in cards */
    --card-text-color: #f8f9fa;
    
    /* Override Bootstrap's text utilities in dark mode */
    .text-dark, .text-body {
        color: var(--text-color) !important;
    }
    
    .text-muted {
        color: var(--text-muted) !important;
    }
}

/* =========================================
   GLOBAL BASE STYLES
========================================= */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    transition: var(--transition);
    min-height: 100vh;
}

/* Background Orbs */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(120,119,198,0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,119,198,0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120,219,255,0.1) 0%, transparent 50%);
    transition: var(--transition);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--card-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Page Animations */
.page-transition {
    animation: pageSlideIn 0.5s ease-out;
}

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

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
    outline: none;
}

/* Utility Classes */
.container {
    position: relative;
    z-index: 1;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}