/* PropSpectra Theme System - Light/Dark Mode Support */

/* Light Mode (Default) */
:root,
html[data-theme="light"] {
    --ps-bg: #f7f8fb;
    --ps-surface: #ffffff;
    --ps-surface-2: #f1f3f8;
    --ps-border: rgba(15, 23, 42, 0.08);
    --ps-text: #0f172a;
    --ps-text-muted: #667085;
    --ps-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
    --ps-radius: 14px;
    --ps-primary: #143364;
    --ps-primary-contrast: #ffffff;
    --ps-brand-blue-1: #143364;
    --ps-brand-blue-2: #191E2E;
    --ps-hover-bg: rgba(20, 51, 100, 0.06);
    --ps-gold: #f59e0b;
    --ps-orange: #fb923c;
}

/* Dark Mode - Navy/Blue Palette with High Contrast Text */
html[data-bs-theme="dark"],
html[data-theme="dark"] {
    /* NAVY BACKGROUNDS */
    --ps-bg: #070b14;
    --ps-surface: #0b1220;
    --ps-surface-2: #0f1a33;
    --ps-surface-3: #13224a;

    /* HIGH CONTRAST TEXT */
    --ps-text: #eaf0ff;
    --ps-text-muted: #b7c3eb;
    --ps-heading: #ffffff;
    --ps-link: #8fb3ff;

    /* BORDERS + HOVERS */
    --ps-border: rgba(99, 141, 255, 0.18);
    --ps-hover: rgba(99, 141, 255, 0.12);
    --ps-hover-bg: rgba(99, 141, 255, 0.12);

    /* BRAND COLORS */
    --ps-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --ps-radius: 14px;
    --ps-primary: #60a5fa;
    --ps-primary-contrast: #ffffff;
    --ps-brand-blue-1: #60a5fa;
    --ps-brand-blue-2: #3b82f6;
    --ps-gold: #fbbf24;
    --ps-orange: #fdba74;

    /* BOOTSTRAP VARIABLE OVERRIDES */
    --bs-body-bg: var(--ps-bg);
    --bs-body-color: var(--ps-text);
    --bs-card-bg: var(--ps-surface);
    --bs-card-color: var(--ps-text);
    --bs-border-color: var(--ps-border);

    /* Tables */
    --bs-table-bg: var(--ps-surface);
    --bs-table-color: var(--ps-text);
    --bs-table-border-color: rgba(99, 141, 255, 0.15);
    --bs-table-striped-bg: var(--ps-surface-2);
    --bs-table-striped-color: var(--ps-text);
    --bs-table-hover-bg: var(--ps-hover);
    --bs-table-hover-color: #ffffff;

    /* Bootstrap background layers */
    --bs-secondary-bg: var(--ps-surface-2);
    --bs-tertiary-bg: var(--ps-surface-3);

    /* Headings */
    --bs-heading-color: var(--ps-heading);
}

/* Global Body Styles */
body {
    background: var(--ps-bg);
    color: var(--ps-text);
}

/* ================================
   DARK MODE TEXT CONTRAST OVERRIDES
   ================================ */

/* Headings always readable */
html[data-bs-theme="dark"] h1,
html[data-bs-theme="dark"] h2,
html[data-bs-theme="dark"] h3,
html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] h5,
html[data-bs-theme="dark"] h6,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
    color: var(--ps-heading) !important;
}

/* Muted text still readable */
html[data-bs-theme="dark"] .text-muted,
html[data-theme="dark"] .text-muted {
    color: var(--ps-text-muted) !important;
    opacity: 1 !important;
}

/* Paragraphs and small text */
html[data-bs-theme="dark"] p,
html[data-theme="dark"] p,
html[data-bs-theme="dark"] small,
html[data-theme="dark"] small {
    color: var(--ps-text) !important;
}

