/* Appraise.ai Theme System with Dark Mode Support */

/* Light Theme (Default) */
:root {
    /* Primary Colors */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #ecf0f1;

    /* Text Colors */
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;

    /* Border Colors */
    --border-color: #dee2e6;
    --border-light: #e9ecef;

    /* Panel/Card Colors */
    --panel-bg: #ffffff;
    --panel-shadow: rgba(0, 0, 0, 0.1);
    --panel-border: #e0e0e0;

    /* Map Feature Colors */
    --feature-stroke: #2c3e50;
    --feature-fill: #ecf0f1;
    --feature-fill-opacity: 0.1;
    --feature-hover: #3498db;
    --feature-selected: #22c55e;

    /* Building Colors */
    --building-stroke: #7f8c8d;
    --building-fill: #95a5a6;

    /* Input Colors */
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-focus: #3498db;

    /* Overlay Colors */
    --overlay-bg: rgba(255, 255, 255, 0.95);
    --loading-bg: rgba(0, 0, 0, 0.3);
}

/* Dark Theme */
[data-theme="dark"] {
    /* Primary Colors (slightly adjusted for dark mode) */
    --primary-color: #3498db;
    --secondary-color: #5dade2;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;

    /* Background Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #383838;

    /* Text Colors */
    --text-primary: #e4e4e4;
    --text-secondary: #b8b8b8;
    --text-muted: #909090;

    /* Border Colors */
    --border-color: #404040;
    --border-light: #505050;

    /* Panel/Card Colors */
    --panel-bg: #2d2d2d;
    --panel-shadow: rgba(0, 0, 0, 0.5);
    --panel-border: #404040;

    /* Map Feature Colors */
    --feature-stroke: #5dade2;
    --feature-fill: #3498db;
    --feature-fill-opacity: 0.15;
    --feature-hover: #f39c12;
    --feature-selected: #2ecc71;

    /* Building Colors */
    --building-stroke: #7f8c8d;
    --building-fill: #5a5a5a;

    /* Input Colors */
    --input-bg: #383838;
    --input-border: #505050;
    --input-focus: #5dade2;

    /* Overlay Colors */
    --overlay-bg: rgba(30, 30, 30, 0.95);
    --loading-bg: rgba(0, 0, 0, 0.7);
}

/* Global Styles */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar Styles */
.navbar {
    background-color: var(--panel-bg) !important;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

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

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Card Styles */
.card {
    background-color: var(--panel-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-header {
    background-color: var(--bg-tertiary);
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

/* Panel Styles */
.search-panel,
.property-info-panel {
    background-color: var(--panel-bg) !important;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    box-shadow: 0 2px 8px var(--panel-shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Input Styles */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus);
    color: var(--text-primary);
}

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

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

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

/* Form Control Styles */
.form-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

.form-control:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-label {
    color: var(--text-primary);
}

/* Layer Control Styles */
.layer-control-section {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.layer-control-section h6 {
    color: var(--text-primary);
}

/* Checkbox and Radio Styles */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
    background-color: var(--loading-bg) !important;
}

/* Table Styles */
.table {
    color: var(--text-primary);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-tertiary);
}

/* Modal Styles */
.modal-content {
    background-color: var(--panel-bg);
    color: var(--text-primary);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

.modal-footer {
    border-top-color: var(--border-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.theme-toggle-icon {
    font-size: 1.2rem;
}

/* Map-specific Dark Mode Adjustments */
[data-theme="dark"] .leaflet-container {
    background-color: #1a1a1a;
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
    background-color: var(--panel-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .leaflet-popup-tip {
    background-color: var(--panel-bg);
}

/* Dark mode for base layer controls */
[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}

/* Scrollbar Styles for Dark Mode */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Metric Cards */
.metric-card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

/* Alert Styles */
.alert {
    border-color: var(--border-color);
}

[data-theme="dark"] .alert-info {
    background-color: rgba(52, 152, 219, 0.2);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

[data-theme="dark"] .alert-success {
    background-color: rgba(46, 204, 113, 0.2);
    border-color: var(--success-color);
    color: var(--text-primary);
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(243, 156, 18, 0.2);
    border-color: var(--warning-color);
    color: var(--text-primary);
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(231, 76, 60, 0.2);
    border-color: var(--danger-color);
    color: var(--text-primary);
}
