/* UK Property Intel v5.0 - Comprehensive Styles */
:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-2: #1a1a24;
    --surface-3: #222230;
    --border: #2a2a3a;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --primary: #3b82f6;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 2rem;
    font-size: 0.9rem;
}
nav a:hover { color: var(--text); }

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}
.section { margin-bottom: 2rem; }
.hidden { display: none !important; }

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0;
}
.badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}
h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); margin-bottom: 2rem; }

/* Search */
.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto 1rem;
    gap: 0.5rem;
}
.search-box input {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}
.search-box button {
    padding: 1rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}
.search-examples {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.search-examples span { color: var(--text-muted); font-size: 0.85rem; }
.search-examples button {
    padding: 0.4rem 0.8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.location-info h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.location-info p { color: var(--text-muted); font-size: 0.9rem; }
.ward-info { font-size: 0.8rem !important; }

.score-badge {
    background: var(--surface);
    border: 2px solid var(--score-color);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 120px;
}
.score-num { font-size: 2.5rem; font-weight: 700; color: var(--score-color); }
.score-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

/* Score Factors */
.score-factors {
    margin-bottom: 1.5rem;
}
.score-factors h3 { padding: 1rem; border-bottom: 1px solid var(--border); }
.factors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
}
.factor {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
}
.factor.positive { background: rgba(34,197,94,0.15); color: var(--success); }
.factor.negative { background: rgba(239,68,68,0.15); color: var(--danger); }

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.card-header h3 { font-size: 1rem; }
.source-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.card-content { padding: 1rem; }
.full-width { grid-column: 1 / -1; }

/* Data Context */
.data-context {
    background: var(--surface-2);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Price Hero */
.price-hero {
    text-align: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.price-main .label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.price-main .value { font-size: 2.5rem; font-weight: 700; }
.price-trend {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.price-trend.rising, .price-trend.rising_fast { background: rgba(34,197,94,0.15); color: var(--success); }
.price-trend.falling, .price-trend.falling_fast { background: rgba(239,68,68,0.15); color: var(--danger); }
.price-trend.stable { background: rgba(245,158,11,0.15); color: var(--warning); }

/* Price Changes */
.price-changes, .price-by-type, .actual-sales, .affordability { margin-bottom: 1.5rem; }
.price-changes h4, .price-by-type h4, .actual-sales h4, .affordability h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}
.change-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.change-item {
    background: var(--surface-2);
    padding: 0.75rem;
    border-radius: var(--radius);
    text-align: center;
}
.change-item .period { display: block; font-size: 0.75rem; color: var(--text-muted); }
.change-item .value { font-size: 1.1rem; font-weight: 600; }
.change-item .value.up { color: var(--success); }
.change-item .value.down { color: var(--danger); }

.type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
.type-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius);
}
.type-item .type { color: var(--text-muted); }
.type-item .price { font-weight: 600; }

/* Sales Stats */
.sales-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.sales-stats .stat {
    background: var(--surface-2);
    padding: 0.75rem;
    border-radius: var(--radius);
    text-align: center;
}
.sales-stats .stat .label { display: block; font-size: 0.75rem; color: var(--text-muted); }
.sales-stats .stat .value { font-size: 1.1rem; font-weight: 600; }
.sales-stats .stat.highlight { background: var(--surface-3); border: 1px solid var(--primary); }

/* Mini Table */
.mini-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
.mini-table th, .mini-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.mini-table th { color: var(--text-muted); font-weight: 500; }

/* Price Bands */
.price-bands h5, .sales-by-type h5 { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.bands {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.band {
    background: var(--surface-2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}
.new-existing {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Affordability */
.affordability p { font-size: 0.9rem; margin-bottom: 0.5rem; }
.note { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.no-data { color: var(--text-muted); text-align: center; padding: 1rem; }

/* Area Card */
.location-details { margin-bottom: 1rem; }
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.detail-row span:first-child { color: var(--text-muted); }

/* Amenities */
.amenities-section, .transport-section, .planning-section { margin-bottom: 1.5rem; }
.amenities-section h4, .transport-section h4, .planning-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.amenities-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.amenity {
    background: var(--surface-2);
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius);
    text-align: center;
}
.amenity .count { display: block; font-size: 1.5rem; font-weight: 700; }
.amenity .label { font-size: 0.7rem; color: var(--text-muted); }
.convenience-score, .transport-score {
    font-size: 0.9rem;
    padding: 0.5rem;
    background: var(--surface-3);
    border-radius: var(--radius);
}

/* Transport */
.stations { margin-bottom: 0.75rem; }
.stations h5 { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-muted); }
.station {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.station .name { font-weight: 500; }
.station .lines { color: var(--text-muted); font-size: 0.75rem; }
.station .dist { color: var(--text-muted); font-size: 0.75rem; }

/* Planning */
.planning-items { margin-bottom: 0.5rem; }
.planning-item {
    padding: 0.5rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.planning-item.active { border-left: 3px solid var(--warning); }
.planning-item small { color: var(--text-muted); }
.planning-note { font-size: 0.8rem; color: var(--warning); }

/* Safety */
.crime-section, .flood-section { margin-bottom: 1.5rem; }
.crime-section h4, .flood-section h4 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.safety-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}
.safety-score .value { font-size: 1.5rem; font-weight: 700; }
.safety-score .value.good { color: var(--success); }
.safety-score .value.bad { color: var(--danger); }
.crime-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.crime-stats .stat {
    background: var(--surface-2);
    padding: 0.5rem;
    border-radius: var(--radius);
}
.crime-stats .stat .label { font-size: 0.75rem; color: var(--text-muted); display: block; }
.crime-stats .stat .value { font-weight: 500; }
.crime-stats .stat .value.good { color: var(--success); }
.crime-stats .stat .value.bad { color: var(--danger); }
.crime-categories h5 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.cat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.flood-risk {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.flood-risk .level {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 500;
}
.flood-risk .level.low { background: rgba(34,197,94,0.15); color: var(--success); }
.flood-risk .level.moderate { background: rgba(245,158,11,0.15); color: var(--warning); }
.flood-risk .level.high { background: rgba(239,68,68,0.15); color: var(--danger); }
.flood-note { font-size: 0.85rem; color: var(--text-muted); }
.flood-warning {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin: 0.5rem 0;
}
.external-link {
    display: inline-block;
    color: var(--primary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-decoration: none;
}

/* Investment */
.rental-section, .indicators-section { margin-bottom: 1.5rem; }
.rental-section h4, .indicators-section h4 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.rental-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.rental-stats .stat {
    background: var(--surface-2);
    padding: 0.75rem;
    border-radius: var(--radius);
    text-align: center;
}
.rental-stats .stat .label { display: block; font-size: 0.75rem; color: var(--text-muted); }
.rental-stats .stat .value { font-size: 1.2rem; font-weight: 600; }
.rental-stats .stat.highlight { border: 1px solid var(--success); }
.indicator-items { display: grid; gap: 0.5rem; }
.indicator {
    background: var(--surface-2);
    padding: 0.75rem;
    border-radius: var(--radius);
}
.indicator .label { font-size: 0.8rem; color: var(--text-muted); }
.indicator .value { font-weight: 600; margin: 0.25rem 0; }
.indicator .desc { font-size: 0.75rem; color: var(--text-muted); }

/* Sales Table */
.sales-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}
.sales-table th, .sales-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.sales-table th { color: var(--text-muted); background: var(--surface-2); }
.sales-table .price { font-weight: 600; }
.sales-table .address { color: var(--text-muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Useful Links */
.useful-links { padding: 1rem; }
.useful-links h3 { margin-bottom: 1rem; }
.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.links-grid a {
    background: var(--surface-2);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}
.links-grid a:hover { background: var(--surface-3); }

/* Data Sources */
.data-sources {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Compare */
.compare-box {
    text-align: center;
    padding: 2rem;
}
.compare-box h2 { margin-bottom: 0.5rem; }
.compare-box p { color: var(--text-muted); margin-bottom: 1.5rem; }
.compare-inputs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.compare-inputs input {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    width: 100px;
}
.compare-box button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}
.compare-table-wrapper { overflow-x: auto; }
.compare-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
    background: var(--surface);
    margin-top: 1rem;
}
.compare-table th, .compare-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.compare-table th { background: var(--surface-2); }
.compare-table .best { background: rgba(34,197,94,0.05); }
.best-badge {
    background: var(--success);
    color: var(--bg);
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}
.score-pill {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: white;
    font-weight: 600;
}
td.good { color: var(--success); }
td.bad { color: var(--danger); }
td.up { color: var(--success); }
td.down { color: var(--danger); }

/* Sources Section */
.sources-section { padding: 2rem 0; }
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.source-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.source-card h3 { margin-bottom: 0.75rem; }
.source-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.source-provider { font-weight: 500; color: var(--text) !important; }
.ogl { text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* Footer */
footer {
    background: var(--surface);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
footer span { margin: 0 1rem; }

/* Loading */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { margin-top: 1rem; color: var(--text-muted); }
.loading-note { font-size: 0.85rem; }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    z-index: 1001;
}

/* ============================================
   INVESTMENT SIGNALS STYLING
   ============================================ */

.investment-signals {
    border-width: 2px;
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
}

/* Signal color variants */
.signal-strong-buy {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), var(--surface-2));
}
.signal-buy {
    border-color: #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--surface-2));
}
.signal-wait, .signal-hold {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), var(--surface-2));
}
.signal-caution {
    border-color: #f97316;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), var(--surface-2));
}
.signal-avoid {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--surface-2));
}

.signal-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-3);
    border-radius: var(--radius);
}

