.form-label {
    display: inline-flex;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-dark-primary);
    margin-bottom: var(--spacing-xs);
}

.form-control,
.form-select,
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
textarea {
    width: 100%;
    background: var(--card-content);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-md);
    line-height: 1.4;
    transition: var(--transition-base);
    box-shadow: none;
}

.form-control::placeholder,
.form-select::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
    outline: none;
}

.form-select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #212529 50%), linear-gradient(135deg, #212529 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(50% - 2px), calc(100% - 14px) calc(50% - 2px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: var(--spacing-xl);
    color: #212529;
}

.form-select option {
    color: #212529;
    background: #ffffff;
}

.input-group {
    display: flex;
    width: 100%;
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    background: var(--card-content);
    overflow: hidden;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-group .form-control {
    border: none;
    background: transparent;
    box-shadow: none;
    color: #212529;
}

.input-group .form-control::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.input-group .form-control:focus {
    box-shadow: none;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: transparent;
    color: var(--primary);
}

.input-addon {
    color: var(--primary);
}

.input-group-lg .form-control,
.input-group-lg .input-group-text {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--text-md);
}

.filter-input {
    background: #ffffff !important;
    border: 1px solid #ced4da !important;
    color: #212529 !important;
}

.filter-input::placeholder {
    color: #6c757d !important;
}

.filter-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(12, 100, 117, 0.2) !important;
}

/* Fix form controls in filter card */
.filter-card .form-control,
.filter-card .form-select,
.filter-card input,
.filter-card select {
    background: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

.filter-card .form-control::placeholder,
.filter-card input::placeholder {
    color: #6c757d !important;
}

.filter-card .form-label {
    color: #212529 !important;
    font-weight: 500;
}

.search-hero .form-control {
    font-size: var(--text-md);
}

.form-helper {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.input-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--alert-danger);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.02em;
    text-transform: none;
    border: 1px solid transparent;
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: var(--primary-soft-border);
}

.badge-success {
    background: var(--alert-success);
    color: var(--success);
    border-color: var(--alert-success-border);
}

.badge-warning {
    background: var(--alert-warning);
    color: var(--warning);
    border-color: var(--alert-warning-border);
}

.badge-danger {
    background: var(--alert-danger);
    color: var(--error);
    border-color: var(--alert-danger-border);
}

.badge-muted {
    background: var(--bg-light);
    color: var(--text-muted);
    border-color: var(--border-light);
}

.badge-outline {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-main);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
    background: var(--card-content);
    color: var(--primary);
}

.alert-info {
    background: var(--alert-info);
    border-color: var(--alert-info-border);
    color: var(--primary-dark);
}

.alert-success {
    background: var(--alert-success);
    border-color: var(--alert-success-border);
    color: var(--success);
}

.alert-warning {
    background: var(--alert-warning);
    border-color: var(--alert-warning-border);
    color: var(--warning);
}

.alert-danger {
    background: var(--alert-danger);
    border-color: var(--alert-danger-border);
    color: var(--error);
}

.alert .btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.alert .btn-close:hover {
    color: var(--text-main);
}
/* ============================================
   PangeaGTM Design System V5.4
   Django Design Guidelines V5.4
   ============================================ */

/* ============================================
   ROOT VARIABLES - Dark Theme (Default)
   ============================================ */
