/* ============================================
   PADUKA - Design System
   BKK Kelas I Samarinda
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Primary Teal */
    --primary: #0d9488;
    --primary-light: #14b8a6;
    --primary-dark: #0f766e;
    --primary-50: #f0fdfa;
    --primary-100: #ccfbf1;
    --primary-200: #99f6e4;

    /* Secondary */
    --secondary: #0ea5e9;
    --secondary-light: #38bdf8;
    --secondary-dark: #0284c7;

    /* Accent */
    --accent: #f59e0b;
    --accent-light: #fbbf24;

    /* Status */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Neutrals */
    --dark: #0f172a;
    --dark-2: #1e293b;
    --dark-3: #334155;
    --gray-1: #475569;
    --gray-2: #64748b;
    --gray-3: #94a3b8;
    --gray-4: #cbd5e1;
    --gray-5: #e2e8f0;
    --gray-6: #f1f5f9;
    --white: #ffffff;

    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Theme-aware (light defaults) */
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-surface: #f8fafc;
    --bg-surface-2: #f1f5f9;
    --bg-topbar: rgba(255,255,255,0.95);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --table-hover: #f0fdfa;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --dropdown-bg: #ffffff;
    --modal-bg: #ffffff;
    --filter-bg: #ffffff;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-surface: #1e293b;
    --bg-surface-2: #334155;
    --bg-topbar: rgba(30,41,59,0.95);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --table-hover: rgba(13,148,136,0.08);
    --input-bg: #1e293b;
    --input-border: #475569;
    --dropdown-bg: #1e293b;
    --modal-bg: #1e293b;
    --filter-bg: #1e293b;

    --gray-5: #334155;
    --gray-6: #1e293b;
    --dark: #f1f5f9;
    --gray-1: #cbd5e1;
    --gray-2: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: var(--primary); transition: all 0.2s; }
a:hover { color: var(--primary-dark); }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

[data-theme="dark"] .sidebar {
    background: #0f172a;
    border-right-color: #1e293b;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand .brand-text h5 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-brand .brand-text small {
    color: var(--text-muted);
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.sidebar-menu {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-menu .menu-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 12px;
    margin-top: 12px;
}

.sidebar-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
    cursor: pointer;
}

.sidebar-menu .menu-item:hover {
    background: var(--bg-surface-2);
    color: var(--primary);
}

[data-theme="dark"] .sidebar-menu .menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: #f1f5f9;
}

.sidebar-menu .menu-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.sidebar-menu .menu-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 64px;
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: left 0.3s;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left .page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right .user-info {
    text-align: right;
}

.topbar-right .user-info .user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.topbar-right .user-info .user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

#sidebarToggle {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray-1);
    cursor: pointer;
    display: none;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 88px 28px 28px;
    min-height: 100vh;
    transition: margin-left 0.3s;
    display: flex;
    flex-direction: column;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
    border-radius: var(--radius-md);
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-4px); }

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 4px;
}

