/* 
   PREDICTIVE.AI - Main Stylesheet
   Vanilla CSS with CSS Variables, Glassmorphism, and Premium Dark Theme Aesthetics.
*/

:root {
    --bg-base: #0B0F19;
    --bg-sidebar: #0f1422;
    --bg-card: rgba(17, 24, 39, 0.65);
    --bg-card-hover: rgba(22, 32, 53, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(139, 92, 246, 0.25);
    
    /* Text Color */
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;

    /* Theme Accents */
    --accent-violet: #8B5CF6;
    --accent-violet-glow: rgba(139, 92, 246, 0.4);
    --accent-cyan: #06B6D4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.4);
    --accent-emerald: #10B981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.4);
    --accent-coral: #F43F5E;
    --accent-amber: #F59E0B;
    
    /* Layout Variables */
    --sidebar-width: 420px;
    --drawer-width: 380px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Styling */
.sidebar-container {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.brand-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 28px;
    color: var(--accent-violet);
    text-shadow: 0 0 15px var(--accent-violet-glow);
    animation: pulseGlow 3s infinite ease-in-out;
}

.brand-title h1 {
    font-size: 20px;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #FFF 30%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-title span {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Tabs */
.sidebar-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 14px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--accent-violet);
    border-bottom: 2px solid var(--accent-violet);
    background: rgba(139, 92, 246, 0.05);
}

/* Panel Contents */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel-content.hidden {
    display: none;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.section-title i {
    color: var(--accent-violet);
}

/* Forms & inputs styling */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.label-with-val {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.value-bubble {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid var(--accent-violet-glow);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--accent-violet);
    font-weight: 600;
}

select.custom-input, select, input.custom-input {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
}

select.custom-input:focus, select:focus, input.custom-input:focus {
    outline: none;
    border-color: var(--accent-violet);
    box-shadow: 0 0 8px var(--accent-violet-glow);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Sliders */
.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-violet);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-violet-glow);
    transition: transform 0.1s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Checkbox Grid */
.amenities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
    transition: color 0.3s ease;
    gap: 6px;
}

.checkbox-container i {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 16px;
    width: 16px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-violet);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-violet);
    border-color: var(--accent-violet);
    box-shadow: 0 0 6px var(--accent-violet-glow);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ i, 
.checkbox-container input:checked {
    color: var(--text-primary);
}

/* Glowing Valuation Card */
.valuation-card-container {
    margin-top: 10px;
}

.valuation-glowing-card {
    position: relative;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(26, 21, 44, 0.8) 0%, rgba(13, 17, 30, 0.8) 100%);
    border: 1px solid var(--accent-violet-glow);
    padding: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.valuation-glowing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.18);
}

.card-glow-element {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--accent-violet-glow) 0%, transparent 70%);
    top: -50px;
    right: -50px;
    filter: blur(15px);
    pointer-events: none;
}

.card-content {
    position: relative;
    z-index: 2;
}

.card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-violet);
    font-weight: 600;
}

