:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #10b981;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
}

* { 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.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
main { flex: 1; }

/* Nav */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    width: 100%;
}
.logo { font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--text); }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.btn-sm {
    background: var(--primary); color: white !important; padding: 0.4rem 1rem;
    border-radius: 6px; font-weight: 600; font-size: 0.85rem;
}
.btn-sm:hover { background: var(--primary-dark); text-decoration: none; }

/* Buttons */
.btn {
    display: inline-block; padding: 0.75rem 1.5rem; border-radius: 8px;
    font-weight: 600; font-size: 1rem; text-align: center;
    background: var(--primary); color: white; border: none; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); text-decoration: none; }
.btn-outline {
    background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); }

/* Search */
.search-box { max-width: 600px; margin: 0 auto; width: 100%; }
.search-wrap {
    display: flex; gap: 0; border-radius: 12px; overflow: hidden;
    border: 2px solid var(--border); transition: border-color 0.2s;
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-wrap input {
    flex: 1; padding: 1rem 1.25rem; font-size: 1.1rem;
    background: var(--bg-card); color: var(--text); border: none; outline: none;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap button {
    padding: 1rem 2rem; background: var(--primary); color: white;
    border: none; font-weight: 700; font-size: 1rem; cursor: pointer;
    transition: background 0.2s;
}
.search-wrap button:hover { background: var(--primary-dark); }
.search-tags {
    display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem;
    flex-wrap: wrap; justify-content: center;
}
.search-tags span { color: var(--text-muted); font-size: 0.85rem; }
.search-tags a {
    background: var(--bg-card); padding: 0.25rem 0.75rem; border-radius: 20px;
    font-size: 0.85rem; color: var(--text-muted); border: 1px solid var(--border);
}
.search-tags a:hover { color: var(--text); border-color: var(--primary); text-decoration: none; }

/* Autocomplete */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}
.ac-item {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-active {
    background: var(--primary);
    color: white;
}

/* Hero */
.hero {
    max-width: 1200px; margin: 0 auto; padding: 6rem 2rem 4rem; text-align: center;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.1) 0%, transparent 60%);
}
.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15;
    margin-bottom: 1.25rem;
}
.accent { color: var(--accent); }
.hero-sub {
    font-size: 1.15rem; color: var(--text-muted); max-width: 550px;
    margin: 0 auto 2.5rem;
}

/* Cards / Features */
.features, .how-it-works, .cta-section {
    max-width: 1200px; margin: 0 auto; padding: 4rem 2rem;
}
.features h2, .how-it-works h2, .cta-section h2 {
    text-align: center; font-size: 2rem; margin-bottom: 0.5rem;
}
.section-sub {
    text-align: center; color: var(--text-muted); max-width: 500px;
    margin: 0 auto 2.5rem; font-size: 1.05rem;
}
.feature-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem;
}
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.5rem;
}
.card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.card h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.card p { color: var(--text-muted); font-size: 0.9rem; }

/* Steps */
.steps {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem; text-align: center; margin-top: 2rem;
}
.step-num {
    width: 44px; height: 44px; border-radius: 50%; background: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 700; margin-bottom: 0.75rem;
}
.step h3 { margin-bottom: 0.4rem; }
.step p { color: var(--text-muted); font-size: 0.9rem; }

/* CTA */
.cta-section { text-align: center; padding-top: 3rem; }
.cta-section p { color: var(--text-muted); margin-bottom: 2rem; }

