/**
 * Aurum PMS - Universal Enterprise Dark Mode System
 * Automatically harmonizes Office ERP, Ship Owner Portal, Seafarer Portal & SuperLogin
 */

:root[data-theme="dark"],
:root[data-bs-theme="dark"],
body[data-theme="dark"] {
    --aurum-dark-bg: #09172a;
    --aurum-dark-surface: #0f223d;
    --aurum-dark-surface-elevated: #162c4d;
    --aurum-dark-border: #1e3a61;
    --aurum-dark-text-primary: #f8fafc;
    --aurum-dark-text-secondary: #94a3b8;
    --aurum-dark-text-muted: #64748b;
    --aurum-dark-input-bg: #0b1a2e;
    
    /* Bootstrap & Template Variable Overrides */
    --bs-body-bg: #09172a !important;
    --bs-body-color: #f1f5f9 !important;
    --bs-card-bg: #0f223d !important;
    --bs-border-color: #1e3a61 !important;
    --body-bg: #09172a !important;
    --so-bg: #09172a !important;
    --so-card-bg: #0f223d !important;
    --so-border: #1e3a61 !important;
    --so-text-dark: #f8fafc !important;
    --so-text-muted: #94a3b8 !important;
}

/* ==========================================================================
   GLOBAL BASE IN DARK MODE
   ========================================================================== */
[data-theme="dark"] body,
[data-bs-theme="dark"] body {
    background-color: #09172a !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .bg-body-bg {
    background-color: #09172a !important;
}

/* CARDS & PANELS */
[data-theme="dark"] .card,
[data-theme="dark"] .card-custom,
[data-theme="dark"] .bg-white,
[data-theme="dark"] .aurum-card,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-custom,
[data-bs-theme="dark"] .bg-white {
    background-color: #0f223d !important;
    border-color: #1e3a61 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
    background-color: #0c1a2e !important;
    border-color: #1e3a61 !important;
}