:root,
body[data-theme="dark"],
body[data-theme="pangeagtm"] {
    /* Main Background (Dark Teal) */
    --streamlit-background-color: #0C6475;
    --bg-gradient-primary: linear-gradient(135deg, #194652 0%, #2c5a66 50%, #194652 100%);
    --bg-gradient-secondary: linear-gradient(135deg, #2c5a66 0%, #194652 100%);

    /* Primary Accent - PangeaGTM Teal */
    --primary: #0C6475;
    --primary-dark: #194652;
    --primary-light: #107C92;
    --primary-hover: #005f8a;
    --primary-hover-light: #75DDF1;

    /* Text Colors */
    --streamlit-text-color: #FFFFFF;
    --text-light-primary: #FFFFFF;
    --text-light-secondary: rgba(255, 255, 255, 0.8);
    --text-light-tertiary: rgba(255, 255, 255, 0.6);
    --text-light-disabled: rgba(255, 255, 255, 0.4);
    --text-accent: #00C0C0;
    --text-link: #007BFF;
    --text-main: var(--text-light-primary);
    --text-muted: rgba(255, 255, 255, 0.7);
    --text-dark-primary: #222;

    /* List Background Color */
    --list-bg: #194652;
    --list-font-color: #ffffff;

    /* Sidebar & Dark Surfaces */
    --sidebar-bg: #3B4555;
    --dark-surface: #2c3e50;

    /* Card Backgrounds */
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-bg-hover: rgba(255, 255, 255, 0.15);
    --card-content: rgba(255, 255, 255, 0.95);

    /* Input Fields */
    --input-background: #0e6f82;
    --input-background-alt: #262730;

    /* Tabs */
    --active-tab-background: #FFFFFF;
    --active-tab-text: #262730;

    /* Status Colors */
    --success: #28a745;
    --success-bg: rgba(0, 255, 127, 0.2);
    --success-light: #00ff7f;
    --warning: #ffc107;
    --warning-bg: rgba(255, 165, 0, 0.2);
    --warning-light: #ffa500;
    --error: #dc3545;
    --error-bg: rgba(255, 107, 107, 0.2);
    --error-light: #ff6b6b;
    --info: #6c757d;
    --info-bg: rgba(218, 112, 214, 0.2);
    --info-light: #da70d6;
    --primary-soft: rgba(0, 168, 204, 0.15);
    --primary-soft-border: rgba(0, 168, 204, 0.35);
    --focus-ring: rgba(0, 168, 204, 0.35);
    --alert-info: rgba(0, 168, 204, 0.18);
    --alert-success: rgba(40, 167, 69, 0.18);
    --alert-warning: rgba(255, 193, 7, 0.22);
    --alert-danger: rgba(220, 53, 69, 0.2);
    --alert-info-border: rgba(0, 168, 204, 0.45);
    --alert-success-border: rgba(40, 167, 69, 0.4);
    --alert-warning-border: rgba(255, 193, 7, 0.45);
    --alert-danger-border: rgba(220, 53, 69, 0.45);

    /* Borders & Dividers */
    --border-light: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.15);
    --border-dark: rgba(255, 255, 255, 0.2);
    --border-solid: #e9ecef;

    /* Background Neutrals */
    --bg-light: rgba(255, 255, 255, 0.1);
    --bg-medium: rgba(255, 255, 255, 0.15);
    --bg-dark: #0C6475;
}

/* ============================================
   LIGHT THEME (DJ-R01.1 - BLACK text on light)
   ============================================ */
body[data-theme="light"] {
    /* Main Background (Light) */
    --streamlit-background-color: #ffffff;
    --bg-gradient-primary: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 50%, #f5f7fa 100%);
    --bg-gradient-secondary: linear-gradient(135deg, #e9ecef 0%, #f5f7fa 100%);

    /* Text Colors - BLACK on LIGHT BACKGROUNDS (MANDATORY) */
    --streamlit-text-color: #212529;
    --text-light-primary: #212529;
    --text-light-secondary: rgba(0, 0, 0, 0.7);
    --text-light-tertiary: rgba(0, 0, 0, 0.5);
    --text-light-disabled: rgba(0, 0, 0, 0.4);
    --text-accent: #0077b6;
    --text-link: #007BFF;
    --text-main: #212529;
    --text-muted: rgba(0, 0, 0, 0.6);

    /* List Background Color */
    --list-bg: #ffffff;
    --list-font-color: #212529;

    /* Sidebar & Light Surfaces */
    --sidebar-bg: #ffffff;
    --dark-surface: #f8f9fa;

    /* Card Backgrounds - 5% black overlay */
    --card-bg: rgba(0, 0, 0, 0.05);
    --card-bg-hover: rgba(0, 0, 0, 0.1);
    --card-content: #ffffff;

    /* Input Fields */
    --input-background: #f8f9fa;
    --input-background-alt: #e9ecef;

    /* Borders & Dividers - Black opacity */
    --border-light: rgba(0, 0, 0, 0.1);
    --border-medium: rgba(0, 0, 0, 0.15);
    --border-dark: rgba(0, 0, 0, 0.2);

    /* Background Neutrals */
    --bg-light: rgba(0, 0, 0, 0.05);
    --bg-medium: rgba(0, 0, 0, 0.1);
}

/* ============================================
   PangeaGTM Theme Specific
   ============================================ */
body[data-theme="pangeagtm"] {
    --card-bg: rgba(0, 192, 192, 0.1);
    --card-bg-hover: rgba(0, 192, 192, 0.15);
}

/* ============================================
   SPACING SYSTEM (8px baseline)
   ============================================ */
:root {
    --content-max-width: 1100px;
    --content-medium-width: 840px;
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Semantic Spacing */
    --padding-xs: var(--space-2);
    --padding-sm: var(--space-3);
    --padding-md: var(--space-4);
    --padding-lg: var(--space-6);
    --padding-xl: var(--space-8);
    --padding-2xl: var(--space-10);

    --margin-xs: var(--space-2);
    --margin-sm: var(--space-3);
    --margin-md: var(--space-4);
    --margin-lg: var(--space-6);
    --margin-xl: var(--space-8);
    --margin-2xl: var(--space-10);

    --gap-xs: var(--space-2);
    --gap-sm: var(--space-3);
    --gap-md: var(--space-4);
    --gap-lg: var(--space-6);
    --gap-xl: var(--space-8);

    /* V5.4 Spacing Variables (Aliases for consistency) */
    --spacing-xs: var(--space-2);
    --spacing-sm: var(--space-3);
    --spacing-md: var(--space-4);
    --spacing-lg: var(--space-6);
    --spacing-xl: var(--space-8);
    --spacing-2xl: var(--space-10);
    --spacing-3xl: var(--space-12);
    --spacing-4xl: var(--space-16);
    --navbar-height: 64px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
:root {
    /* Font Family */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Font Sizes */
    --font-display: 48px;
    --font-h1: 36px;
    --font-h2: 30px;
    --font-h3: 24px;
    --font-h4: 20px;
    --font-body-xl: 18px;
    --font-body-lg: 16px;
    --font-body: 15px;
    --font-body-sm: 14px;
    --font-body-xs: 12px;
    --font-body-2xs: 11px;
    --font-caption: 12px;
    --font-label: 14px;
    --text-3xl: var(--font-display);
    --text-2xl: var(--font-h1);
    --text-xl: var(--font-h2);
    --text-lg: var(--font-h3);
    --text-md: var(--font-body);
    --text-sm: var(--font-body-sm);
    --text-xs: var(--font-body-xs);

    /* Font Weights */
    --weight-light: 300;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-extrabold: 800;

    /* Line Heights */
    --line-tight: 1.2;
    --line-normal: 1.5;
    --line-relaxed: 1.7;
    --line-loose: 2.0;
}

/* ============================================
   BORDER RADIUS
   ============================================ */
:root {
    --radius-none: 0;
    --radius-sm: 3px;
    --radius-md: 5px;
    --radius-lg: 6px;
    --radius-xl: 10px;
    --radius-2xl: 15px;
    --radius-round: 50%;
    --radius-pill: 999px;
}

/* ============================================
   SHADOWS
   ============================================ */
:root {
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.2);
    --shadow-2xl: 0 16px 48px rgba(0, 0, 0, 0.25);
    --shadow-accent: 0 4px 16px rgba(0, 168, 204, 0.3);
    --shadow-accent-lg: 0 8px 24px rgba(0, 168, 204, 0.4);
}

/* ============================================
   TRANSITIONS & ANIMATIONS
   ============================================ */
:root {
    --transition-fast: all 0.15s ease;
    --transition-base: all 0.3s ease;
    --transition-slow: all 0.5s ease;
    --transition-transform: transform 0.3s ease;
    --transition-opacity: opacity 0.3s ease;
    --transition-colors: background-color 0.3s ease, color 0.3s ease;
    --transition-shadow: box-shadow 0.3s ease;
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    box-sizing: border-box;
}

/* Reset html and body margins to prevent any browser defaults */
html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-md);
    line-height: var(--line-normal);
    color: var(--text-main);
    display: flex;
    background-color: #f8f9fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.text-center {
    text-align: center;
}

