:root {
    --bg-deep: #0f172a;
    --bg-surface: #0b1120;
    --bg-card: rgba(17, 25, 42, 0.78);
    --bg-card-subtle: rgba(15, 23, 42, 0.65);
    --accent-cyan: #22d3ee;
    --accent-cyan-hover: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.09);
    --border-cyan: rgba(34, 211, 238, 0.35);
    --glass-shadow: 0 12px 38px 0 rgba(0, 0, 0, 0.42);
}

html, body {
    background-color: var(--bg-deep) !important;
    background-image:
        radial-gradient(circle at 12% 10%, rgba(34, 211, 238, 0.08) 0%, transparent 38%),
        radial-gradient(circle at 88% 85%, rgba(59, 130, 246, 0.08) 0%, transparent 42%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
}

.Montserrat {
    font-family: 'Montserrat', 'Inter', sans-serif;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0b1120;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 211, 238, 0.45);
}

/* Glass Cards & Containers */
.glass-card {
    background: var(--bg-card) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    color: var(--text-primary);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.glass-subcard {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
}

.stat-card {
    padding: 20px;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-cyan) !important;
    box-shadow: 0 12px 32px rgba(34, 211, 238, 0.14);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 8px 0;
}

/* Brand & Accents */
.text-cyan {
    color: var(--accent-cyan) !important;
}

.bg-cyan {
    background-color: var(--accent-cyan) !important;
}

.border-cyan {
    border-color: var(--accent-cyan) !important;
}

.neon-text {
    color: var(--accent-cyan);
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.45);
}

.neon-border {
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.25);
}

.btn-cyan {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: #0b1120 !important;
    border: none;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-cyan:hover:not(:disabled) {
    background: linear-gradient(135deg, #38bdf8, #22d3ee);
    color: #0b1120 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(34, 211, 238, 0.35);
}

.btn-cyan:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Utility Icon Sizes */
.size-10 { width: 10px; height: 10px; flex-shrink: 0; }
.size-12 { width: 12px; height: 12px; flex-shrink: 0; }
.size-14 { width: 14px; height: 14px; flex-shrink: 0; }
.size-16 { width: 16px; height: 16px; flex-shrink: 0; }
.size-18 { width: 18px; height: 18px; flex-shrink: 0; }
.size-20 { width: 20px; height: 20px; flex-shrink: 0; }
.size-24 { width: 24px; height: 24px; flex-shrink: 0; }

/* Sidebar Navigation */
.sidebar-glass {
    background: rgba(11, 17, 32, 0.88) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
}

.sidebar {
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.nav-link {
    color: var(--text-secondary) !important;
    border-radius: 10px !important;
    padding: 9px 12px !important;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(34, 211, 238, 0.12) !important;
    color: #f8fafc !important;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(34, 211, 238, 0.85)) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.22);
}

.fs-xs {
    font-size: 0.82rem !important;
}

/* Global Dark Form Controls & Autofill Fix */
.form-control,
.form-select,
.input-group-text {
    background-color: rgba(15, 23, 42, 0.88) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #f8fafc !important;
    border-radius: 10px;
}

.form-control::placeholder {
    color: #64748b !important;
}

.form-control:focus,
.form-select:focus {
    background-color: #0b1120 !important;
    border-color: var(--accent-cyan) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18) !important;
}

.form-control:disabled,
.form-select:disabled {
    background-color: rgba(15, 23, 42, 0.45) !important;
    color: #64748b !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.form-select option {
    background-color: #0f172a;
    color: #f8fafc;
}

.input-group > .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Prevent jarring browser yellow autofill on dark inputs */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
    -webkit-text-fill-color: #f8fafc !important;
    caret-color: #22d3ee !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Global Dark Theme for TomSelect */
.ts-wrapper.single .ts-control,
.ts-wrapper .ts-control {
    background-color: rgba(15, 23, 42, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 10px !important;
    color: #f8fafc !important;
    min-height: 38px;
    box-shadow: none !important;
    padding: 0.4rem 0.75rem !important;
}

.ts-wrapper.single.focus .ts-control,
.ts-wrapper.focus .ts-control {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18) !important;
    background-color: #0b1120 !important;
}

.ts-wrapper.disabled .ts-control {
    background-color: rgba(15, 23, 42, 0.45) !important;
    opacity: 0.65 !important;
}

.ts-wrapper .ts-control > input,
.ts-wrapper .ts-control .item {
    color: #f8fafc !important;
}

.ts-wrapper .ts-control > input::placeholder {
    color: #64748b !important;
}

.ts-dropdown,
.ts-wrapper .ts-dropdown {
    background-color: #0f172a !important;
    border: 1px solid rgba(34, 211, 238, 0.3) !important;
    border-radius: 10px !important;
    color: #f8fafc !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    margin-top: 4px;
}

.ts-dropdown .option {
    color: #e2e8f0 !important;
    padding: 8px 12px;
}

.ts-dropdown .option:hover,
.ts-dropdown .active {
    background-color: rgba(34, 211, 238, 0.16) !important;
    color: #22d3ee !important;
}

/* Global Dark Theme for DataTables */
div.dataTables_wrapper {
    color: #cbd5e1 !important;
}

div.dataTables_wrapper .dataTables_length label,
div.dataTables_wrapper .dataTables_filter label,
div.dataTables_wrapper .dataTables_info {
    color: #94a3b8 !important;
    font-size: 0.84rem;
}

div.dataTables_wrapper .dataTables_length select,
div.dataTables_wrapper .dataTables_filter input {
    background-color: rgba(15, 23, 42, 0.9) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 8px !important;
    padding: 0.3rem 0.65rem !important;
}

div.dataTables_wrapper .dataTables_filter input:focus,
div.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.18) !important;
    outline: none;
}