/* TEXT COLOR ADAPTATIONS */
[data-theme="dark"] .text-dark,
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6,
[data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

/* TABLES */
[data-theme="dark"] .table,
[data-theme="dark"] .table-responsive,
[data-bs-theme="dark"] .table {
    background-color: #0f223d !important;
    color: #f1f5f9 !important;
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .table thead,
[data-theme="dark"] .table-light,
[data-bs-theme="dark"] .table thead,
[data-bs-theme="dark"] .table-light {
    background-color: #142742 !important;
    color: #e2e8f0 !important;
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] .table-light th,
[data-bs-theme="dark"] .table thead th {
    background-color: #142742 !important;
    color: #cbd5e1 !important;
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .table tbody tr,
[data-bs-theme="dark"] .table tbody tr {
    border-color: #1e3a61 !important;
    background-color: transparent !important;
}

[data-theme="dark"] .table tbody tr td,
[data-bs-theme="dark"] .table tbody tr td {
    color: #e2e8f0 !important;
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .table-hover tbody tr:hover,
[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: #162c4d !important;
}

/* FORMS, INPUTS, SELECTS */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0b1a2e !important;
    border-color: #1e3a61 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #0e223d !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .form-floating label,
[data-bs-theme="dark"] .form-floating label {
    color: #94a3b8 !important;
}

/* MODALS */
[data-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-content {
    background-color: #0f223d !important;
    border: 1px solid #1e3a61 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .modal-footer.bg-light,
[data-theme="dark"] .modal-body .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: #0b1a2e !important;
    border-color: #1e3a61 !important;
}

/* DROPDOWNS */
[data-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #0f223d !important;
    border: 1px solid #1e3a61 !important;
    color: #f8fafc !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .dropdown-item,
[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #162c4d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .dropdown-divider,
[data-bs-theme="dark"] .dropdown-divider {
    border-color: #1e3a61 !important;
}

/* ALERTS & NOTICES */
[data-theme="dark"] .alert-info,
[data-bs-theme="dark"] .alert-info {
    background-color: rgba(14, 165, 233, 0.12) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
    color: #38bdf8 !important;
}

[data-theme="dark"] .alert-primary,
[data-bs-theme="dark"] .alert-primary {
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .alert-success,
[data-bs-theme="dark"] .alert-success {
    background-color: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
}

[data-theme="dark"] .alert-warning,
[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

[data-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}

/* ==========================================================================
   PORTAL-SPECIFIC ADAPTATIONS
   ========================================================================== */

/* 1. OFFICE ERP (TOPBAR & SIDEBAR) */
[data-theme="dark"] #header-area {
    background-color: #0f223d !important;
    border-color: #1e3a61 !important;
}

[data-theme="dark"] .sidebar-area {
    background-color: #0a1728 !important;
    border-right: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .footer-area {
    background-color: #0f223d !important;
    border-color: #1e3a61 !important;
    color: #94a3b8 !important;
}

/* 2. SHIP OWNER PORTAL */
[data-theme="dark"] .shipowner-navbar {
    background: #0f223d !important;
    border-bottom: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .shipowner-sidebar {
    background: #0a1728 !important;
    border-right: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .shipowner-sidebar .sidebar-header {
    border-bottom: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .shipowner-sidebar .nav-link {
    color: #94a3b8 !important;
}

[data-theme="dark"] .shipowner-sidebar .nav-link:hover,
[data-theme="dark"] .shipowner-sidebar .nav-link.active {
    background-color: #162c4d !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .shipowner-sidebar .sidebar-vessel-select {
    background-color: #0b1a2e !important;
    border-color: #1e3a61 !important;
    color: #f8fafc !important;
}

/* 3. SEAFARER PORTAL */
[data-theme="dark"] .top-navbar {
    background: linear-gradient(135deg, #071322 0%, #0d223f 100%) !important;
    border-bottom: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .seafarer-nav-tabs {
    background: #0a1728 !important;
    border-bottom: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .seafarer-nav-tabs .nav-link {
    color: #94a3b8 !important;
}

[data-theme="dark"] .seafarer-nav-tabs .nav-link.active {
    color: #60a5fa !important;
    border-bottom-color: #3b82f6 !important;
}

[data-theme="dark"] .sub-nav-tabs {
    border-bottom-color: #1e3a61 !important;
}

[data-theme="dark"] .sub-nav-tabs .nav-link {
    color: #94a3b8 !important;
}

[data-theme="dark"] .sub-nav-tabs .nav-link.active {
    background: #162c4d !important;
    color: #60a5fa !important;
}

/* UNIVERSAL FLOATING THEME TOGGLE BUTTON */
.aurum-theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--aurum-dark-border, #e2e8f0);
    background: transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    color: inherit;
}

.aurum-theme-toggle-btn:hover {
    transform: scale(1.08);
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .theme-icon-light {
    display: inline-block !important;
}

[data-theme="dark"] .theme-icon-dark {
    display: none !important;
}

[data-theme="light"] .theme-icon-light,
body:not([data-theme="dark"]) .theme-icon-light {
    display: none !important;
}

[data-theme="light"] .theme-icon-dark,
body:not([data-theme="dark"]) .theme-icon-dark {
    display: inline-block !important;
}

/* ==========================================================================
   ENHANCED PORTAL COMPONENTS (SHIP OWNER, SEAFARER, SUPERLOGIN & DASHBOARD)
   ========================================================================== */

/* METRIC CARDS & STATS */
[data-theme="dark"] .metric-card,
[data-bs-theme="dark"] .metric-card {
    background-color: #0f223d !important;
    border-color: #1e3a61 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .metric-card h3,
[data-theme="dark"] .metric-card .fs-4,
[data-theme="dark"] .metric-card .fs-5,
[data-theme="dark"] .metric-card .fw-bold,
[data-bs-theme="dark"] .metric-card h3,
[data-bs-theme="dark"] .metric-card .fs-4,
[data-bs-theme="dark"] .metric-card .fs-5,
[data-bs-theme="dark"] .metric-card .fw-bold {
    color: #f8fafc !important;
}

/* LIGHT BUTTONS ADAPTATION */
[data-theme="dark"] .btn-light,
[data-bs-theme="dark"] .btn-light {
    background-color: #162c4d !important;
    border-color: #1e3a61 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .btn-light:hover,
[data-bs-theme="dark"] .btn-light:hover {
    background-color: #1e3a61 !important;
    border-color: #2b4c7e !important;
    color: #ffffff !important;
}

/* LIGHT BADGES & SUBTLES */
[data-theme="dark"] .badge.bg-light,
[data-bs-theme="dark"] .badge.bg-light {
    background-color: #1e3a61 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .bg-primary-subtle,
[data-bs-theme="dark"] .bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.18) !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .bg-danger-subtle,
[data-bs-theme="dark"] .bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.18) !important;
    color: #f87171 !important;
}

[data-theme="dark"] .bg-success-subtle,
[data-bs-theme="dark"] .bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.18) !important;
    color: #4ade80 !important;
}

[data-theme="dark"] .bg-warning-subtle,
[data-bs-theme="dark"] .bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #fbbf24 !important;
}

[data-theme="dark"] .bg-info-subtle,
[data-bs-theme="dark"] .bg-info-subtle {
    background-color: rgba(14, 165, 233, 0.18) !important;
    color: #38bdf8 !important;
}

/* FOOTER ADAPTATION */
[data-theme="dark"] footer,
[data-theme="dark"] footer.bg-white,
[data-bs-theme="dark"] footer,
[data-bs-theme="dark"] footer.bg-white {
    background-color: #0b1a2e !important;
    border-color: #1e3a61 !important;
    color: #94a3b8 !important;
}

/* DROPUP & POPUP MENUS */
[data-theme="dark"] .dropup .dropdown-menu,
[data-bs-theme="dark"] .dropup .dropdown-menu {
    background-color: #0f223d !important;
    border: 1px solid #1e3a61 !important;
    color: #f8fafc !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45) !important;
    z-index: 1060 !important;
}

/* SWEETALERT2 IN DARK MODE */
[data-theme="dark"] .swal2-popup,
[data-bs-theme="dark"] .swal2-popup {
    background: #0f223d !important;
    color: #f8fafc !important;
    border: 1px solid #1e3a61 !important;
}

[data-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-title {
    color: #f8fafc !important;
}

[data-theme="dark"] .swal2-html-container,
[data-bs-theme="dark"] .swal2-html-container {
    color: #cbd5e1 !important;
}

/* LOGIN CARDS IN DARK MODE */
[data-theme="dark"] .login-card,
[data-bs-theme="dark"] .login-card {
    background: #0f223d !important;
    border: 1px solid #1e3a61 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .login-card .text-muted,
[data-bs-theme="dark"] .login-card .text-muted {
    color: #94a3b8 !important;
}


