/* ─── ImóvelBot — Dark Theme ─────────────────────────────────── */
:root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface2: #222244;
    --border: #2a2a4a;
    --text: #e0e0e0;
    --text2: #888;
    --accent: #7b2ff7;
    --green: #00c853;
    --red: #ef5350;
    --orange: #ff9100;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ─── Nav ─────────────────────────────────────────────────────── */
nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.2rem;
}
.nav-logo { font-size: 1.5rem; }
.nav-subtitle { font-size: 0.8rem; color: var(--text2); font-weight: 400; }
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
    color: var(--text2);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: var(--surface2);
}
.nav-info { margin-left: auto; }
.last-scan { font-size: 0.8rem; color: var(--text2); }

/* ─── Main ────────────────────────────────────────────────────── */
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text2);
    font-size: 1.1rem;
}

/* ─── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}
.stat-card.highlight {
    border-color: var(--green);
    background: linear-gradient(135deg, var(--surface) 0%, #0d3320 100%);
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}
.stat-card.highlight .stat-value { color: var(--green); }
.stat-label { font-size: 0.85rem; color: var(--text2); margin-top: 0.25rem; }

/* ─── Charts ──────────────────────────────────────────────────── */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
    .charts-row { grid-template-columns: 1fr; }
}
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.chart-card h3 { margin-bottom: 1rem; font-size: 1rem; }

.bar-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-item { display: flex; align-items: center; gap: 0.75rem; }
.bar-label { min-width: 120px; font-size: 0.85rem; color: var(--text2); }
.bar-track {
    flex: 1;
    height: 24px;
    background: var(--surface2);
    border-radius: 12px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #9c5aff);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    min-width: 30px;
    transition: width 0.5s;
}
.bar-fill.portal {
    background: linear-gradient(90deg, #4fc3f7, #29b6f6);
}

/* ─── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.toolbar h3 { font-size: 1.1rem; }
.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.filters input, .filters select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.filters input:focus, .filters select:focus {
    border-color: var(--accent);
}
.filters input::placeholder { color: #555; }
.filters input[type="number"] { width: 100px; }

.btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.btn:hover { background: #6a1fd4; }
.btn-link {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    padding: 0.6rem 1.2rem;
}

.imovel-count {
    font-size: 0.85rem;
    color: var(--text2);
    margin-bottom: 0.75rem;
}

/* ─── Imóveis Grid ────────────────────────────────────────────── */
.imoveis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.imovel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.imovel-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(123, 47, 247, 0.1);
}
.imovel-card.alvo {
    border-color: var(--green);
    background: linear-gradient(135deg, var(--surface) 0%, #0d3320 100%);
}
.imovel-card.alvo:hover {
    box-shadow: 0 8px 25px rgba(0, 200, 83, 0.15);
}
.imovel-card.novo {
    border-color: var(--orange);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-bairro { font-weight: 600; color: #fff; }
.card-portal {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: var(--surface2);
    border-radius: 6px;
    color: var(--text2);
}
.card-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}
.card-details {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text2);
}
.card-details b { color: var(--text); }
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}
.card-visto { color: var(--text2); }
.tag-alvo { font-size: 1.2rem; }

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 1.2rem;
    cursor: pointer;
}
.modal-close:hover { color: #fff; }
.modal-header { margin-bottom: 1rem; }
.modal-header h2 { font-size: 1.2rem; }
.modal-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 0.25rem;
}
.modal-cond {
    font-size: 0.9rem;
    color: var(--text2);
    margin-bottom: 1rem;
}
.modal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.modal-details div { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.modal-details span { color: var(--text2); }
.modal-desc {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface2);
    border-radius: 8px;
}
.modal-desc h4 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.modal-desc p { font-size: 0.85rem; color: var(--text2); line-height: 1.6; }
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.alvo-badge {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #0d3320;
    border: 1px solid var(--green);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--green);
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 3rem;
    color: var(--text2);
}