div.dataTables_wrapper .dataTables_paginate .pagination .page-link {
    background-color: rgba(15, 23, 42, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #cbd5e1 !important;
    border-radius: 8px;
    margin: 0 2px;
}

div.dataTables_wrapper .dataTables_paginate .pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #22d3ee, #06b6d4) !important;
    border-color: transparent !important;
    color: #0b1120 !important;
    font-weight: 700;
}

div.dataTables_wrapper .dataTables_paginate .pagination .page-item.disabled .page-link {
    background-color: rgba(15, 23, 42, 0.4) !important;
    color: #475569 !important;
}

table.dataTable {
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

table.dataTable > thead > tr > th {
    background: rgba(11, 17, 32, 0.85) !important;
    color: #94a3b8 !important;
    border-bottom: 1px solid rgba(34, 211, 238, 0.22) !important;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

table.dataTable > tbody > tr > td {
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    color: #e2e8f0 !important;
    vertical-align: middle;
}

table.dataTable.table-hover > tbody > tr:hover > * {
    background-color: rgba(34, 211, 238, 0.06) !important;
    color: #ffffff !important;
}

/* Drag & Drop Upload Zone (modeled on CargaRegCSV) */
.drop-zone {
    border: 2px dashed rgba(34, 211, 238, 0.35);
    background: rgba(11, 17, 32, 0.55);
    border-radius: 14px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
}

.drop-zone:hover {
    border-color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.05);
}

.drop-zone.drag-active {
    border-color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.12);
    transform: scale(1.01);
    box-shadow: 0 0 26px rgba(34, 211, 238, 0.25);
}

.file-queue-item {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    transition: border-color 0.2s ease;
}

.file-queue-item:hover {
    border-color: rgba(34, 211, 238, 0.5);
}

.mode-pill {
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
}

.mode-pill:hover {
    border-color: rgba(34, 211, 238, 0.4);
    color: #fff;
}

.mode-pill.active {
    border-color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
    font-weight: 600;
}

.mode-pill.active-warn {
    border-color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-weight: 600;
}

/* SweetAlert2 Dark Integration */
.swal2-popup {
    background: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid rgba(34, 211, 238, 0.25) !important;
    border-radius: 16px !important;
}

/* PJAX Navigation Bar & Smooth Transition */
#pjax-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #22d3ee);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.75);
    z-index: 9999;
    opacity: 0;
    transition: width 0.25s ease, opacity 0.2s ease;
    pointer-events: none;
}

#main-content-area {
    transition: opacity 0.16s ease;
}

#main-content-area.pjax-loading {
    opacity: 0.45;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.45s ease-out forwards;
}
