/* Import Fonts - Moved to base.html for better performance */
/* @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Sora:wght@300;400;500;600;700&display=swap'); */

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --accent-color: #8b5cf6;
    --border-color: rgba(148, 163, 184, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 25%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- Navbar --- */
.navbar {
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Outfit', sans-serif;
    color: #fff !important;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: #fff !important;
}

/* Navbar Separators (Desktop Only) */
@media (min-width: 992px) {
    .navbar-nav .nav-item {
        position: relative;
    }

    .navbar-nav .nav-item:not(:last-child)::after {
        content: '';
        position: absolute;
        right: -0.5rem;
        top: 50%;
        transform: translateY(-50%);
        height: 20px;
        width: 1px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 2px;
        pointer-events: none;
    }
}

/* Mobile Navbar Adjustments */
@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 1rem; /* Space between logo/toggler and menu */
    }
    .navbar-nav {
        padding-left: 0;
    }
    .navbar-nav .nav-link {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }
}

.card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: var(--glass-border);
    color: #fff;
    font-weight: 600;
}

.card-body {
    color: var(--text-muted);
}

.card-title {
    color: #fff;
}

/* --- Buttons --- */
.btn {
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

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

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
    color: #fff;
    border-color: #34d399;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

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

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

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

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

/* --- Forms --- */
.form-control {
    background: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    color: #fff;
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
    color: #fff;
}

.form-control::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.form-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-text {
    color: rgba(148, 163, 184, 0.6);
}

/* --- File Input Styling --- */
.form-control[type="file"] {
    padding: 0.75rem 1.25rem;
    height: auto;
    color: #fff;
}

/* Hide the file preview thumbnail on mobile */
.form-control[type="file"]::-webkit-file-upload-button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-right: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    -webkit-appearance: none;
}

.form-control[type="file"]::-webkit-file-upload-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.form-control::file-selector-button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-right: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-control::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Alerts --- */
.alert {
    border-radius: 16px;
    border: none;
    backdrop-filter: blur(10px);
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #4ade80;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.25);
    box-shadow: 0 4px 20px -5px rgba(234, 179, 8, 0.15);
}

/* Custom Badge for Alerts */
.badge-warning-glass {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.4);
    padding: 0.25em 0.6em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    vertical-align: middle;
}

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

.bg-white {
    background-color: transparent !important;
}

.shadow-sm {
    box-shadow: none !important;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- Dashboard & Utilities --- */
.icon-box-sm {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.bg-success-subtle { background: rgba(16, 185, 129, 0.1); }
.text-success { color: #34d399 !important; }

.bg-danger-subtle { background: rgba(239, 68, 68, 0.1); }
.text-danger { color: #f87171 !important; }

.bg-primary-subtle { background: rgba(99, 102, 241, 0.1); }
.text-primary { color: #818cf8 !important; }

.hover-card {
    transition: all 0.3s ease;
    cursor: pointer;
}
.hover-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent-color);
}

@media (hover: hover) {
    .hover-card:hover {
        transform: translateY(-5px);
    }
}

.text-decoration-none {
    text-decoration: none !important;
}

/* --- High Contrast Overrides (Fix for Dark Reader/Dark Mode) --- */

/* Force bright text colors */
.text-success { color: #4ade80 !important; }
.text-danger { color: #f87171 !important; }
.text-primary { color: #a78bfa !important; }
.text-white { color: #ffffff !important; }
.text-muted { color: #94a3b8 !important; }

/* Custom Backgrounds for Icon Boxes with Borders */
.bg-success-subtle {
    background-color: rgba(74, 222, 128, 0.1) !important;
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: #4ade80 !important;
}
.bg-danger-subtle {
    background-color: rgba(248, 113, 113, 0.1) !important;
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #f87171 !important;
}
.bg-primary-subtle {
    background-color: rgba(167, 139, 250, 0.1) !important;
    border: 1px solid rgba(167, 139, 250, 0.2);
    color: #a78bfa !important;
}

/* Quick Action Icons - Force Visibility */
.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #c4b5fd !important; /* Very light purple */
    background: rgba(139, 92, 246, 0.15) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

/* Custom Badges */
.badge-active {
    display: inline-flex;
    align-items: center;
    background-color: rgba(74, 222, 128, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.3) !important;
    padding: 0.5em 1em;
    border-radius: 50rem;
    font-weight: 500;
}

.badge-missing {
    display: inline-flex;
    align-items: center;
    background-color: rgba(248, 113, 113, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
    padding: 0.5em 1em;
    border-radius: 50rem;
    font-weight: 500;
}

/* --- Loading Overlay --- */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: #3b82f6;
    animation: spin 1.5s linear infinite reverse;
}

.spinner-ring:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-top-color: #2dd4bf;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Sora', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 80%;
}

/* Force white text on hover for specific admin buttons */
.text-white-hover:hover {
    color: #fff !important;
}
.text-white-hover:hover .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* --- Drag & Drop Zone --- */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.6);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(15, 23, 42, 0.8);
}

@media (hover: hover) {
    .drop-zone:hover, .drop-zone.dragover {
        transform: scale(1.01);
    }
}

.drop-zone-icon {
    font-size: 4rem;
    color: #3b82f6;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.drop-zone:hover .drop-zone-icon, .drop-zone.dragover .drop-zone-icon {
    color: var(--accent-color);
}

.drop-zone-title {
    font-family: 'Sora', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.drop-zone-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.drop-zone-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.badge-spec {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.file-info {
    display: none;
    margin-top: 0;
    padding: 1rem 2rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    color: #4ade80;
    font-weight: 600;
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 400px;
    height: 70px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1030;
    padding: 5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex: 1;
    height: 100%;
    border-radius: 35px;
    /* Prevent text scaling glitches */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
    /* Remove transform transition to prevent icon jitter */
}

.mobile-bottom-nav .nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.mobile-bottom-nav .nav-item.active i {
    color: #fff;
}

.mobile-bottom-nav .nav-item:active {
    /* Remove scale transform to prevent text glitching */
    background: rgba(255, 255, 255, 0.05);
}