.signal-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.signal-label {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.signal-strong-buy .signal-label { color: #10b981; }
.signal-buy .signal-label { color: #22c55e; }
.signal-wait .signal-label,
.signal-hold .signal-label { color: #f59e0b; }
.signal-caution .signal-label { color: #f97316; }
.signal-avoid .signal-label { color: #ef4444; }

.signal-confidence {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.signal-forecast {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.forecast-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.forecast-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.forecast-gain {
    font-size: 1rem;
    font-weight: 600;
}

.forecast-gain.positive { color: var(--success); }
.forecast-gain.negative { color: var(--danger); }

.signal-summary,
.signal-advice {
    padding: 1rem;
    background: var(--surface-3);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary);
}

.signal-reasons {
    margin-bottom: 1.5rem;
}

.signal-reasons ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.signal-reasons li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.signal-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric {
    padding: 1rem;
    background: var(--surface-3);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.metric-detail {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.risk-low { color: #22c55e; }
.risk-medium { color: #f59e0b; }
.risk-high { color: #f97316; }
.risk-very-high { color: #ef4444; }

.forecast-table {
    margin-top: 1.5rem;
}

.forecast-table h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.forecast-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-3);
    border-radius: var(--radius);
    overflow: hidden;
}

.forecast-table th,
.forecast-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.forecast-table th {
    background: var(--surface-2);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.forecast-table td.positive {
    color: var(--success);
    font-weight: 600;
}

.forecast-table td.negative {
    color: var(--danger);
    font-weight: 600;
}

.forecast-table tr:last-child td {
    border-bottom: none;
}

.forecast-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    main { padding: 1rem; }
    h1 { font-size: 1.5rem; }
    .results-grid { grid-template-columns: 1fr; }
    .search-box { flex-direction: column; }
    .change-grid { grid-template-columns: repeat(2, 1fr); }
    .amenities-grid { grid-template-columns: repeat(2, 1fr); }
    .rental-stats { grid-template-columns: 1fr; }
    .signal-hero { grid-template-columns: 1fr; }
    .signal-metrics { grid-template-columns: 1fr; }
}