/* Results */
.results-header {
    max-width: 1200px; margin: 0 auto; padding: 2rem 2rem 0;
}
.mode-tabs {
    display: flex; gap: 0; margin-top: 1rem; border-bottom: 2px solid var(--border);
}
.tab {
    padding: 0.6rem 1.5rem; color: var(--text-muted); font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.results-body, .suburb-profile, .calc-page, .pricing-page, .legal-page {
    max-width: 1200px; margin: 0 auto; padding: 2rem;
}

/* Stats bar */
.stats-bar {
    display: flex; gap: 1.5rem; flex-wrap: wrap; padding: 1rem 0;
    border-bottom: 1px solid var(--border); margin-bottom: 1.5rem;
}
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* Listings grid */
.listings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem;
}
.listing-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 1.25rem; position: relative; transition: border-color 0.2s, transform 0.2s;
    text-decoration: none; color: var(--text); display: block;
}
.listing-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.listing-price { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.25rem; }
.listing-address { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.listing-features {
    display: flex; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted);
}
.listing-yield { margin-top: 0.5rem; }
.yield-badge {
    background: rgba(16, 185, 129, 0.15); color: var(--accent);
    padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600;
}
.rent-est { color: var(--text-muted); font-size: 0.8rem; margin-left: 0.5rem; }
.score-badge {
    position: absolute; top: 1rem; right: 1rem; width: 36px; height: 36px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.score-high { background: var(--accent); color: white; }
.score-mid { background: #f59e0b; color: white; }
.score-low { background: var(--border); color: var(--text-muted); }

.listing-actions { margin-top: 0.5rem; }
.btn-tiny {
    font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 4px;
    background: var(--primary); color: white; font-weight: 600;
    display: inline-block;
}
.btn-tiny:hover { background: var(--primary-dark); text-decoration: none; }
.analysis-score {
    text-align: center; font-size: 1.5rem; padding: 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; margin-bottom: 2rem;
}
.analysis-score strong { font-size: 2.5rem; color: var(--accent); }
/* Analysis Sections */
.analysis-section { margin-bottom: 3rem; padding-bottom: 3rem; border-bottom: 1px solid var(--border); }
.analysis-section:last-child { border-bottom: none; }
.analysis-section h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.fhb-note { color: var(--accent); padding: 0.3rem 0; font-size: 0.95rem; }

/* Loading */
.loading { text-align: center; padding: 4rem 2rem; }
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.error-msg { text-align: center; padding: 2rem; color: var(--danger); }
.no-results { text-align: center; padding: 2rem; color: var(--text-muted); grid-column: 1 / -1; }

/* Profile */
.suburb-profile h1 { font-size: 2rem; margin-bottom: 1.5rem; }
.profile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem;
    margin-bottom: 2rem;
}
.profile-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 1.25rem; text-align: center;
}
.profile-card.highlight { border-color: var(--accent); }
.profile-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.profile-value { font-size: 1.4rem; font-weight: 700; }
.profile-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Calculator */
.calc-page h1 { text-align: center; font-size: 2rem; margin-bottom: 0.5rem; }
.calc-form { max-width: 600px; margin: 2rem auto; }
.calc-inputs {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem;
    align-items: end;
}
.calc-inputs label {
    display: flex; flex-direction: column; gap: 0.3rem;
    font-size: 0.85rem; color: var(--text-muted);
}
.calc-inputs input {
    padding: 0.6rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 1rem;
}
.calc-grid { margin-bottom: 2rem; }
/* Tables */
.scenarios-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scenarios-table table {
    width: 100%; border-collapse: collapse; min-width: 600px;
}
.scenarios-table th, .scenarios-table td {
    padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border);
}
.scenarios-table tr:nth-child(even) { background: rgba(255,255,255,0.03); }
.scenarios-table th { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.scenarios-table tr.positive td { color: var(--accent); }
.scenarios-table tr.negative td { color: var(--text-muted); }
.scenarios-table h3 { margin: 2rem 0 1rem; }

/* Pricing */
.pricing-page h1 { text-align: center; font-size: 2rem; margin-bottom: 0.5rem; }
.pricing-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem; max-width: 900px; margin: 2rem auto 0;
}
.price-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 2rem; text-align: center; position: relative;
}
.price-card.featured { border-color: var(--primary); }
.popular-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: white; padding: 0.2rem 1rem;
    border-radius: 20px; font-size: 0.8rem; font-weight: 600;
}
.price-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.price-amount { font-size: 2.5rem; font-weight: 800; margin: 1rem 0; }
.price-amount span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.price-card ul { list-style: none; text-align: left; margin: 1.5rem 0; }
.price-card li { padding: 0.3rem 0; color: var(--text-muted); font-size: 0.9rem; }
.price-card li::before { content: '✓ '; color: var(--accent); font-weight: 700; }

/* Legal */
.legal-page { max-width: 800px; }
.legal-page h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.legal-page .date { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.legal-page h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; color: var(--primary); }
.legal-page p, .legal-page li { color: var(--text-muted); margin-bottom: 0.5rem; }
.legal-page ul { padding-left: 1.5rem; }

/* Footer */
footer {
    border-top: 1px solid var(--border); margin-top: 2rem;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto; padding: 1.5rem 2rem;
    text-align: center; color: var(--text-muted); font-size: 0.85rem;
}
.footer-inner a { color: var(--text-muted); }
.footer-inner p + p { margin-top: 0.25rem; }

/* Auth Pages */
.auth-page {
    display: flex; justify-content: center; align-items: center;
    min-height: 60vh; padding: 2rem;
}
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 420px;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-sub { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.auth-card label {
    display: flex; flex-direction: column; gap: 0.3rem;
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem;
}
.auth-card input {
    padding: 0.7rem; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 1rem;
}
.auth-card input:focus { border-color: var(--primary); outline: none; }
.auth-error {
    background: rgba(239, 68, 68, 0.15); color: var(--danger);
    padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1rem;
    font-size: 0.9rem;
}
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* Nav User Dropdown */
.nav-user {
    position: relative; cursor: pointer;
}
.nav-user-email {
    color: var(--text); font-weight: 500; font-size: 0.95rem;
    padding: 0.4rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px;
}
.nav-dropdown {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 0.5rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    min-width: 140px; z-index: 100; overflow: hidden;
}
.nav-user:hover .nav-dropdown { display: block; }
.nav-dropdown a {
    display: block; padding: 0.6rem 1rem; color: var(--text-muted); font-size: 0.9rem;
}
.nav-dropdown a:hover { background: var(--primary); color: white; text-decoration: none; }

/* Rate Limit Banner */
.rate-limit-banner {
    background: var(--bg-card); border: 1px solid var(--primary);
    border-radius: 12px; padding: 2rem; text-align: center; margin: 2rem auto;
    max-width: 500px;
}
.rate-limit-banner h3 { margin-bottom: 0.5rem; }
.rate-limit-banner p { color: var(--text-muted); margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    .hero { padding: 3rem 1.5rem 2rem; }
    .nav-links { gap: 0.75rem; }
    .search-wrap button { padding: 1rem 1rem; }
    .listings-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: 1fr; }
}