/* Links */
html[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item),
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item) {
    color: var(--ps-link) !important;
}
html[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover,
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover {
    color: #b7ceff !important;
}

/* Card text */
html[data-bs-theme="dark"] .card-title,
html[data-theme="dark"] .card-title {
    color: var(--ps-heading) !important;
}

html[data-bs-theme="dark"] .card-text,
html[data-theme="dark"] .card-text {
    color: var(--ps-text) !important;
}

/* ================================
   DARK MODE TABLE STYLING
   ================================ */

html[data-bs-theme="dark"] .table thead th,
html[data-theme="dark"] .table thead th {
    background-color: var(--ps-surface-3) !important;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(99, 141, 255, 0.25) !important;
}

html[data-bs-theme="dark"] .table tbody td,
html[data-theme="dark"] .table tbody td,
html[data-bs-theme="dark"] .table tbody th,
html[data-theme="dark"] .table tbody th {
    color: var(--ps-text) !important;
    border-top: 1px solid rgba(99, 141, 255, 0.12) !important;
}

html[data-bs-theme="dark"] .table-hover > tbody > tr:hover > *,
html[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: var(--ps-hover) !important;
    color: #ffffff !important;
}

/* ps-table specific */
html[data-bs-theme="dark"] .ps-table thead th,
html[data-theme="dark"] .ps-table thead th {
    background-color: var(--ps-surface-3) !important;
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .ps-table tbody td,
html[data-theme="dark"] .ps-table tbody td {
    color: var(--ps-text) !important;
}

/* ================================
   DARK MODE FORM CONTROLS
   ================================ */

html[data-bs-theme="dark"] .form-control,
html[data-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
html[data-theme="dark"] .form-select,
html[data-bs-theme="dark"] textarea,
html[data-theme="dark"] textarea {
    background-color: var(--ps-surface-2) !important;
    border-color: var(--ps-border) !important;
    color: var(--ps-text) !important;
}

html[data-bs-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .form-control::placeholder,
html[data-bs-theme="dark"] textarea::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: rgba(183, 195, 235, 0.75) !important;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] textarea:focus,
html[data-theme="dark"] textarea:focus {
    border-color: rgba(99, 141, 255, 0.40) !important;
    box-shadow: 0 0 0 0.2rem rgba(99, 141, 255, 0.15) !important;
}

html[data-bs-theme="dark"] .form-label,
html[data-theme="dark"] .form-label {
    color: var(--ps-text) !important;
}

html[data-bs-theme="dark"] .input-group-text,
html[data-theme="dark"] .input-group-text {
    background-color: var(--ps-surface-3) !important;
    border-color: var(--ps-border) !important;
    color: var(--ps-text) !important;
}

/* ================================
   HERO SECTION - Same in both modes
   ================================ */

.ps-hero-section {
    background: linear-gradient(180deg, #e8f4f8 0%, #f5f9fb 100%) !important;
}

.ps-hero-badge {
    background-color: #1a2e3b !important;
    color: white !important;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.ps-hero-dot {
    color: #4a7cff !important;
}

.ps-hero-heading {
    color: #1a2e3b !important;
}

.ps-hero-heading-accent {
    color: #4a7cff !important;
}

.ps-hero-subtext {
    color: #5a6a7a !important;
}

.ps-hero-input-group {
    background: white !important;
}

.ps-hero-input-icon {
    background: white !important;
}

.ps-hero-input {
    background: white !important;
    color: #1a2e3b !important;
    box-shadow: none !important;
}

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

.ps-hero-btn {
    background-color: #4a7cff !important;
    color: white !important;
    font-weight: 600;
}

.ps-hero-stat {
    color: #5a6a7a !important;
}

.ps-hero-stat-number {
    color: #4a7cff !important;
    font-weight: 600;
}

/* Dark mode - keep hero section the same */
html[data-bs-theme="dark"] .ps-hero-section,
html[data-theme="dark"] .ps-hero-section {
    background: linear-gradient(180deg, #e8f4f8 0%, #f5f9fb 100%) !important;
}

html[data-bs-theme="dark"] .ps-hero-heading,
html[data-theme="dark"] .ps-hero-heading {
    color: #1a2e3b !important;
}

html[data-bs-theme="dark"] .ps-hero-heading-accent,
html[data-theme="dark"] .ps-hero-heading-accent {
    color: #4a7cff !important;
}

html[data-bs-theme="dark"] .ps-hero-subtext,
html[data-theme="dark"] .ps-hero-subtext {
    color: #5a6a7a !important;
}

html[data-bs-theme="dark"] .ps-hero-input,
html[data-theme="dark"] .ps-hero-input {
    background: white !important;
    color: #1a2e3b !important;
}

html[data-bs-theme="dark"] .ps-hero-input::placeholder,
html[data-theme="dark"] .ps-hero-input::placeholder {
    color: #6c757d !important;
}

html[data-bs-theme="dark"] .ps-hero-input-icon,
html[data-theme="dark"] .ps-hero-input-icon {
    background: white !important;
}

html[data-bs-theme="dark"] .ps-hero-stat,
html[data-theme="dark"] .ps-hero-stat {
    color: #5a6a7a !important;
}

/* ================================
   HOW PROPSPECTRA HELPS YOU WIN - Same in both modes
   ================================ */

.ps-win-section {
    background-color: #003366 !important;
}

.ps-win-heading {
    color: #ffffff !important;
}

.ps-win-card {
    background-color: #ffffff !important;
}

.ps-win-card-title {
    color: #0a0a0a !important;
}

.ps-win-card-text {
    color: #5a5a5a !important;
}

.ps-win-icon,
.ps-win-icon span {
    color: #0a0a0a !important;
}

.ps-win-icon-svg {
    width: 48px;
    height: 48px;
    color: #0a0a0a !important;
}

/* Dark mode - keep section the same */
html[data-bs-theme="dark"] .ps-win-section,
html[data-theme="dark"] .ps-win-section {
    background-color: #003366 !important;
}

html[data-bs-theme="dark"] .ps-win-heading,
html[data-theme="dark"] .ps-win-heading {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .ps-win-card,
html[data-theme="dark"] .ps-win-card {
    background-color: #ffffff !important;
    --bs-card-bg: #ffffff !important;
}

html[data-bs-theme="dark"] .ps-win-card-title,
html[data-theme="dark"] .ps-win-card-title {
    color: #0a0a0a !important;
}

html[data-bs-theme="dark"] .ps-win-card-text,
html[data-theme="dark"] .ps-win-card-text {
    color: #5a5a5a !important;
}

html[data-bs-theme="dark"] .ps-win-icon,
html[data-theme="dark"] .ps-win-icon,
html[data-bs-theme="dark"] .ps-win-icon span,
html[data-theme="dark"] .ps-win-icon span {
    color: #0a0a0a !important;
}

html[data-bs-theme="dark"] .ps-win-icon-svg,
html[data-theme="dark"] .ps-win-icon-svg {
    color: #0a0a0a !important;
}

/* ================================
   FEATURES SECTION - Inverted Colors
   Light mode: Dark background, light text
   Dark mode: Light background, dark text
   ================================ */

/* Light mode - matches "HOW PROPSPECTRA HELPS YOU WIN" style */
:root .ps-features-section,
html[data-theme="light"] .ps-features-section {
    background: #143364 !important;
}

:root .ps-features-heading,
html[data-theme="light"] .ps-features-heading {
    color: #ffffff !important;
}

:root .ps-features-subtext,
html[data-theme="light"] .ps-features-subtext {
    color: rgba(255, 255, 255, 0.8) !important;
}

:root .ps-features-card,
html[data-theme="light"] .ps-features-card {
    background: #ffffff !important;
    border: none !important;
}

:root .ps-features-card-title,
html[data-theme="light"] .ps-features-card-title {
    color: #0f172a !important;
}

:root .ps-features-card-text,
html[data-theme="light"] .ps-features-card-text {
    color: #64748b !important;
}

:root .ps-features-icon,
html[data-theme="light"] .ps-features-icon {
    color: #143364 !important;
}

/* Dark mode - inverted (light background) */
html[data-theme="dark"] .ps-features-section {
    background: #f1f5f9 !important;
}

html[data-theme="dark"] .ps-features-heading {
    color: #0f172a !important;
}

html[data-theme="dark"] .ps-features-subtext {
    color: #475569 !important;
}

html[data-theme="dark"] .ps-features-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

html[data-theme="dark"] .ps-features-card-title {
    color: #0f172a !important;
}

html[data-theme="dark"] .ps-features-card-text {
    color: #64748b !important;
}

html[data-theme="dark"] .ps-features-icon {
    color: #3b82f6 !important;
}

/* ================================
   FOR LENDERS & CONTRACTORS SECTION
   ================================ */

/* Light mode - dark navy background */
:root .ps-lenders-section,
html[data-theme="light"] .ps-lenders-section {
    background: #143364 !important;
}

:root .ps-lenders-heading,
html[data-theme="light"] .ps-lenders-heading {
    color: #ffffff !important;
}

:root .ps-lenders-text,
html[data-theme="light"] .ps-lenders-text {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Dark mode - light background */
html[data-theme="dark"] .ps-lenders-section {
    background: #f1f5f9 !important;
}

html[data-theme="dark"] .ps-lenders-heading {
    color: #0f172a !important;
}

html[data-theme="dark"] .ps-lenders-text {
    color: #475569 !important;
}

/* ================================
   DEAL ANALYSIS MODE TOGGLE BUTTONS
   ================================ */

/* Wholesale button - always dark text when inactive */
.btn-outline-light {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.btn-outline-light:hover {
    color: #0f172a !important;
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

/* When checked/active - green background with white text */
.btn-check:checked + .btn-outline-light {
    background-color: #22c55e !important;
    border-color: #22c55e !important;
    color: #ffffff !important;
}

/* Dark mode adjustments */
html[data-theme="dark"] .btn-outline-light {
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html[data-theme="dark"] .btn-outline-light:hover {
    color: #ffffff !important;
    background-color: #334155 !important;
    border-color: #64748b !important;
}

html[data-theme="dark"] .btn-check:checked + .btn-outline-light {
    background-color: #22c55e !important;
    border-color: #22c55e !important;
    color: #ffffff !important;
}

/* Surface Classes */
.ps-surface {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    box-shadow: var(--ps-shadow);
    border-radius: var(--ps-radius);
}

.ps-surface-2 {
    background: var(--ps-surface-2);
    border: 1px solid var(--ps-border);
    border-radius: 12px;
}

.ps-section {
    padding: 16px;
    margin-bottom: 16px;
}

/* Section Outline Styles */
.ps-outline-a {
    border: 1px solid var(--ps-border);
    border-left: 4px solid var(--ps-brand-blue-1);
}

.ps-outline-b {
    border: 1px solid var(--ps-border);
    border-left: 4px solid var(--ps-brand-blue-2);
}

/* Icon Buttons */
.ps-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--ps-border);
    background: var(--ps-surface);
    color: var(--ps-text);
    transition: all 0.2s ease;
}

.ps-icon-btn:hover {
    background: var(--ps-hover-bg);
    border-color: var(--ps-brand-blue-1);
}

.ps-icon-btn.danger:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #dc3545;
}

/* Table Styles */
.ps-table {
    width: 100%;
}

.ps-table thead th {
    color: var(--ps-text-muted);
    border-bottom: 1px solid var(--ps-border);
    font-weight: 600;
    padding: 12px 8px;
}

.ps-table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--ps-border);
}

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

/* Button Overrides */
.btn-primary {
    background-color: var(--ps-primary);
    border-color: var(--ps-primary);
    color: var(--ps-primary-contrast);
}

.btn-primary:hover {
    background-color: #0d2651;
    border-color: #0d2651;
}

/* Card Overrides for Theme Compatibility */
html[data-theme="light"] .card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    box-shadow: var(--ps-shadow);
}

html[data-theme="light"] .card-header {
    background: var(--ps-surface-2);
    border-bottom: 1px solid var(--ps-border);
}

html[data-theme="light"] .card-body {
    background: var(--ps-surface);
}

/* Theme-aware Navbar */
.ps-navbar {
    background: var(--ps-surface) !important;
    border-bottom: 1px solid var(--ps-border) !important;
}

.ps-navbar .navbar-brand,
.ps-navbar .nav-link,
.ps-navbar .navbar-text {
    color: var(--ps-text) !important;
}

.ps-navbar .nav-link:hover {
    opacity: 0.85;
    color: var(--ps-brand-blue-1) !important;
}

.ps-navbar .navbar-toggler {
    border-color: var(--ps-border) !important;
}

/* Make the hamburger visible in dark mode only */
html[data-theme="dark"] .ps-navbar .navbar-toggler-icon {
    filter: invert(1);
}

/* Legacy support for navbar-dark.bg-dark */
html[data-theme="light"] .navbar-dark.bg-dark {
    background: var(--ps-surface) !important;
}

html[data-theme="light"] .navbar-dark .navbar-brand,
html[data-theme="light"] .navbar-dark .nav-link {
    color: var(--ps-text) !important;
}

html[data-theme="light"] .navbar-dark .nav-link:hover {
    color: var(--ps-brand-blue-1) !important;
}

html[data-theme="light"] .navbar-dark .navbar-toggler-icon {
    filter: invert(1);
}

/* Theme-aware Footer */
.ps-footer {
    background: var(--ps-surface-2) !important;
    border-top: 1px solid var(--ps-border);
    color: var(--ps-text);
}

.ps-footer h5,
.ps-footer h6 {
    color: var(--ps-text) !important;
}

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

/* Footer Theme Overrides (legacy bg-dark support) */
html[data-theme="light"] .footer,
html[data-theme="light"] footer.bg-dark {
    background: var(--ps-surface-2) !important;
    border-top: 1px solid var(--ps-border);
}

html[data-theme="light"] footer.bg-dark h5,
html[data-theme="light"] footer.bg-dark h6,
html[data-theme="light"] footer.bg-dark p,
html[data-theme="light"] footer.bg-dark a {
    color: var(--ps-text) !important;
}

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

/* Dropdown Menu Light Mode */
html[data-theme="light"] .dropdown-menu {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    box-shadow: var(--ps-shadow);
}

html[data-theme="light"] .dropdown-item {
    color: var(--ps-text);
}

html[data-theme="light"] .dropdown-item:hover {
    background: var(--ps-hover-bg);
}

/* Alert Light Mode */
html[data-theme="light"] .alert {
    border-radius: 10px;
}

/* Stats Cards Override for Light Mode */
html[data-theme="light"] .card.bg-primary,
html[data-theme="light"] .card.bg-success,
html[data-theme="light"] .card.bg-warning {
    border: none;
}

/* Metric Card Light Mode Alternative */
.ps-metric-card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius);
    box-shadow: var(--ps-shadow);
    padding: 20px;
}

.ps-metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ps-metric-card .metric-icon.primary {
    background: rgba(20, 51, 100, 0.1);
    color: var(--ps-brand-blue-1);
}

.ps-metric-card .metric-icon.success {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.ps-metric-card .metric-icon.warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
}

/* Text Utilities */
.text-body {
    color: var(--ps-text) !important;
}

/* Progress Bar Light Mode */
html[data-theme="light"] .progress {
    background: var(--ps-surface-2);
}

/* Auth Page Specific Light Mode */
html[data-theme="light"] .auth-card {
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    box-shadow: var(--ps-shadow);
}

html[data-theme="light"] .auth-card .logo h1 {
    color: var(--ps-text);
}

html[data-theme="light"] .auth-card .logo p {
    color: var(--ps-text-muted);
}

html[data-theme="light"] .toggle-container {
    background: var(--ps-surface-2);
}

html[data-theme="light"] .toggle-btn {
    color: var(--ps-text-muted);
}

html[data-theme="light"] .toggle-btn:hover {
    color: var(--ps-text);
}

html[data-theme="light"] .toggle-btn.active {
    background: var(--ps-primary);
    color: var(--ps-primary-contrast);
}

html[data-theme="light"] .form-floating label {
    color: var(--ps-text-muted);
}

html[data-theme="light"] .form-control {
    background: var(--ps-surface);
    border-color: var(--ps-border);
    color: var(--ps-text);
}

html[data-theme="light"] .form-control:focus {
    background: var(--ps-surface);
    border-color: var(--ps-brand-blue-1);
    color: var(--ps-text);
}

/* Auth Body Background for Light Mode */
html[data-theme="light"] body.auth-body {
    background: var(--ps-bg);
}

/* Theme-aware Badge Surface */
.ps-badge-surface {
    background: var(--ps-surface-2) !important;
    border: 1px solid var(--ps-border) !important;
    color: var(--ps-text) !important;
}

/* Theme-aware Helper Box */
.ps-helper {
    background: var(--ps-surface-2) !important;
    border: 1px solid var(--ps-border) !important;
    color: var(--ps-text) !important;
    border-radius: 12px;
}

/* Theme-aware Text Colors */
.ps-text-gold {
    color: var(--ps-gold) !important;
}

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

/* Theme-safe helper utilities */
.ps-on-surface {
    color: var(--ps-text) !important;
}

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

/* Theme-aware heading colors */
.ps-heading-navy {
    color: #003366 !important;
}

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

/* Bootstrap text-body override for theme consistency */
.text-body {
    color: var(--ps-text) !important;
}

/* Fix bg-light in dark mode */
html[data-theme="dark"] .bg-light {
    background: var(--ps-surface-2) !important;
    color: var(--ps-text) !important;
}

/* Fix text colors on tinted panels */
html[data-theme="dark"] .bg-success.bg-opacity-10 .text-white,
html[data-theme="dark"] .bg-success.bg-opacity-20 .text-white,
html[data-theme="dark"] .bg-warning.bg-opacity-10 .text-white,
html[data-theme="dark"] .bg-info.bg-opacity-10 .text-white {
    color: var(--ps-text) !important;
}

/* Preserve solid color cards in BOTH light and dark modes - force Bootstrap colors */
html[data-theme="light"] .card.bg-success,
html[data-theme="dark"] .card.bg-success,
html[data-bs-theme="light"] .card.bg-success,
html[data-bs-theme="dark"] .card.bg-success,
.card.bg-success {
    background-color: #198754 !important;
    --bs-bg-opacity: 1 !important;
}

html[data-theme="light"] .card.bg-info,
html[data-theme="dark"] .card.bg-info,
html[data-bs-theme="light"] .card.bg-info,
html[data-bs-theme="dark"] .card.bg-info,
.card.bg-info {
    background-color: #0dcaf0 !important;
    --bs-bg-opacity: 1 !important;
}

/* Force white text on these colored cards in all modes */
html[data-theme="light"] .card.bg-success *,
html[data-theme="dark"] .card.bg-success *,
html[data-bs-theme="light"] .card.bg-success *,
html[data-bs-theme="dark"] .card.bg-success *,
.card.bg-success *,
html[data-theme="light"] .card.bg-info *,
html[data-theme="dark"] .card.bg-info *,
html[data-bs-theme="light"] .card.bg-info *,
html[data-bs-theme="dark"] .card.bg-info *,
.card.bg-info * {
    color: #ffffff !important;
}

/* AI-generated section headings - black in light mode, white in dark mode */
html[data-theme="light"] .formatted-analysis h6.text-primary {
    color: #000000 !important;
}

html[data-theme="dark"] .formatted-analysis h6.text-primary {
    color: #ffffff !important;
}

/* ========================================
   STEP 3: Analysis section headers - readable in both themes
   ======================================== */
.ps-section-header {
    background: var(--ps-surface-2) !important;
    border-bottom: 1px solid var(--ps-border);
}

html[data-theme="light"] .ps-analysis-heading {
    color: #0f172a !important;
}

html[data-theme="dark"] .ps-analysis-heading {
    color: #ffffff !important;
}

.ps-analysis-heading i,
.ps-analysis-heading svg {
    color: inherit !important;
}

/* ========================================
   STEP 4: Property Details - dark boxes with white text
   ======================================== */
.ps-prop-box {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
}

.ps-prop-box-primary {
    background-color: #1d4ed8 !important;
}

.ps-prop-box-success {
    background-color: #15803d !important;
}

.ps-prop-box-warning {
    background-color: #b45309 !important;
}

.ps-prop-label {
    color: #ffffff !important;
}

.ps-prop-details .ps-prop-highlight,
.ps-prop-box .ps-prop-highlight,
.ps-prop-highlight,
div.ps-prop-highlight,
.h5.ps-prop-highlight,
.h6.ps-prop-highlight {
    color: #ffffff !important;
    font-weight: 800;
}

/* Make labels inside property boxes white */
.ps-prop-box .text-primary,
.ps-prop-box .text-success,
.ps-prop-box .text-warning,
.ps-prop-box .text-dark,
.ps-prop-box .text-body {
    color: #ffffff !important;
}

/* Helper boxes inside property boxes */
.ps-prop-box .ps-helper,
.ps-prop-box .small.ps-helper {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}

/* ================================
   STEP 2: FIXED COLOR CARDS (override Bootstrap variables)
   MUST be at the END of the file to win cascade
   ================================ */
.ps-fixed-green,
.card.ps-fixed-green,
.ps-fixed-green.card {
    background-color: #22c55e !important;
    background: #22c55e !important;
    color: #ffffff !important;
    --bs-card-bg: #22c55e !important;
    --bs-card-color: #ffffff !important;
    --bs-body-color: #ffffff !important;
    --bs-body-bg: #22c55e !important;
    --bs-heading-color: #ffffff !important;
    --bs-border-color: transparent !important;
    border: none !important;
}

.ps-fixed-green .card-body,
.ps-fixed-green.card .card-body {
    background-color: #22c55e !important;
    background: #22c55e !important;
    color: #ffffff !important;
}

.ps-fixed-blue,
.card.ps-fixed-blue,
.ps-fixed-blue.card {
    background-color: #38bdf8 !important;
    background: #38bdf8 !important;
    color: #ffffff !important;
    --bs-card-bg: #38bdf8 !important;
    --bs-card-color: #ffffff !important;
    --bs-body-color: #ffffff !important;
    --bs-body-bg: #38bdf8 !important;
    --bs-heading-color: #ffffff !important;
    --bs-border-color: transparent !important;
    border: none !important;
}

.ps-fixed-blue .card-body,
.ps-fixed-blue.card .card-body {
    background-color: #38bdf8 !important;
    background: #38bdf8 !important;
    color: #ffffff !important;
}

/* Ensure ALL text inside stays white */
.ps-fixed-green *,
.ps-fixed-blue *,
.ps-fixed-green h6,
.ps-fixed-blue h6,
.ps-fixed-green small,
.ps-fixed-blue small,
.ps-fixed-green div,
.ps-fixed-blue div,
.ps-fixed-green .h6,
.ps-fixed-blue .h6,
.ps-fixed-green hr,
.ps-fixed-blue hr {
    color: #ffffff !important;
}

.ps-fixed-green hr,
.ps-fixed-blue hr {
    border-color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}

/* Slider must remain white */
.ps-fixed-green input[type="range"],
.ps-fixed-blue input[type="range"] {
    accent-color: #ffffff !important;
}

/* ================================
   FINAL OVERRIDES - Property Details highlighted numbers MUST be white
   ================================ */
.ps-prop-box .h5,
.ps-prop-box .h6,
.ps-prop-box div.h5,
.ps-prop-box div.h6,
.ps-prop-box .ps-prop-highlight,
.ps-prop-box .fw-bold {
    color: #ffffff !important;
}

/* Map legend buttons - fixed colors with white text */
.ps-legend-green {
    background-color: #22c55e !important;
    color: #ffffff !important;
    border: none !important;
}

.ps-legend-green *,
.ps-legend-green div,
.ps-legend-green svg {
    color: #ffffff !important;
}

.ps-legend-blue {
    background-color: #38bdf8 !important;
    color: #ffffff !important;
    border: none !important;
}

.ps-legend-blue *,
.ps-legend-blue div,
.ps-legend-blue svg {
    color: #ffffff !important;
}
