/**
 * ============================================================================
 * CUSTOM BASE CSS - Always Loaded
 * ============================================================================
 *
 * Base styling that's always loaded regardless of theme selection.
 * Acts as fallback for "No Theme" mode and provides consistent base styling.
 * ============================================================================
 */

/* ============================================================================
   THEME SELECTOR - Login Page Fixed Position
   ============================================================================
   Navbar theme picker uses native Metronic KTMenu - no custom CSS needed.
   Only the login page needs positioning since KTMenu may not be initialized.
   ============================================================================ */
.theme-selector-login-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

[dir="rtl"] .theme-selector-login-wrap {
    right: auto;
    left: 20px;
}

.theme-selector-login-wrap .menu-sub-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 105;
}

[dir="rtl"] .theme-selector-login-wrap .menu-sub-dropdown {
    right: auto;
    left: 0;
}

/* ============================================================================
   LANGUAGE DROPDOWN - Base Styling
   ============================================================================ */
.lang-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.lang-dropdown-toggle:hover {
    background: var(--bs-secondary-bg, #f5f8fa);
}

.lang-menu-item .menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-menu-item .lang-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bs-primary-bg-subtle, #f1faff);
    color: var(--bs-primary, #009ef7);
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.lang-menu-item .menu-link.active .lang-icon {
    background: var(--bs-primary, #009ef7);
    color: #ffffff;
}

/* ============================================================================
   SIDEBAR LOGO - Base Styling
   ============================================================================ */
.app-sidebar-logo {
    padding: 2.5rem 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}

.sidebar-logo-link {
    display: block;
    width: 100%;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-logo-link:hover {
    transform: translateY(-2px);
}

.sidebar-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.sidebar-logo-img {
    max-width: 170px;
    max-height: 65px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: all 0.3s ease;
}

.sidebar-logo-link:hover .sidebar-logo-img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.sidebar-logo-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--bs-primary, #009ef7), var(--bs-info, #7239ea));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0, 158, 247, 0.3);
    transition: all 0.3s ease;
    color: #ffffff;
}

.sidebar-logo-icon svg {
    width: 30px;
    height: 30px;
}

.sidebar-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bs-primary, #009ef7);
    letter-spacing: -0.3px;
}

.sidebar-logo-link:hover .sidebar-logo-icon {
    transform: rotate(5deg) scale(1.05);
}

/* Minimized Sidebar Logo */
[data-kt-app-sidebar-minimize="on"] .sidebar-logo-img {
    max-width: 35px;
    max-height: 35px;
}

[data-kt-app-sidebar-minimize="on"] .sidebar-logo-fallback {
    flex-direction: row;
}

[data-kt-app-sidebar-minimize="on"] .sidebar-logo-text {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .sidebar-logo-icon {
    width: 35px;
    height: 35px;
}

/* Mobile logo */
.mobile-logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-logo-img {
    height: 30px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

/* ============================================================================
   LOGIN PAGE - Centered Card Design with Flying Dots
   ============================================================================
   Base styling for all themes and "No Theme".
   Themes override ONLY colors via their own _login.css files.
   ============================================================================ */

/* ── Background ───────────────────────────────── */
[data-bs-theme="dark"] .app-blank {
    background: linear-gradient(135deg, #0D0B1A 0%, #161230 50%, #0D0B1A 100%);
}

[data-bs-theme="light"] .app-blank {
    background: linear-gradient(135deg, #f0f2f8 0%, #e8eaf6 50%, #f0f2f8 100%);
}

/* ── Flying Dots Background ──────────────────── */
.login-bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    animation: loginDotFloat linear infinite;
}

[data-bs-theme="light"] .login-dot {
    background: rgba(0, 0, 0, 0.12);
}

.login-dot:nth-child(1)  { left:  5%; animation-duration: 18s; animation-delay: 0s;   width: 3px; height: 3px; }
.login-dot:nth-child(2)  { left: 15%; animation-duration: 22s; animation-delay: 2s;   width: 5px; height: 5px; }
.login-dot:nth-child(3)  { left: 25%; animation-duration: 16s; animation-delay: 4s;   width: 3px; height: 3px; }
.login-dot:nth-child(4)  { left: 35%; animation-duration: 20s; animation-delay: 1s;   width: 4px; height: 4px; }
.login-dot:nth-child(5)  { left: 45%; animation-duration: 24s; animation-delay: 3s;   width: 3px; height: 3px; }
.login-dot:nth-child(6)  { left: 55%; animation-duration: 17s; animation-delay: 5s;   width: 5px; height: 5px; }
.login-dot:nth-child(7)  { left: 65%; animation-duration: 21s; animation-delay: 0.5s; width: 3px; height: 3px; }
.login-dot:nth-child(8)  { left: 75%; animation-duration: 19s; animation-delay: 2.5s; width: 4px; height: 4px; }
.login-dot:nth-child(9)  { left: 85%; animation-duration: 23s; animation-delay: 1.5s; width: 3px; height: 3px; }
.login-dot:nth-child(10) { left: 92%; animation-duration: 15s; animation-delay: 4.5s; width: 5px; height: 5px; }
.login-dot:nth-child(11) { left: 10%; animation-duration: 26s; animation-delay: 6s;   width: 3px; height: 3px; }
.login-dot:nth-child(12) { left: 50%; animation-duration: 20s; animation-delay: 3.5s; width: 4px; height: 4px; }

@keyframes loginDotFloat {
    0%   { transform: translateY(100vh) scale(0); opacity: 0; }
    10%  { opacity: 0.6; transform: translateY(80vh) scale(1); }
    90%  { opacity: 0.5; }
    100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

/* ── Login Root ──────────────────────────────── */
.login-page-root {
    position: relative;
    z-index: 1;
}

/* ── Login Card ──────────────────────────────── */
.login-card {
    animation: loginCardFadeIn 0.6s ease-out both;
}

.login-card-inner {
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .login-card-inner {
    background: rgba(20, 17, 40, 0.8);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.03);
}

[data-bs-theme="light"] .login-card-inner {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.08);
}

/* ── Brand Header ────────────────────────────── */
.login-brand-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bs-primary, #009ef7), rgba(var(--bs-primary-rgb, 0, 158, 247), 0.7));
    box-shadow: 0 8px 25px rgba(var(--bs-primary-rgb, 0, 158, 247), 0.3);
    animation: loginIconPulse 3s ease-in-out infinite;
}

.login-brand-title {
    font-size: 1.5rem;
    color: var(--bs-gray-900, #fff);
}

[data-bs-theme="dark"] .login-brand-title {
    background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-brand-subtitle {
    color: var(--bs-gray-500, #a1a5b7);
    opacity: 0.8;
}

/* ── Welcome Text ────────────────────────────── */
.login-welcome-title {
    font-size: 1.35rem;
    color: var(--bs-gray-900, #fff);
}

[data-bs-theme="dark"] .login-welcome-title {
    color: #fff;
}

.login-welcome-subtitle {
    color: var(--bs-gray-500, #a1a5b7);
}

/* ── Form Fields ─────────────────────────────── */
.login-field-label {
    color: var(--bs-gray-600, #a1a5b7);
}

[data-bs-theme="dark"] .login-field-label {
    color: rgba(255, 255, 255, 0.7);
}

.login-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input {
    padding-inline-end: 48px !important;
    padding-inline-start: 16px !important;
    height: 50px;
    border-radius: 12px !important;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .login-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

[data-bs-theme="light"] .login-input {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.login-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb, 0, 158, 247), 0.15) !important;
    border-color: var(--bs-primary, #009ef7) !important;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

[data-bs-theme="light"] .login-input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

/* Input icons - positioned at ends */
.login-input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    color: rgba(255, 255, 255, 0.4);
    z-index: 2;
}

[data-bs-theme="light"] .login-input-icon {
    color: rgba(0, 0, 0, 0.35);
}

/* RTL: icon-end = right, icon-start = left */
.login-input-icon-end { right: 4px; }
.login-input-icon-start { left: 4px; }

[dir="rtl"] .login-input-icon-end { right: auto; left: 4px; }
[dir="rtl"] .login-input-icon-start { left: auto; right: 4px; }

/* Password has both icons: lock on end, eye on start */
.fv-row:has(.login-toggle-pw) .login-input {
    padding-inline-start: 48px !important;
}

.login-toggle-pw {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
}

/* ── Checkbox ────────────────────────────────── */
.login-checkbox:checked {
    background-color: var(--bs-primary, #009ef7);
    border-color: var(--bs-primary, #009ef7);
}

.login-remember-label {
    cursor: pointer;
}

/* ── Submit Button ───────────────────────────── */
.login-submit-btn {
    height: 52px;
    border-radius: 12px !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none;
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(var(--bs-primary-rgb, 0, 158, 247), 0.3);
}

/* ── Language Switcher ───────────────────────── */
.login-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

[data-bs-theme="dark"] .login-lang-btn {
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="light"] .login-lang-btn {
    color: rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 0, 0, 0.08);
}

.login-lang-btn.active {
    border-color: rgba(var(--bs-primary-rgb, 0, 158, 247), 0.4);
}

[data-bs-theme="dark"] .login-lang-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

[data-bs-theme="light"] .login-lang-btn.active {
    color: #000;
    background: rgba(0, 0, 0, 0.04);
}

.login-lang-btn:hover {
    border-color: rgba(var(--bs-primary-rgb, 0, 158, 247), 0.3);
}

.login-lang-flag {
    width: 22px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
}

/* ── Staggered Animations ────────────────────── */
.login-card .fv-row:nth-child(1) { animation: loginFieldFadeIn 0.5s ease-out 0.15s both; }
.login-card .fv-row:nth-child(2) { animation: loginFieldFadeIn 0.5s ease-out 0.25s both; }
.login-card .d-grid              { animation: loginFieldFadeIn 0.5s ease-out 0.35s both; }

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

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

@keyframes loginIconPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* ============================================================================
   DASHBOARD CARDS - Base Styling (Metronic Compatible)
   ============================================================================ */

/* Stats Grid Layout */
.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Stat Card Base - Works for both dashboard and list pages */
.stat-card {
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #e4e6ef);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .stat-card {
    background: var(--bs-card-bg, #1e1e2d);
    border-color: var(--bs-border-color, #2b2b40);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--bs-gray-600, #7e8299);
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-gray-900, #181c32);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-icon i {
    font-size: 1.5rem;
}

.stat-card .growth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.stat-card .growth-badge.positive {
    background: rgba(80, 205, 137, 0.15);
    color: #50cd89;
}

.stat-card .growth-badge.negative {
    background: rgba(241, 65, 108, 0.15);
    color: #f1416c;
}

/* ============================================================================
   FORM SECTIONS - Base Styling
   ============================================================================ */
.form-section {
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #e4e6ef);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

[data-bs-theme="dark"] .form-section {
    background: var(--bs-card-bg, #1e1e2d);
    border-color: var(--bs-border-color, #2b2b40);
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-gray-900, #181c32);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color, #e4e6ef);
}

[data-bs-theme="dark"] .form-section-title {
    color: var(--bs-gray-100, #f5f8fa);
    border-bottom-color: var(--bs-border-color, #2b2b40);
}

.form-section-title i {
    color: var(--bs-primary, #009ef7);
}

/* Avatar Upload Preview */
.avatar-upload-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bs-border-color, #e4e6ef);
    background: var(--bs-secondary-bg, #f5f8fa);
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .avatar-upload-preview {
    border-color: var(--bs-border-color, #2b2b40);
    background: var(--bs-gray-800, #1b1b29);
}

/* Welcome Card */
.welcome-card {
    border-radius: 0.75rem;
}

/* Chart Card */
.chart-card {
    border-radius: 0.75rem;
}

.chart-container {
    height: 300px;
    position: relative;
}

/* Activity Item */
.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color, #e4e6ef);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-primary-bg-subtle, #f1faff);
    color: var(--bs-primary, #009ef7);
}

.activity-time {
    font-size: 0.8125rem;
    color: var(--bs-gray-500, #a1a5b7);
}

/* ============================================================================
   ANIMATED BACKGROUND - Base Styling
   ============================================================================ */
.dashboard-bg,
.dashboard-grid,
.dashboard-particles,
.dashboard-particle {
    display: none; /* Hidden by default - themes enable these */
}

/* ============================================================================
   LEAFLET MAP - Base Styling (Theme-independent)
   ============================================================================
   Provides structural rules and sensible defaults for Leaflet maps, controls,
   popups, and zone-editing UI. Themes override colors through --auro-* tokens.
   ============================================================================ */

/* --- Map Containers --- */
.leaflet-container {
    border-radius: 0.75rem;
    overflow: hidden;
}

#zones-map,
#zone-map {
    width: 100%;
    border-radius: 0.75rem;
    border: 2px solid var(--auro-border-default, var(--bs-border-color, #e4e6ef));
    z-index: 1;
}

#zones-map { height: 400px; }
#zone-map  { height: 500px; }

#map {
    height: 250px;
    border-radius: 0.75rem;
    border: 1px solid var(--auro-border-default, var(--bs-border-color, #e4e6ef));
}

/* --- Popup Styling --- */
.leaflet-popup-content-wrapper {
    background: var(--auro-surface-card-solid, var(--bs-body-bg, #fff)) !important;
    border: 1px solid var(--auro-border-default, var(--bs-border-color, #e4e6ef)) !important;
    border-radius: 0.625rem !important;
    box-shadow: var(--auro-shadow-md, 0 4px 20px rgba(0,0,0,0.08)) !important;
    color: var(--auro-text-primary, var(--bs-body-color, #181c32));
}

.leaflet-popup-content {
    color: var(--auro-text-primary, var(--bs-body-color, #181c32));
}

.leaflet-popup-tip {
    background: var(--auro-surface-card-solid, var(--bs-body-bg, #fff)) !important;
}

/* --- Zoom Controls --- */
.leaflet-control-zoom a {
    background: var(--auro-surface-card-solid, var(--bs-body-bg, #fff));
    color: var(--auro-text-primary, var(--bs-body-color, #181c32));
    border-color: var(--auro-border-default, var(--bs-border-color, #e4e6ef));
}

.leaflet-control-zoom a:hover {
    background: var(--bs-primary, #009ef7);
    color: #fff;
}

/* --- Draw Controls --- */
.leaflet-draw-toolbar a {
    background-color: var(--auro-surface-card-solid, var(--bs-body-bg, #fff));
    border-color: var(--auro-border-default, var(--bs-border-color, #e4e6ef));
}

.leaflet-draw-toolbar a:hover {
    background-color: var(--bs-primary, #009ef7);
}

/* --- Zone Legend --- */
.zone-legend {
    background: var(--auro-surface-card, var(--bs-body-bg, #fff));
    border: 1px solid var(--auro-border-default, var(--bs-border-color, #e4e6ef));
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.zone-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.zone-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* --- Map Instructions --- */
.map-instructions {
    background: rgba(var(--bs-primary-rgb, 0, 158, 247), 0.08);
    border: 1px solid var(--bs-primary, #009ef7);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.map-instructions h6 {
    color: var(--bs-primary, #009ef7);
    margin-bottom: 0.5rem;
}

.map-instructions ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

[dir="rtl"] .map-instructions ul {
    padding-left: 0;
    padding-right: 1.5rem;
}

.map-instructions li {
    font-size: 0.9rem;
    color: var(--auro-text-muted, var(--bs-secondary-color, #a1a5b7));
}

/* --- Existing Zone Legend --- */
.existing-zone-legend {
    background: rgba(var(--bs-info-rgb, 23, 162, 184), 0.08);
    border: 1px solid var(--bs-info, #17a2b8);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 1rem;
}

/* --- Coordinates Display --- */
.coordinates-display {
    font-family: monospace;
    font-size: 0.8rem;
    max-height: 100px;
    overflow-y: auto;
    background: var(--auro-surface-card, var(--bs-body-bg, #fff));
    border: 1px solid var(--auro-border-default, var(--bs-border-color, #e4e6ef));
    border-radius: 4px;
    padding: 0.5rem;
    color: var(--auro-text-primary, var(--bs-body-color, #181c32));
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 480px) {
    .theme-selector-login-wrap {
        top: 15px;
        right: 15px;
    }

    [dir="rtl"] .theme-selector-login-wrap {
        right: auto;
        left: 15px;
    }

    .sidebar-logo-img {
        max-width: 130px;
        max-height: 50px;
    }

    .quick-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .sidebar-logo-img {
        max-width: 150px;
        max-height: 55px;
    }
}

/* ============================================================================
   DARK MODE ADJUSTMENTS
   ============================================================================ */
[data-bs-theme="dark"] .stat-card .stat-value {
    color: var(--bs-gray-100, #f5f8fa);
}

[data-bs-theme="dark"] .stat-card .stat-label {
    color: var(--bs-gray-500, #a1a5b7);
}

[data-bs-theme="dark"] .stat-card .stat-icon {
    background: rgba(var(--bs-primary-rgb), 0.15);
}

[data-bs-theme="dark"] .activity-icon {
    background: rgba(var(--bs-primary-rgb), 0.15);
}

/* ============================================================================
   RTL DATATABLES FIXES
   Fixes alignment issues for DataTables when page direction is RTL (Arabic)
   ============================================================================ */

/* Cell text alignment */
[dir="rtl"] table.dataTable thead > tr > th,
[dir="rtl"] table.dataTable thead > tr > td,
[dir="rtl"] table.dataTable tbody > tr > th,
[dir="rtl"] table.dataTable tbody > tr > td,
[dir="rtl"] table.dataTable tfoot > tr > th,
[dir="rtl"] table.dataTable tfoot > tr > td {
    text-align: right;
}

/* Keep centered cells centered */
[dir="rtl"] table.dataTable thead > tr > th.text-center,
[dir="rtl"] table.dataTable tbody > tr > td.text-center,
[dir="rtl"] table.dataTable tfoot > tr > th.text-center {
    text-align: center;
}

/* Sort icon positioning - move to left side in RTL */
[dir="rtl"] table.dataTable thead .sorting,
[dir="rtl"] table.dataTable thead .sorting_asc,
[dir="rtl"] table.dataTable thead .sorting_desc,
[dir="rtl"] table.dataTable thead .sorting_asc_disabled,
[dir="rtl"] table.dataTable thead .sorting_desc_disabled {
    padding-right: 0 !important;
    padding-left: 18px !important;
    background-position: left center !important;
}

/* Wrapper controls: length (show N entries) + filter search */
[dir="rtl"] .dataTables_wrapper .dataTables_length {
    float: right;
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_filter {
    float: left;
    text-align: left;
}

/* Bottom controls: info + pagination */
[dir="rtl"] .dataTables_wrapper .dataTables_info {
    float: right;
    text-align: right;
}

[dir="rtl"] .dataTables_wrapper .dataTables_paginate {
    float: left;
    text-align: left;
}

/* Pagination button spacing */
[dir="rtl"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    margin-left: 2px;
    margin-right: 0;
}

/* Processing indicator */
[dir="rtl"] .dataTables_wrapper .dataTables_processing {
    text-align: center;
}

/* Table header row text-start fix - in Bootstrap 5 RTL this should be right */
[dir="rtl"] .dataTable thead tr.text-start th {
    text-align: right !important;
}

/* Table scrolling wrapper */
[dir="rtl"] .dataTables_scrollBody {
    direction: rtl;
}