.text-light {
    color: var(--text-light-primary) !important;
}

.fw-bold {
    font-weight: var(--weight-bold) !important;
}

.opacity-75 {
    opacity: 0.75;
}

.me-1 {
    margin-right: var(--spacing-sm) !important;
}

.me-2 {
    margin-right: var(--spacing-md) !important;
}

.ms-2 {
    margin-left: var(--spacing-md) !important;
}

.mt-sm { margin-top: var(--spacing-sm) !important; }
.mt-md { margin-top: var(--spacing-md) !important; }
.mt-lg { margin-top: var(--spacing-lg) !important; }
.mt-xl { margin-top: var(--spacing-xl) !important; }
.mb-sm { margin-bottom: var(--spacing-sm) !important; }
.mb-md { margin-bottom: var(--spacing-md) !important; }
.mb-lg { margin-bottom: var(--spacing-lg) !important; }
.mb-xl { margin-bottom: var(--spacing-xl) !important; }

.grid-span-full {
    grid-column: 1 / -1;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

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

section,
.section {
    padding: var(--spacing-2xl) 0;
}

.section-sm {
    padding: var(--spacing-xl) 0;
}

.section-lg {
    padding: var(--spacing-3xl) 0;
}

.section-muted {
    background: var(--bg-light);
}

.section-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
    color: var(--text-dark-primary, #222);
}

.section-content--narrow {
    max-width: var(--content-medium-width);
    margin: 0 auto;
}

.hero-section h1,
.hero-section p,
.hero-section a,
.hero-section span {
    color: var(--text-light-primary);
}


/* Override hero-section link color for buttons that need visible text */
.hero-section .btn-light {
    color: var(--primary) !important;
}

.hero-section .btn-light:hover {
    color: #ffffff !important;
}



h1,
h2,
h3,
h4 {
    font-weight: var(--weight-bold);
    line-height: var(--line-tight);
    color: var(--text-main);
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

p,
li,
span {
    font-size: var(--text-md);
    line-height: var(--line-normal);
}

small {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
    display: flex;
    min-height: 100vh;
    background: transparent;
}

/* ============================================
   SIDEBAR (DJ-R02.1)
   ============================================ */
.sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    background: var(--sidebar-bg);
    padding: var(--padding-lg) 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
    transition: var(--transition-base);
}

.sidebar.collapsed {
    width: 60px;
    padding: var(--padding-md) 0;
    overflow-x: hidden;
}

/* Sidebar Toggle/Pin Button - DJ-R02.1 Best Practices */
.sidebar-toggle {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: var(--space-8);
    height: var(--space-8);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-toggle.pinned {
    background: transparent;
    color: #ffffff;
}

.sidebar-toggle.pinned:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Light Theme Sidebar Toggle */
body[data-theme="light"] .sidebar-toggle {
    color: rgba(0, 0, 0, 0.6);
}

body[data-theme="light"] .sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #000000;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    margin-top: var(--space-8);
}

.sidebar.collapsed .sidebar-content {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    flex: 1;
    min-width: 0;
}

.logo-title {
    color: var(--text-light-primary);
    font-size: var(--text-md);
    font-weight: 700;
    margin: 0;
    line-height: var(--line-tight);
}

.logo-subtitle {
    color: var(--text-light-secondary);
    font-size: var(--text-sm);
    display: block;
    margin-top: calc(var(--space-1) / 2);
}

.logo-version-line {
    height: 2px;
    background: var(--primary-light);
    margin: var(--space-2) 0;
    width: 100%;
}

.logo-version {
    color: var(--text-light-tertiary);
    font-size: var(--text-xs);
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .logo-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

/* Light Theme Logo */
body[data-theme="light"] .logo-title {
    color: #212529 !important;
}

body[data-theme="light"] .logo-subtitle {
    color: rgba(0, 0, 0, 0.7) !important;
}

body[data-theme="light"] .logo-version {
    color: rgba(0, 0, 0, 0.6) !important;
}

body[data-theme="light"] .logo-img {
    filter: brightness(0) saturate(100%);
}

/* Navigation Section */
.nav-section {
    padding: var(--space-4) 0;
}

.nav-title {
    color: var(--text-light-tertiary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.sidebar.collapsed .nav-title {
    display: none;
}

/* Navigation Items - DJ-R02.1.3 */
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-icon {
    width: var(--space-5);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    min-width: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-item:hover .nav-icon {
    color: #ffffff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left-color: #ffffff;
}

.nav-item.active .nav-icon {
    color: #ffffff;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--spacing-sm);
}

.sidebar.collapsed .nav-item .nav-text {
    display: none;
}

.sidebar.collapsed .nav-item .nav-icon {
    margin-right: 0;
    font-size: var(--text-lg);
}

/* Light Theme Navigation */
body[data-theme="light"] .nav-item {
    color: rgba(0, 0, 0, 0.6);
}

body[data-theme="light"] .nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .nav-item .nav-icon,
body[data-theme="light"] .nav-item:hover .nav-icon,
body[data-theme="light"] .nav-item.active .nav-icon {
    color: #212529 !important;
}

body[data-theme="light"] .nav-title {
    color: rgba(0, 0, 0, 0.5);
}

/* Navigation Bottom (User Selector) */
.nav-bottom {
    margin-top: auto;
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.user-selector {
    cursor: pointer;
    padding: var(--spacing-md);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: var(--transition-base);
}

.user-avatar {
    width: var(--space-10);
    height: var(--space-10);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light-primary);
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: var(--text-light-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-subtitle {
    color: var(--text-light-secondary);
    font-size: var(--text-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    padding: var(--spacing-xl);
    padding-top: 0; /* FIXES THE WHITE GAP */
    overflow-y: auto;
    background: var(--card-content);
    transition: var(--transition-base);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.main-content.has-top-padding {
    padding-top: var(--spacing-xl);
}

.messages-container {
    padding: var(--spacing-lg);
    max-width: 1400px;
    margin: 0 auto var(--spacing-lg);
}

.sidebar.collapsed ~ .main-wrapper .main-content {
    flex: 1;
    padding: var(--spacing-xl);
    padding-top: 0;
    overflow-y: auto;
    background: var(--card-content);
    transition: var(--transition-base);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--card-content);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    overflow: hidden;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.card:hover {
    background: var(--card-bg-hover);
    transform: translateY(calc(var(--spacing-sm) * -0.2));
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--padding-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    color: var(--text-main);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    margin: 0;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: var(--space-1) 0 0 0;
}

.card-body {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    line-height: 1.2;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--text-md);
}

.btn:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-light-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-accent);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--bg-light);
    border-color: var(--border-light);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-medium);
}

.btn-dark {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-light-primary);
    box-shadow: var(--shadow-sm);
}

.btn-dark:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
}

.btn-light {
    background: var(--card-content);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-light:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-outline-primary {
    background: #ffffff !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
}

.btn-outline-primary i,
.btn-outline-primary .fas,
.btn-outline-primary .fa {
    color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background: var(--primary-light) !important;
    color: #ffffff !important;
    border-color: var(--primary-light) !important;
}

.btn-outline-primary:hover i,
.btn-outline-primary:hover .fas,
.btn-outline-primary:hover .fa {
    color: #ffffff !important;
}

.btn-outline-primary.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary.active i,
.btn-outline-primary.active .fas,
.btn-outline-primary.active .fa {
    color: #ffffff !important;
}

/* View toggle button group */
.btn-group .btn-outline-primary {
    padding: 0.5rem 0.75rem;
}

.btn-group .btn-outline-primary i {
    font-size: 1rem;
}

.btn-outline-secondary {
    background: #ffffff !important;
    color: #6c757d !important;
    border: 2px solid #6c757d !important;
}

.btn-outline-secondary i {
    color: #6c757d !important;
}

.btn-outline-secondary:hover {
    background: #6c757d !important;
    color: #ffffff !important;
}

.btn-outline-secondary:hover i {
    color: #ffffff !important;
}

.btn-outline-light {
    background: transparent;
    color: var(--text-light-primary);
    border-color: rgba(255, 255, 255, 0.4);
}

body[data-theme="light"] .btn-outline-light {
    color: var(--text-main);
    border-color: var(--border-light);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-main);
    background: var(--bg-light);
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--primary);
    padding-inline: 0;
    box-shadow: none;
}

.btn-link:hover {
    color: var(--primary-light);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

.btn-icon {
    width: var(--space-10);
    height: var(--space-10);
    padding: 0;
    border-radius: var(--radius-round);
}

.btn-group {
    display: inline-flex;
    gap: var(--spacing-sm);
}

.btn-group .btn {
    border-radius: var(--radius-md);
}

/* ============================================
   BOOTSTRAP OVERRIDES
   ============================================ */
.bg-primary {
    background-color: var(--primary) !important;
}

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

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

.bg-danger {
    background-color: var(--error) !important;
}

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

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover-light) !important;
    border-color: var(--primary-hover-light) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* Pagination */
.pagination {
    display: inline-flex;
    list-style: none;
    gap: var(--spacing-sm);
    padding: 0;
    margin: 0;
}

.pagination .page-item {
    display: flex;
}

.pagination .page-link,
.pagination .page-item span {
    min-width: 2.5rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
    background: var(--card-content);
    color: var(--primary);
    text-align: center;
    font-weight: var(--weight-semibold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    text-decoration: none;
    transition: var(--transition-base);
}

.pagination .page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-light-primary);
    box-shadow: var(--shadow-sm);
}