.bg-gradient-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.bg-gradient-info { background: linear-gradient(135deg, var(--secondary), var(--secondary-dark)); }
.bg-gradient-warning { background: linear-gradient(135deg, var(--accent), #d97706); }
.bg-gradient-success { background: linear-gradient(135deg, var(--success), #16a34a); }
.bg-gradient-danger { background: linear-gradient(135deg, var(--danger), #dc2626); }

/* ============================================
   TABLES
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--table-hover); }

/* ============================================
   BADGES
   ============================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.badge-baru { background: #dbeafe; color: #1d4ed8; }
.badge-diproses { background: #fef3c7; color: #b45309; }
.badge-selesai { background: #d1fae5; color: #047857; }
.badge-active { background: #d1fae5; color: #047857; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-ditolak { background: #fee2e2; color: #dc2626; }

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    width: 100%;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
    outline: none;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: 0 4px 12px rgba(13,148,136,0.3); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-dark); color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; }

.btn-warning { background: var(--accent); color: white; }
.btn-warning:hover { background: #d97706; color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    background: var(--modal-bg);
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-title { font-weight: 700; }
.modal-body { padding: 20px; }

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 14px;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #d1fae5; color: #047857; }
.alert-danger { background: #fee2e2; color: #dc2626; }
.alert-warning { background: #fef3c7; color: #b45309; }
.alert-info { background: #dbeafe; color: #1d4ed8; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #0d9488 50%, #0ea5e9 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.auth-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease;
}

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

.auth-card .auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .auth-header .auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
}

.auth-card .auth-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: 2px;
}

.auth-card .auth-header p {
    color: var(--gray-2);
    font-size: 14px;
    margin-top: 4px;
}

.auth-card .form-group { margin-bottom: 20px; }

.login-tabs {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--primary);
    margin-bottom: 24px;
}

.login-tabs .tab-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--primary);
    border: none;
    font-family: 'Inter', sans-serif;
}

.login-tabs .tab-btn.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   OTP INPUT
   ============================================ */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-inputs input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--gray-4);
    border-radius: var(--radius);
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.otp-inputs input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
    outline: none;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    background: var(--filter-bg);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-bar .filter-group {
    flex: 1;
    min-width: 140px;
}

.filter-bar .filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-2);
    margin-bottom: 4px;
}

.filter-bar .filter-group .form-control,
.filter-bar .filter-group .form-select,
.filter-bar .filter-group .dropdown .btn,
.filter-bar .filter-group > .btn {
    height: 38px !important;
    font-size: 13px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 38px !important;
    box-sizing: border-box;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .topbar { left: 0; }
    .main-content { margin-left: 0; }
    #sidebarToggle { display: block; }

    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    .sidebar-overlay.show { display: block; }
}

@media (max-width: 768px) {
    .main-content { padding: 80px 16px 16px; }
    .stat-card .stat-value { font-size: 24px; }
    .auth-card { padding: 24px; }
    .filter-bar { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        gap: 12px;
    }
    .filter-bar .filter-group {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        margin-bottom: 0 !important;
    }
    .filter-bar .filter-group .form-control,
    .filter-bar .filter-group .form-select,
    .filter-bar .filter-group .dropdown,
    .filter-bar .filter-group .btn {
        width: 100% !important;
    }
    /* Hide empty space above buttons on mobile */
    .filter-bar .filter-group:has(> .btn) label {
        display: none !important;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.fade-in { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.5s ease; }

/* Hover effects */
.hover-lift { transition: transform 0.2s; }
.hover-lift:hover { transform: translateY(-2px); }

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-4);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-2);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; color: var(--gray-3); }
.empty-state h5 { font-weight: 600; color: var(--gray-1); margin-bottom: 8px; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-3); }

/* Toast notification */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-switch {
    cursor: pointer;
    user-select: none;
}

.theme-switch-track {
    width: 56px;
    height: 30px;
    border-radius: 15px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px;
    transition: background 0.4s ease;
}

[data-theme="dark"] .theme-switch-track {
    background: linear-gradient(135deg, #334155, #1e293b);
}

.theme-icon-light,
.theme-icon-dark {
    font-size: 14px;
    z-index: 1;
    transition: opacity 0.3s;
}

.theme-icon-light { color: #92400e; opacity: 1; }
.theme-icon-dark { color: #94a3b8; opacity: 0.5; }

[data-theme="dark"] .theme-icon-light { opacity: 0.5; color: #475569; }
[data-theme="dark"] .theme-icon-dark { opacity: 1; color: #fbbf24; }

.theme-switch-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.4s cubic-bezier(0.68, -0.15, 0.27, 1.15);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .theme-switch-thumb {
    transform: translateX(26px);
    background: #0f172a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 0 0 2px #fbbf24;
}

/* Dark theme dropdown */
[data-theme="dark"] .dropdown-menu {
    background: var(--dropdown-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--bg-surface-2);
}

[data-theme="dark"] .dropdown-item-text {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-bottom {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .form-check-input {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

[data-theme="dark"] .form-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   DARK MODE - COMPREHENSIVE FIXES
   ============================================ */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-primary);
}

[data-theme="dark"] strong,
[data-theme="dark"] b,
[data-theme="dark"] .fw-bold,
[data-theme="dark"] .fw-semibold {
    color: inherit;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] label,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] li {
    color: var(--text-primary);
}

[data-theme="dark"] .card-header {
    color: var(--text-primary);
}

[data-theme="dark"] small {
    color: var(--text-muted);
}

[data-theme="dark"] .text-muted small,
[data-theme="dark"] small.text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .bi,
[data-theme="dark"] i.bi {
    color: inherit;
}

[data-theme="dark"] .text-primary {
    color: var(--primary-light) !important;
}

[data-theme="dark"] .text-info {
    color: var(--secondary-light) !important;
}

[data-theme="dark"] .text-danger {
    color: #f87171 !important;
}

[data-theme="dark"] .text-success {
    color: #4ade80 !important;
}

[data-theme="dark"] .text-warning {
    color: #fbbf24 !important;
}

/* Dark close button */
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark page title and sidebar toggle */
[data-theme="dark"] #sidebarToggle {
    color: var(--text-secondary);
}

/* Dark badge overrides */
[data-theme="dark"] .badge-baru { background: rgba(59,130,246,0.2); color: #93bbfc; }
[data-theme="dark"] .badge-diproses { background: rgba(245,158,11,0.2); color: #fcd34d; }
[data-theme="dark"] .badge-selesai { background: rgba(34,197,94,0.2); color: #86efac; }
[data-theme="dark"] .badge-active { background: rgba(34,197,94,0.2); color: #86efac; }
[data-theme="dark"] .badge-inactive { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] .badge-ditolak { background: rgba(239,68,68,0.2); color: #fca5a5; }

/* Dark border rounded items */
[data-theme="dark"] .border.rounded,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top {
    border-color: var(--border-color) !important;
}

/* Dark kapal-info / info boxes */
[data-theme="dark"] .kapal-info,
[data-theme="dark"] [style*="background:var(--bg-surface-2)"],
[data-theme="dark"] [style*="background:var(--primary-50)"] {
    color: var(--text-primary);
}

/* Dark modal close */
[data-theme="dark"] .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }

/* Dark spinner */
[data-theme="dark"] .spinner-overlay { background: rgba(15,23,42,0.8); }

/* Dark empty state */
[data-theme="dark"] .empty-state { color: var(--text-muted); }
[data-theme="dark"] .empty-state i { color: var(--text-muted); }
[data-theme="dark"] .empty-state h5 { color: var(--text-secondary); }

/* Dark jenis-item checkbox label */
[data-theme="dark"] .jenis-item {
    border-color: var(--border-color) !important;
    color: var(--text-primary);
}

/* Dark search results dropdown */
[data-theme="dark"] .kapal-results,
[data-theme="dark"] #kapalResults {
    background: var(--bg-card);
    border-color: var(--border-color) !important;
    color: var(--text-primary);
}

[data-theme="dark"] .kapal-results .p-2,
[data-theme="dark"] .kapal-results div,
[data-theme="dark"] .search-result-item,
[data-theme="dark"] #kapalResults div {
    color: var(--text-primary);
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .kapal-results .p-2:hover,
[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] #kapalResults div:hover {
    background: var(--bg-surface-2);
}

/* Dark mode tables — COMPREHENSIVE */
[data-theme="dark"] .table {
    color: var(--text-primary);
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--bg-surface-2);
    --bs-table-hover-bg: var(--table-hover);
}

[data-theme="dark"] .table thead th {
    background: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .table tbody td {
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    background: transparent;
}

[data-theme="dark"] .table tbody tr {
    background: transparent;
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--table-hover) !important;
}

[data-theme="dark"] .table-responsive {
    color: var(--text-primary);
}

/* Dark Bootstrap table overrides */
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

/* Dark DataTables overrides */
[data-theme="dark"] .dataTables_wrapper,
[data-theme="dark"] .dataTables_info,
[data-theme="dark"] .dataTables_length,
[data-theme="dark"] .dataTables_filter {
    color: var(--text-primary);
}

[data-theme="dark"] .dataTables_wrapper select,
[data-theme="dark"] .dataTables_wrapper input {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}

[data-theme="dark"] .page-link {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Dark alerts */
[data-theme="dark"] .alert-success { background: rgba(34,197,94,0.15); color: #86efac; }
[data-theme="dark"] .alert-danger { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.15); color: #fcd34d; }
[data-theme="dark"] .alert-info { background: rgba(59,130,246,0.15); color: #93c5fd; }

/* Dark form switch labels */
[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}

/* Dark list-group */
[data-theme="dark"] .list-group-item {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Dark nav-tabs */
[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .nav-link.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Dark stat card text always white */
[data-theme="dark"] .stat-card .stat-value,
[data-theme="dark"] .stat-card .stat-label {
    color: white !important;
}

/* Dark tooltip */
[data-theme="dark"] .tooltip-inner {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

/* ============================================
   DARK MODE — COMPREHENSIVE INPUT/FORM FIXES
   ============================================ */

/* All form inputs, selects, textareas — text white */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-control {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--input-border) !important;
}

/* Placeholder text */
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-select::placeholder {
    color: var(--text-muted) !important;
}

/* Date/time input icons (calendar, clock) */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(200%);
}

/* Filter bar inputs & selects */
[data-theme="dark"] .filter-bar .form-control,
[data-theme="dark"] .filter-bar .form-select {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--input-border) !important;
}

/* ============================================
   DARK MODE — TOGGLE / SWITCH FIXES
   ============================================ */

/* Toggle switch — off state visible */
[data-theme="dark"] .form-switch .form-check-input {
    background-color: #475569;
    border-color: #64748b;
}

/* Toggle switch — ON state */
[data-theme="dark"] .form-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Toggle circle (custom) — white circle */
[data-theme="dark"] .toggle-circle,
[data-theme="dark"] .form-check-input::before {
    background: white !important;
}

/* ============================================
   DARK MODE — NOTIFICATIONS PAGE
   ============================================ */

[data-theme="dark"] .notification-item,
[data-theme="dark"] .notif-item {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .notification-item *,
[data-theme="dark"] .notif-item * {
    color: var(--text-primary);
}

[data-theme="dark"] .notification-item small,
[data-theme="dark"] .notif-item small,
[data-theme="dark"] .notification-item .text-muted,
[data-theme="dark"] .notif-item .text-muted {
    color: var(--text-muted) !important;
}

/* ============================================
   DARK MODE — PROFILE & SETTINGS PAGE
   ============================================ */

[data-theme="dark"] .help-box,
[data-theme="dark"] .info-box,
[data-theme="dark"] .card-body p,
[data-theme="dark"] .card-body span,
[data-theme="dark"] .card-body small,
[data-theme="dark"] .card-body label,
[data-theme="dark"] .card-body li,
[data-theme="dark"] .card-body div {
    color: var(--text-primary);
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-secondary {
    color: var(--text-secondary) !important;
}

/* Settings toggle labels & descriptions */
[data-theme="dark"] .setting-item,
[data-theme="dark"] .setting-item * {
    color: var(--text-primary);
}

/* ============================================
   DARK MODE — LAPORAN (REPORT) PAGE
   ============================================ */

[data-theme="dark"] .total-pnbp,
[data-theme="dark"] .stat-total,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .fw-bold {
    color: var(--text-primary);
}

/* ============================================
   DARK MODE — CHART / DASHBOARD
   ============================================ */

[data-theme="dark"] .chart-container canvas {
    color: var(--text-primary);
}

/* Dashboard filter buttons */
[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-secondary.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   DARK MODE — GENERAL TEXT CATCH-ALL
   ============================================ */

[data-theme="dark"] .card-body strong {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-body label,
[data-theme="dark"] .modal-body span,
[data-theme="dark"] .modal-body p,
[data-theme="dark"] .modal-body div,
[data-theme="dark"] .modal-body small {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-body .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .modal-body .text-danger {
    color: #fca5a5 !important;
}

/* Link modal info box - dark text on light background */
[data-theme="dark"] #linkModalBody > .p-3.rounded:first-child,
[data-theme="dark"] #linkModalBody > .p-3.rounded:first-child div,
[data-theme="dark"] #linkModalBody > .p-3.rounded:first-child .fw-bold,
[data-theme="dark"] #linkModalBody > .p-3.rounded:first-child small {
    color: #1e293b !important;
}

/* Force dark text on bg-light badges in dark mode */
[data-theme="dark"] .badge.bg-light {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #1e293b !important;
}
[data-theme="dark"] .badge.bg-light.text-dark {
    color: #1e293b !important;
}

/* Dark text on light-background info boxes (Total PNBP, etc) */
[data-theme="dark"] .card-body > .p-3.rounded[style*="primary-50"],
[data-theme="dark"] .card-body > .p-3.rounded[style*="primary-50"] *,
[data-theme="dark"] .card-body > .mb-3.p-3.rounded[style*="primary-50"],
[data-theme="dark"] .card-body > .mb-3.p-3.rounded[style*="primary-50"] * {
    color: #1e293b !important;
}

/* Jenis Layanan dropdown trigger - match form-control style */
.filter-bar .dropdown .btn-outline-secondary {
    border: 1.5px solid var(--input-border) !important;
    border-radius: var(--radius) !important;
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}
.filter-bar .dropdown .btn-outline-secondary:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Dropdown menu - light mode */
.filter-bar .dropdown-menu {
    z-index: 1055;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    background: #ffffff;
}

/* Dark mode - dropdown trigger */
[data-theme="dark"] .filter-bar .dropdown .btn-outline-secondary {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--input-border) !important;
}

/* Dark mode - dropdown menu: solid dark background */
[data-theme="dark"] .filter-bar .dropdown-menu {
    background: #1e293b !important;
    border-color: var(--input-border) !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}
[data-theme="dark"] .filter-bar .dropdown-menu .form-check-label {
    color: #e2e8f0 !important;
}
[data-theme="dark"] .filter-bar .dropdown-menu .border-bottom {
    border-color: var(--input-border) !important;
}