.price-output {
    font-size: 32px;
    font-weight: 700;
    color: #FFF;
    margin: 8px 0 2px 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.price-sqft {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.confidence-range {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.confidence-range span:first-child {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.confidence-range span:last-child {
    font-size: 13px;
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Scraper Panel logs */
.scraper-status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scraper-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.scraper-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.scraper-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scraper-card-header h5 {
    font-size: 13px;
    font-weight: 600;
}

.status-indicator {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-indicator.idle {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-secondary);
}

.status-indicator.running {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    animation: blink 2s infinite;
}

.status-indicator.scheduled {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.scraper-metrics {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.scraper-metrics span strong {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-mini-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 2px;
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.pipeline-flow-card {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.03) 0%, rgba(139, 92, 246, 0) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pipeline-flow-card h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.flow-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.flow-step i {
    font-size: 16px;
    color: var(--accent-violet);
    margin-top: 2px;
    background: rgba(139, 92, 246, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flow-step h5 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.flow-step p {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Map Area Layout */
.main-map-layout {
    flex: 1;
    position: relative;
    height: 100vh;
    display: flex;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #0d121f;
}

/* Leaflet styling customizations */
.leaflet-container {
    background-color: #0b0f19 !important;
}

.leaflet-bar {
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}

.leaflet-bar a {
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-bar a:hover {
    background-color: var(--bg-card-hover) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-sidebar) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4) !important;
    padding: 6px;
}

.leaflet-popup-tip {
    background: var(--bg-sidebar) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-popup-content h4 {
    font-size: 14px;
    margin-bottom: 6px;
    color: #FFF;
}

.leaflet-popup-content p {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.leaflet-popup-content hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 6px 0;
}

/* Floating overlay toggles over the map */
.map-controls-panel {
    position: absolute;
    top: 24px;
    left: 24px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    width: 260px;
}

.map-controls-panel h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.map-overlay-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.overlay-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlay-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.02);
}

.overlay-btn.active {
    color: var(--text-primary);
    border-color: var(--accent-violet);
    background: rgba(139, 92, 246, 0.12);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.overlay-btn i {
    width: 14px;
    text-align: center;
    color: var(--text-muted);
}

.overlay-btn.active i {
    color: var(--accent-violet);
}

/* Timeline Horizontal slider */
.horizon-slider-panel {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 420px; /* Leave space for analytics drawer */
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 20px 30px;
    border-radius: 12px;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.horizon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.horizon-header h4 {
    font-size: 13px;
    font-weight: 500;
}

.badge {
    background: linear-gradient(135deg, var(--accent-violet) 0%, #6d28d9 100%);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 0 10px var(--accent-violet-glow);
}

.timeline-slider-wrapper {
    position: relative;
    height: 40px;
    margin-top: 10px;
}

.timeline-input {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    outline: none;
    cursor: pointer;
}

.timeline-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFF;
    border: 3px solid var(--accent-violet);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
    transition: transform 0.1s ease;
}

.timeline-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.marker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.timeline-marker.active .marker-dot {
    background: var(--accent-violet);
    box-shadow: 0 0 8px var(--accent-violet);
    width: 12px;
    height: 12px;
}

.marker-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.timeline-marker.active .marker-label {
    color: var(--text-primary);
    font-weight: 600;
}

/* Analytics Right Panel */
.analytics-drawer {
    width: var(--drawer-width);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
    font-size: 18px;
    color: #FFF;
    margin-bottom: 4px;
}

.drawer-header p {
    font-size: 12px;
    color: var(--text-muted);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.driver-section-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.drivers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.driver-item {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    align-items: flex-start;
}

.driver-item i {
    margin-top: 3px;
    font-size: 12px;
    flex-shrink: 0;
}

.driver-item.positive i {
    color: var(--accent-emerald);
}

.driver-item.negative i {
    color: var(--accent-coral);
}

.driver-item.neutral i {
    color: var(--accent-cyan);
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.score-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.score-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.score-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Helpers & Utilities */
.text-cyan { color: var(--accent-cyan) !important; }
.text-violet { color: var(--accent-violet) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-coral { color: var(--accent-coral) !important; }

/* Micro animations */
@keyframes pulseGlow {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px var(--accent-violet-glow)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 15px var(--accent-violet)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--accent-violet-glow)); }
}

@keyframes blink {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Responsive constraints */
@media (max-width: 1200px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    .sidebar-container {
        width: 100%;
        height: auto;
    }
    .main-map-layout {
        height: 600px;
        width: 100%;
    }
    .horizon-slider-panel {
        right: 24px;
    }
    .analytics-drawer {
        display: none; /* hidden on small screen models fallback */
    }
}

/* Extended App Styles (Currency & Simulator) */
.currency-selector-container {
    margin-left: auto;
}

.currency-select-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-select-box:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 6px var(--accent-cyan-glow);
}

.sim-help-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.sim-slider::-webkit-slider-thumb {
    background: var(--accent-cyan) !important;
    box-shadow: 0 0 10px var(--accent-cyan-glow) !important;
}

.matched-localities-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.matched-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.matched-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    transform: translateX(4px);
}

.matched-info h5 {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.matched-info span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-score-badge {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid var(--accent-cyan-glow);
    color: var(--accent-cyan);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(6, 182, 212, 0.3);
}

.flow-db-stats {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.15);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.flow-db-stats p {
    display: flex;
    justify-content: space-between;
}

.flow-db-stats strong {
    color: var(--accent-cyan);
}

.hidden {
    display: none !important;
}

/* ================================================
   UNIFIED INSIGHTS FRAME (replaces old tabs)
   ================================================ */

/* Remove legacy tab display — tabs are gone */
.drawer-subtabs { display: none !important; }
.drawer-subtab  { display: none !important; }

/* Unified frame: full-height scrollable single column */
.unified-insights-frame {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    padding-bottom: 24px;
}

/* Section header labels — "Price Forecast" / "AI Insights" */
.insights-block-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--text-muted);
    padding: 14px 2px 8px;
}
.insights-block-label i {
    color: var(--accent-violet);
    font-size: 11px;
}

/* Gradient divider between chart section and AI Insights */
.insights-section-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(139,92,246,0.35) 30%,
        rgba(6,182,212,0.35) 70%,
        transparent 100%
    );
    margin: 16px 0 4px;
    border-radius: 2px;
}

/* ================================================
   INSIGHTS VERDICT CARD
   ================================================ */
.insights-verdict-card {
    background: linear-gradient(135deg, rgba(15,20,35,0.9) 0%, rgba(8,12,24,0.9) 100%);
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

/* STRONG_UP — Emerald */
.verdict-badge.verdict-strong-up {
    background: rgba(16,185,129,0.18);
    border: 1px solid rgba(16,185,129,0.4);
    color: var(--accent-emerald);
    box-shadow: 0 0 12px rgba(16,185,129,0.15);
}

/* UP — Cyan */
.verdict-badge.verdict-up {
    background: rgba(6,182,212,0.15);
    border: 1px solid rgba(6,182,212,0.35);
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6,182,212,0.12);
}

/* FLAT_POSITIVE — Amber */
.verdict-badge.verdict-flat {
    background: rgba(245,158,11,0.15);
    border: 1px solid rgba(245,158,11,0.35);
    color: var(--accent-amber);
    box-shadow: 0 0 12px rgba(245,158,11,0.1);
}

/* DOWN — Coral */
.verdict-badge.verdict-down {
    background: rgba(244,63,94,0.15);
    border: 1px solid rgba(244,63,94,0.35);
    color: var(--accent-coral);
    box-shadow: 0 0 12px rgba(244,63,94,0.1);
}

.verdict-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.verdict-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.vm-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.vm-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ================================================
   INSIGHTS SECTIONS
   ================================================ */
.insights-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.insights-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.insights-section-title i {
    color: var(--accent-violet);
    font-size: 12px;
}

.insights-reasons-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
}

.insights-reasons-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 10px 12px;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    border-left: 3px solid var(--accent-violet);
}

.insights-reasons-list li i {
    color: var(--accent-violet);
    margin-top: 2px;
    font-size: 11px;
    flex-shrink: 0;
}

/* Drivers by horizon */
.insights-drivers-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.driver-horizon-block {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}

.driver-horizon-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 6px;
}

.driver-horizon-label.st { color: var(--accent-emerald); }
.driver-horizon-label.mt { color: var(--accent-cyan); }
.driver-horizon-label.lt { color: var(--accent-violet); }

.driver-horizon-item {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 3px 0;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.driver-horizon-item::before {
    content: '›';
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

/* ================================================
   NEWS REFERENCE CARDS
   ================================================ */
.insights-news-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-card {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.news-card:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.news-card-title {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.news-sentiment-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.news-sentiment-tag.positive {
    background: rgba(16,185,129,0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16,185,129,0.3);
}

.news-sentiment-tag.negative {
    background: rgba(244,63,94,0.15);
    color: var(--accent-coral);
    border: 1px solid rgba(244,63,94,0.3);
}

.news-sentiment-tag.neutral {
    background: rgba(156,163,175,0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.news-card-summary {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.news-source-tag {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.2);
    color: var(--accent-violet);
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.news-link-icon {
    color: var(--text-muted);
    font-size: 10px;
}

.news-card:hover .news-link-icon {
    color: var(--accent-cyan);
}

.news-loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px;
    animation: blink 2s infinite;
}

/* Scraper skeleton loader */
.scraper-skeleton {
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    animation: blink 2s infinite;
}

/* ── Map Event Markers ────────────────────────────────────────── */
.map-event-marker {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    border: 2px solid rgba(255,255,255,0.2);
}
.map-event-marker:hover {
    transform: scale(1.2);
    filter: brightness(1.2);
}

/* Dark popup for event markers */
.event-popup-dark .leaflet-popup-content-wrapper {
    background: rgba(13,17,23,0.96) !important;
    color: #f0f6ff !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6) !important;
    backdrop-filter: blur(20px);
    padding: 14px !important;
}
.event-popup-dark .leaflet-popup-tip {
    background: rgba(13,17,23,0.96) !important;
}
.event-popup-dark .leaflet-popup-close-button {
    color: #6b7280 !important;
    font-size: 18px !important;
    top: 8px !important; right: 10px !important;
}

/* ── Agents Nav Button in Sidebar Header ─────────────────────── */
.agents-nav-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25);
    color: #8b5cf6; font-size: 0.85rem; text-decoration: none;
    transition: all 0.2s; margin-left: 8px;
}
.agents-nav-btn:hover {
    background: rgba(99,102,241,0.25); border-color: rgba(99,102,241,0.5);
    color: #a78bfa; transform: scale(1.08);
}

/* ── Map Event Toggle Bar ────────────────────────────────────── */
.map-event-toggle-bar {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px 12px; background: rgba(255,255,255,0.02);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.event-toggle-btn {
    padding: 5px 10px; border-radius: 8px; font-size: 0.7rem; font-weight: 600;
    border: 1px solid rgba(255,255,255,0.08); color: #6b7280;
    background: transparent; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 4px;
}
.event-toggle-btn:hover {
    border-color: rgba(255,255,255,0.15); color: #9ca3af;
    background: rgba(255,255,255,0.04);
}
.event-toggle-btn.active {
    background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3);
    color: #8b5cf6;
}

/* ── Brand Header alignment fix ──────────────────────────────── */
.brand-header {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   USER AUTHENTICATION & ACCESS CONTROL STYLES
   ══════════════════════════════════════════════════════════════════════════════ */

/* User Profile Sidebar Badge */
.user-auth-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-color);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-cyan) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 10px;
    color: var(--accent-cyan);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-action-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-violet);
    color: var(--text-primary);
}

/* Tab Lock Icons */
.tab-lock-icon {
    font-size: 10px;
    color: var(--accent-coral);
    margin-left: auto;
}

.tab-lock-icon.hidden {
    display: none !important;
}

/* Panel Locked Overlay (Glassmorphism) */
.panel-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    animation: fadeIn 0.3s ease-out;
}

.panel-lock-overlay.hidden {
    display: none !important;
}

.lock-card {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lock-icon {
    font-size: 40px;
    color: var(--accent-amber);
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.lock-card h3 {
    font-size: 18px;
    color: var(--text-primary);
}

.lock-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upgrade-btn-action {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-cyan) 100%);
    border: none;
    color: white;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.upgrade-btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.5);
}

/* Modal Overlay & Card styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.25s ease-out;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    padding: 32px 28px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.modal-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.modal-tab.active {
    color: var(--accent-violet);
    border-bottom-color: var(--accent-violet);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-input, .auth-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.auth-input:focus, .auth-select:focus {
    outline: none;
    border-color: var(--accent-violet);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.auth-error-msg {
    color: var(--accent-coral);
    font-size: 11px;
    font-weight: 500;
}

.auth-error-msg.hidden {
    display: none !important;
}

.auth-submit-btn {
    background: var(--accent-violet);
    color: white;
    border: none;
    padding: 11px;
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-submit-btn:hover {
    background: #7c3aed;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-divider span {
    padding: 0 10px;
}

/* Google Signon styling */
.google-signon-btn {
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s;
}

.google-signon-btn:hover {
    background: #f9fafb;
}

.google-signon-btn img {
    width: 18px;
    height: 18px;
}

/* Mock account helpers */
.mock-accounts-helper {
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    margin-top: 8px;
}

.mock-accounts-helper h5 {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mock-account-tags {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mock-tag {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mock-tag:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-cyan);
    border-color: rgba(139, 92, 246, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