.pagination .page-item.disabled .page-link,
.pagination .page-item.disabled span {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   LIST CONTAINER
   ============================================ */
.list-container {
    background: var(--list-bg);
    color: var(--list-font-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.list-header {
    background: rgba(255, 255, 255, 0.1);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.list-title {
    color: var(--text-dark-primary, #222);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    margin: 0;
}

.list-subtitle {
    color: var(--text-dark-primary);
    margin: var(--space-1) 0 0 0;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-value {
    color: var(--text-dark-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-dark-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   RESPONSIVE DESIGN (DJ-R08)
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        z-index: 1000;
    }

    .sidebar.collapsed {
        left: -60px;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        flex: 1;
        padding: var(--padding-2xl);
        overflow-y: auto;
        background: #ffffff;
        transition: var(--transition-base);
        max-width: 1100px;
        margin: 0 auto;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

/* Main Wrapper */
.main-wrapper {
    /* margin-left removed - body is flex, sidebar takes its own space */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* Navbar */
.navbar {
    height: 64px;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    position: relative;
    z-index: 999;
}

.navbar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-link {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    transition: opacity 0.2s;
}

.navbar-link:hover {
    opacity: 0.8;
}

.navbar-menu {
    display: flex;
    align-items: center;
}

.navbar-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.navbar-item {
    margin: 0;
}
/* Responsive Design - sidebar stays 240px until mobile breakpoint */
/* Mobile breakpoint (768px) handles sidebar hiding via DJ-R08 rules above */
/* ============================================
   PROPERTIES GRID (V5.4 Responsive Grid)
   ============================================ */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

@media (min-width: 576px) {
    .properties-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (min-width: 992px) {
    .properties-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

/* ============================================
   PROPERTIES LIST VIEW (V5.4)
   ============================================ */
.properties-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.properties-list .property-card {
    display: flex;
    flex-direction: row;
    max-width: 100%;
}

.properties-list .property-image {
    width: 200px;
    min-width: 200px;
    height: 150px;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.properties-list .property-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.properties-list .property-footer {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    border-left: 1px solid var(--border-light);
    min-width: 120px;
}

@media (max-width: 768px) {
    .properties-list .property-card {
        flex-direction: column;
    }
    
    .properties-list .property-image {
        width: 100%;
        height: 180px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .properties-list .property-footer {
        border-left: none;
        border-top: 1px solid var(--border-light);
    }
}

/* ============================================
   PROPERTY CARD (V5.4 Structure)
   ============================================ */
.property-card {
    display: block;
    height: auto;       /* just in case */
    align-self: start;  /* prevents grid stretching */
    background: var(--card-bg, rgba(255,255,255,0.02));
    border-radius: var(--radius-lg, 8px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--transition-fast), box-shadow 0.2s var(--transition-fast);
    /* Removed accidental global light-text inside property-card; card internals use dark token */
    text-decoration: none;
    border: 1px solid var(--border-light);
}

.property-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.property-link {
    display: block;
    text-decoration: none;
    color: var(--text-dark-primary);
}

.property-image {
    /* Set consistent image aspect ratio */
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: cover;
    background-size: cover;
    background-position: center;
    background-color: var(--primary);
    background-image: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-dark-primary);
    font-size: var(--text-3xl);
    text-align: center;
    line-height: 1;
}

.property-image i {
    opacity: 0.7;
    display: inline-block;
    vertical-align: middle;
}

.property-body {
    padding: var(--spacing-md);
    display: block;
    color: var(--text-dark-primary);
}

.property-title {
    font-size: var(--text-lg);
    margin: 0;
    color: var(--text-dark-primary);
    font-weight: var(--weight-semibold);
    line-height: var(--line-tight);
}

.property-meta {
    display: block;
    color: var(--text-dark-primary);
}

.property-meta span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-dark-primary);
}

.rental-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-dark-primary);
}

.property-location {
    font-size: var(--text-sm);
    color: var(--text-dark-primary);
}

.property-price {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--primary);
    white-space: nowrap;
}

.property-features {
    margin: 0;
    padding: 0;
    list-style: none;
}

.property-features li {
    margin-bottom: 0.25rem;
    color: var(--text-dark-primary);
}

.property-features i {
    color: var(--text-dark-primary);
    font-size: var(--text-sm);
}

.property-amenities {
    display: block;
    color: var(--text-dark-primary);
}

.amenity-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-light, rgba(0, 0, 0, 0.05));
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-dark-primary);
    white-space: nowrap;
}

.property-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-light);
    margin-top: auto;   /* optional; safe now because link is not flex */
    color: var(--text-dark-primary);
}

.property-footer time {
    display: block;
    color: var(--text-dark-primary);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-md);
    color: #212529 !important;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-lg);
}

.empty-state h1,
.empty-state h2,
.empty-state h3,
.empty-state h4,
.empty-state h5,
.empty-state p,
.empty-state span,
.empty-state strong {
    color: #212529 !important;
}

.empty-state i {
    color: #6c757d !important;
}

.empty-state .text-muted {
    color: #6c757d !important;
}

/* Filter elements - ensure dark text */
.filter-card,
.filter-panel,
.filter-group {
    color: var(--text-dark-primary);
}

.filter-card h5,
.filter-card h4,
.filter-card h3,
.filter-card h2,
.filter-card h1,
.filter-card label,
.filter-card .form-label,
.filter-card span,
.filter-card strong,
.filter-panel h5,
.filter-panel h4,
.filter-panel h3,
.filter-panel h2,
.filter-panel h1,
.filter-panel label,
.filter-panel .form-label,
.filter-panel span,
.filter-panel strong,
.filter-group h5,
.filter-group h4,
.filter-group h3,
.filter-group h2,
.filter-group h1,
.filter-group label,
.filter-group .form-label,
.filter-group span,
.filter-group strong {
    color: var(--text-dark-primary);
}

/* Rentals page headings */
.rentals-header h2,
.rentals-header h3,
.rentals-header h4 {
    color: var(--text-dark-primary);
}

/* PROPERTIES GRID + CARD (safety overrides) */
.property-card .property-price {
    /* keep price accented */
    color: var(--primary) !important;
    font-weight: 700;
}

/* Light Theme Property Cards */
body[data-theme="light"] .property-card {
    background: var(--card-bg, rgba(0, 0, 0, 0.05));
    /* Color already set in base .property-card rules */
}

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

body[data-theme="light"] .amenity-badge {
    background: var(--bg-light);
    color: var(--text-dark-primary);
}

/* ============================================
   RENTALS GRID (V5.4 Responsive Grid)
   ============================================ */
.rentals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (min-width: 576px) {
    .rentals-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (min-width: 992px) {
    .rentals-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

/* ============================================
   RENTAL CARD (V5.4 Structure)
   ============================================ */
.rental-card {
    background-color: var(--card-content, #ffffff);
    color: var(--text-dark-primary);
    border-radius: var(--radius-lg, 8px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-light);
}

body[data-theme="dark"] .rental-card,
body[data-theme="pangeagtm"] .rental-card {
    background-color: var(--card-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-light-primary);
}

body[data-theme="light"] .rental-card {
    background-color: var(--card-content, #ffffff);
    color: var(--text-light-primary, #212529);
}

.rental-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.rental-link {
    display: block;
    color: var(--text-dark-primary);
    text-decoration: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.rental-image {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    background-color: var(--primary);
    background-image: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark-primary);
    font-size: var(--text-3xl);
}

.rental-image i {
    opacity: 0.7;
}

.rental-body {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
    color: var(--text-dark-primary);
}

.rental-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin: 0 0 0.25rem 0;
    color: var(--text-dark-primary);
    line-height: var(--line-tight);
}

body[data-theme="light"] .rental-title {
    color: var(--text-light-primary, #212529);
}

.rental-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dark-primary);
    font-weight: var(--weight-medium);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.rental-location {
    font-size: var(--text-sm);
    color: var(--text-dark-primary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

body[data-theme="light"] .rental-location {
    color: var(--text-light-secondary, rgba(0, 0, 0, 0.7));
}

.rental-price {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--primary);
    white-space: nowrap;
}

.rental-features {
    list-style: none;
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    color: var(--text-dark-primary);
    font-size: var(--text-sm);
}

body[data-theme="light"] .rental-features {
    color: var(--text-light-secondary, rgba(0, 0, 0, 0.7));
}

.rental-features li {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.rental-features i {
    color: var(--text-dark-primary);
    font-size: var(--text-sm);
}

body[data-theme="light"] .rental-features i {
    color: var(--text-light-tertiary, rgba(0, 0, 0, 0.5));
}

.rental-footer {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border-light);
    color: var(--text-dark-primary);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

body[data-theme="light"] .rental-footer {
    border-top-color: var(--border-light, rgba(0, 0, 0, 0.1));
    color: var(--text-light-tertiary, rgba(0, 0, 0, 0.5));
}

.rental-footer time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-dark-primary);
}

.rental-source {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-xs);
    color: var(--text-dark-primary);
}

/* ============================================
   STATS GRID (V5.4 Responsive Grid)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* ============================================
   CARDS GRID (V5.4 Responsive Grid)
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (min-width: 576px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (min-width: 992px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

/* ============================================
   FEATURE GRID (V5.4 Responsive Grid)
   ============================================ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (min-width: 768px) {
    .feature-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* ============================================
   TWO COLUMN GRID (V5.4 Layout)
   ============================================ */
.two-column-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

@media (min-width: 992px) {
    .two-column-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* ---- HERO SECTION COMPLETE FIX ---- */
.hero-section {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-light-primary);
    padding-top: 120px;
    padding-bottom: var(--spacing-2xl);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.08)"/></svg>');
    opacity: 0.25;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

@media (min-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-start;
    flex-wrap: wrap;
}

.stats-section {
    background: var(--card-content);
    padding: var(--spacing-2xl) 0;
    position: relative;
    color: var(--text-dark-primary);
}

/* Statistics Headers */
.stats-header h1,
.stats-header h2,
.stats-header h3 {
    color: var(--text-dark-primary);
}

/* Statistics Icons */
.stats-header i,
.stats-header svg,
.stats-header svg path {
    fill: var(--text-dark-primary);
    stroke: var(--text-dark-primary);
    color: var(--text-dark-primary);
}

.stat-icon,
.stat-icon svg,
.stat-icon svg path {
    fill: var(--text-dark-primary);
    stroke: var(--text-dark-primary);
    color: var(--text-dark-primary);
}

.market-icon,
.market-icon svg,
.market-icon svg path {
    fill: var(--text-dark-primary);
    stroke: var(--text-dark-primary);
    color: var(--text-dark-primary);
}

/* Statistics Section Icons */
.stats-section i,
.stats-section svg,
.stats-section svg path,
.stats-card i,
.stats-card svg,
.stats-card svg path,
.stat-card i,
.stat-card svg,
.stat-card svg path {
    fill: var(--text-dark-primary);
    stroke: var(--text-dark-primary);
    color: var(--text-dark-primary);
}

.market-overview i,
.market-overview svg,
.market-overview svg path,
.market-insights i,
.market-insights svg,
.market-insights svg path,
.data-sources i,
.data-sources svg,
.data-sources svg path {
    fill: var(--text-dark-primary);
    stroke: var(--text-dark-primary);
    color: var(--text-dark-primary);
}

.stats-section h2,
.stats-section h3,
.stats-section h4 {
    color: var(--text-dark-primary);
}

/* Statistics Cards */
.stats-card {
    color: var(--text-dark-primary);
}

/* Statistics Values and Labels */
.stat {
    color: var(--text-dark-primary);
}

.stat-value {
    color: var(--text-dark-primary);
}

.stat-header {
    color: var(--text-dark-primary);
}

/* Market and Data Sections */
.market-overview {
    color: var(--text-dark-primary);
}

.market-insights {
    color: var(--text-dark-primary);
}

.data-sources {
    color: var(--text-dark-primary);
}

/* Loading Text */
[class*="loading"],
.loading-statistics,
.loading-stats,
.loading-state {
    color: var(--text-dark-primary);
}

/* "Loading statistics..." text */
.loading-state p,
.loading-state .text-muted {
    color: var(--text-dark-primary) !important;
}

/* "Last updated: Loading..." text */
#last-updated {
    color: var(--text-dark-primary) !important;
}

/* Override text-muted in stats sections for loading text */
.stats-section .text-muted,
.stats-card .text-muted,
.stat-card .text-muted {
    color: var(--text-dark-primary) !important;
}

/* Data Badges in Stats Context */
.stats-section .badge,
.stats-card .badge,
.stat-card .badge,
.market-overview .badge,
.market-insights .badge,
.data-sources .badge {
    color: var(--text-dark-primary);
}

/* Statistics page specific wrappers */
#statistics-page,
.statistics-wrapper,
.market-stats,
.stats-section,
.stats-card,
.section-title,
.section-header,
.section-content,
.page-content {
    color: var(--text-dark-primary) !important;
}

#statistics-page h1,
#statistics-page h2,
#statistics-page h3,
#statistics-page h4,
#statistics-page h5,
#statistics-page p,
#statistics-page span,
#statistics-page strong {
    color: var(--text-dark-primary) !important;
    fill: var(--text-dark-primary) !important;
}

#statistics-page i,
#statistics-page svg,
#statistics-page svg path {
    color: var(--text-dark-primary) !important;
    fill: var(--text-dark-primary) !important;
    stroke: var(--text-dark-primary) !important;
}

#statistics-page .text-light,
#statistics-page .text-muted {
    color: var(--text-dark-primary) !important;
}


