/* ==========================================================================
   MSW MODS — ULTRA-RESPONSIVE DARK THEME (HIGH CONTRAST & MOBILE-FIRST)
   ========================================================================== */

:root {
    --bg-body: #07090e;
    --bg-surface: #0e1422;
    --bg-surface-2: #161e31;
    --bg-surface-hover: #1e2942;
    --border-color: #243048;
    --border-color-light: #334263;
    
    --primary-accent: #38bdf8;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
}

/* Base resets & typography */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Force dark on all Bootstrap standard elements so white never appears */
.bg-white, .bg-light {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}

.text-dark {
    color: #f1f5f9 !important;
}

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

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff !important;
    font-weight: 700;
}

/* Cards */
.card-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-header-custom {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Top Navbar */
.navbar-custom {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Desktop Sidebar */
.desktop-sidebar {
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 65px);
    padding: 1.25rem 0.75rem;
}

/* Sidebar Links */
.nav-link-custom {
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-bottom: 0.35rem;
}

.nav-link-custom:hover {
    color: #ffffff;
    background-color: var(--bg-surface-2);
}

.nav-link-custom.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.nav-link-custom i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* Mobile Offcanvas Drawer */
.offcanvas {
    background-color: var(--bg-surface) !important;
    border-right: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    max-width: 290px;
}

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

/* Form inputs & Selects (NEVER WHITE!) */
.form-control, .form-select {
    background-color: var(--bg-surface-2) !important;
    border: 1px solid var(--border-color-light) !important;
    color: #ffffff !important;
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-surface-2) !important;
    border-color: var(--primary-accent) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

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

.input-group-text {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color-light) !important;
    color: var(--text-secondary) !important;
    border-radius: 10px;
}

/* Modals (Strictly Dark & High Contrast, Mobile Safe) */
.modal {
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.75) !important;
}

.modal-backdrop.show {
    opacity: 0.75 !important;
}

.modal-content {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color-light) !important;
    border-radius: 16px !important;
    color: var(--text-primary) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7) !important;
}

/* Ensure mobile modal inputs don't trigger iOS Safari auto-zoom */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.75rem !important;
    }
    .modal-content input.form-control,
    .modal-content select.form-select {
        font-size: 16px !important;
    }
}

.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 1.1rem 1.4rem !important;
}

.modal-footer {
    border-top: 1px solid var(--border-color) !important;
    padding: 1rem 1.4rem !important;
}

/* Tables (Strictly High Contrast on Mobile & Desktop) */
.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-custom {
    --bs-table-bg: transparent !important;
    color: var(--text-primary) !important;
    margin-bottom: 0;
    width: 100%;
}

.table-custom th {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-top: none !important;
    color: var(--text-secondary) !important;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table-custom td {
    background-color: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.table-custom tr:hover td {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Code badges */
code {
    background-color: rgba(56, 189, 248, 0.12) !important;
    color: #38bdf8 !important;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    font-size: 0.88em;
}

/* Custom Alert Boxes (Fixed Colors, Never White on White) */
.alert {
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

.alert-info {
    background-color: rgba(56, 189, 248, 0.12) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    color: #38bdf8 !important;
}

/* Custom Buttons */
.btn-primary-custom {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary-custom:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4);
    color: #ffffff !important;
}

/* Stat Cards */
.stat-card {
    padding: 1.25rem;
    border-radius: 14px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    height: 100%;
}

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

/* Mobile-Specific Refinements */
@media (max-width: 991.98px) {
    .desktop-sidebar {
        display: none !important;
    }
    
    .main-content {
        padding: 1rem 0.75rem !important;
    }
    
    .card-header-custom {
        padding: 0.85rem 1rem;
    }
    
    .table-custom th, .table-custom td {
        padding: 0.75rem 0.85rem;
        font-size: 0.88rem;
    }
    
    .stat-card {
        padding: 1rem;
        gap: 0.85rem;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 1.15rem;
    }
}