/* CTA SECTION FIX */
.cta-section,
.cta-section *,
.cta-section h2,
.cta-section p,
.cta-section a {
    color: var(--text-dark-primary, #222) !important;

}

/* ============================================
   PAGE HEADER (V5.4 Layout)
   ============================================ */
.page-header {
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-lg);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-main);
    margin: 0;
}

.hero-location {
    font: inherit;
    color: inherit;
}

/* FORCE NON-HERO SECTIONS TO DARK TEXT */
.section *,
.features-section *,
.features-grid *,
.feature-card *,
.stats-section *,
.stats-card * {
    color: var(--text-dark-primary, #222) !important;
}

.section,
.features-section,
.features-grid,
.feature-card,
.stats-section,
.stats-card,
.section h2,
.section h3,
.section p,
.features-section h2,
.features-section p {
    color: var(--text-dark-primary, #222);
}


/* CTA FORCE DARK TEXT */
.cta-section,
.cta-section *,
.cta-section h2,
.cta-section p,
.cta-section a,
.cta-section span {
    color: var(--text-dark-primary, #222) !important;
}


#statistics-page,
#statistics-page * {
    color: var(--text-dark-primary) !important;
    fill: var(--text-dark-primary) !important;
    stroke: var(--text-dark-primary) !important;
}


/* Force dark text for light buttons ONLY inside the statistics page */
#statistics-page .btn-light,
#statistics-page .btn-light *,
#statistics-page .btn-outline-light,
#statistics-page .btn-outline-light * {
    color: var(--text-dark-primary) !important;
}

#statistics-page .btn-outline-light {
    border-color: var(--text-dark-primary) !important;
}

/* Force entire statistics view to use dark text */
.page-content:has(#statistics-page),
.page-content:has(#statistics-page) * {
    color: var(--text-dark-primary) !important;
    fill: var(--text-dark-primary) !important;
    stroke: var(--text-dark-primary) !important;
}

.progress {
    height: 6px;
    background: #e6e6e6;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: var(--primary);
    height: 100%;
}

.stats-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 20px;
}

.section-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 600;
}


/* Fix: prevent padding stacking inside stats sections */
.stats-container .section-sm {
    padding: 0 !important;
}


.analytics-grid,
.amenities-analytics-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin-top: 20px;
}

.chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
