/* ================================================================
   FRIP — Fractional Rental Investment Platform
   Design: Dark fintech aesthetic — navy + teal, clean geometry
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Mono:wght@400;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
    --navy:        #09090F;
    --navy-light:  #111119;
    --navy-mid:    #1A1A26;
    --teal:        #6366F1;
    --teal-light:  #818CF8;
    --teal-glow:   rgba(99,102,241,.2);
    --mint:        #C7D2FE;
    --white:       #F1F5F9;
    --white-dim:   #94A3B8;
    --white-muted: #64748B;
    --danger:      #EF4444;
    --success:     #10B981;
    --warning:     #F59E0B;
    --card-bg:     rgba(255,255,255,.04);
    --card-border: rgba(255,255,255,.09);
    --font-body:   'DM Sans', system-ui, sans-serif;
    --font-mono:   'Space Mono', monospace;
    --radius:      12px;
    --radius-sm:   8px;
    --radius-lg:   20px;
    --transition:  .25s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-body);
    background: var(--navy);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--teal-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--mint); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* ── Utility ────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hidden { display: none !important; }
.text-teal { color: var(--teal-light); }
.text-muted { color: var(--white-muted); }
.text-mono { font-family: var(--font-mono); }

/* ── Background Texture (subtle grid) ───────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ── Top Nav ────────────────────────────────────────────────────── */
.topnav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(9,9,15,.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    padding: 0 24px;
}
.topnav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.topnav-logo {
    font-family: var(--font-mono);
    font-weight: 700; font-size: 1.35rem;
    color: var(--white);
    letter-spacing: -.02em;
    display: flex; align-items: center; gap: 8px;
}
.topnav-logo .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--teal-light);
    box-shadow: 0 0 8px var(--teal-glow);
    animation: pulse-dot 2.5s infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 6px var(--teal-glow); }
    50% { box-shadow: 0 0 18px var(--teal-light); }
}
.topnav-links { display: flex; align-items: center; gap: 8px; }
.topnav-links a,
.topnav-links button {
    padding: 8px 18px; border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 500;
    border: none; cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.topnav-links a { color: var(--white-dim); background: transparent; }
.topnav-links a:hover,
.topnav-links a.active { color: var(--white); background: var(--navy-mid); }
.topnav-links .btn-nav-primary {
    background: var(--teal); color: #fff;
}
.topnav-links .btn-nav-primary:hover { background: var(--teal-light); }
.topnav-links .btn-nav-ghost {
    background: transparent; color: var(--white-dim);
}
.topnav-links .btn-nav-ghost:hover { color: var(--white); background: rgba(255,255,255,.06); }

/* mobile hamburger */
.hamburger { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; padding: 4px; }
@media (max-width: 768px) {
    .hamburger { display: block; }
    .topnav-links {
        display: none; flex-direction: column;
        position: absolute; top: 64px; left: 0; right: 0;
        background: var(--navy-light); padding: 16px; gap: 8px;
        border-bottom: 1px solid var(--card-border);
    }
    .topnav-links.open { display: flex; }
    .topnav-links a, .topnav-links button { width: 100%; text-align: center; }
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 28px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: .9375rem;
    border: none; cursor: pointer;
    transition: all var(--transition);
    position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.1) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform .5s;
}
.btn:hover::after { transform: translateX(100%); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-light); transform: translateY(-1px); box-shadow: 0 4px 24px var(--teal-glow); }
.btn-secondary { background: var(--navy-mid); color: var(--white); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: var(--navy-light); border-color: var(--teal); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 16px 36px; font-size: 1.0625rem; border-radius: var(--radius); }
.btn-sm { padding: 8px 18px; font-size: .8125rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form Elements ──────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: .8125rem; font-weight: 500;
    color: var(--white-dim); text-transform: uppercase; letter-spacing: .05em;
}
.form-control {
    width: 100%; padding: 12px 16px;
    background: var(--navy-mid); border: 1px solid var(--card-border);
    border-radius: var(--radius-sm); color: var(--white);
    font-size: .9375rem; transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control::placeholder { color: var(--white-muted); }
.form-control:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}
.form-error {
    color: var(--danger); font-size: .8125rem;
    margin-top: 6px; min-height: 1.2em;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
    border-color: rgba(20,184,166,.15);
}
.card-flat { padding: 24px; border-radius: var(--radius); }
.card-flat:hover { transform: none; box-shadow: none; }

/* ── Badge / Tag ────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 12px; border-radius: 999px;
    font-size: .75rem; font-weight: 600; letter-spacing: .03em;
}
.badge-teal { background: rgba(20,184,166,.15); color: var(--teal-light); }
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.15); color: var(--danger); }

/* ── Progress Bar ───────────────────────────────────────────────── */
.progress-track {
    width: 100%; height: 8px;
    background: var(--navy-mid); border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), var(--teal-light));
    transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ================================================================
   PAGE: HERO / LANDING
   ================================================================ */
.hero {
    padding: 100px 0 60px;
    text-align: center;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
    width: 700px; height: 700px;
    background: radial-gradient(circle, var(--teal-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: .45;
}
.hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 4rem);
    font-weight: 700; line-height: 1.1;
    letter-spacing: -.03em;
    margin-bottom: 20px;
}
.hero h1 span { color: var(--teal-light); }
.hero p {
    max-width: 600px; margin: 0 auto 36px;
    font-size: 1.125rem; color: var(--white-dim);
    line-height: 1.7;
}
.hero-stats {
    display: flex; justify-content: center; gap: 48px;
    margin-top: 56px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat .num {
    font-family: var(--font-mono); font-size: 2rem; font-weight: 700;
    color: var(--teal-light);
}
.hero-stat .label {
    font-size: .8125rem; color: var(--white-muted);
    margin-top: 4px;
}

/* Featured properties strip */
.section-title {
    font-size: 1.75rem; font-weight: 700;
    margin-bottom: 8px; letter-spacing: -.02em;
}
.section-sub {
    color: var(--white-muted); margin-bottom: 40px;
    font-size: 1rem;
}
.section { padding: 80px 0; }

/* ================================================================
   PAGE: PROPERTIES LISTING
   ================================================================ */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}
.prop-card { cursor: pointer; overflow: hidden; padding: 0; }
.prop-card-img {
    height: 200px; background: var(--navy-mid);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.prop-card-img svg,
.prop-card-img img {
    width: 100%; height: 100%; object-fit: cover;
}
.prop-card-body { padding: 24px; }
.prop-card-address {
    font-size: 1.0625rem; font-weight: 600;
    margin-bottom: 12px; line-height: 1.35;
}
.prop-card-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-bottom: 16px;
}
.prop-card-stat-label {
    font-size: .6875rem; color: var(--white-muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 2px;
}
.prop-card-stat-value {
    font-family: var(--font-mono); font-size: .9375rem; font-weight: 600;
}

/* ================================================================
   PAGE: PROPERTY DETAIL
   ================================================================ */
.detail-hero {
    padding: 40px 0 0;
}
.detail-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .875rem; color: var(--white-muted);
    margin-bottom: 24px; cursor: pointer; transition: color var(--transition);
}
.detail-back:hover { color: var(--white); }
.detail-grid {
    display: grid; grid-template-columns: 1fr 380px; gap: 40px;
    align-items: start;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-img {
    height: 320px; border-radius: var(--radius-lg);
    background: var(--navy-mid); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 28px;
}
.detail-img svg, .detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-address {
    font-size: 1.75rem; font-weight: 700;
    margin-bottom: 8px; letter-spacing: -.02em;
}
.detail-description {
    color: var(--white-dim); line-height: 1.75;
    margin-bottom: 32px;
}
.detail-metrics {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px;
    margin-bottom: 32px;
}
.detail-metric .label {
    font-size: .6875rem; color: var(--white-muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 4px;
}
.detail-metric .value {
    font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700;
}
.detail-investors-title {
    font-size: 1.125rem; font-weight: 600;
    margin-bottom: 16px;
}
.investor-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
    font-size: .875rem;
}
.investor-row:last-child { border-bottom: none; }
.investor-name { font-weight: 500; }
.investor-share { font-family: var(--font-mono); color: var(--teal-light); }

/* Invest sidebar card */
.invest-card { position: sticky; top: 88px; }
.invest-card h3 {
    font-size: 1.25rem; font-weight: 700; margin-bottom: 4px;
}
.invest-card .capacity-note {
    font-size: .8125rem; color: var(--white-muted);
    margin-bottom: 20px;
}

/* Amount input with $ prefix */
.amount-input-wrap { position: relative; }
.amount-prefix {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--white-muted); font-family: var(--font-mono);
    font-size: 1rem; pointer-events: none; line-height: 1;
}
.amount-field {
    padding-left: 28px !important;
    font-family: var(--font-mono) !important;
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
}

/* Quick-select preset buttons */
.amount-presets {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
    margin-top: 10px;
}
.amount-preset-btn {
    padding: 7px 0; border-radius: var(--radius-sm);
    background: var(--navy-mid); border: 1px solid var(--card-border);
    color: var(--white-dim); font-size: .8125rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-align: center;
}
.amount-preset-btn:hover { background: var(--teal-glow); border-color: var(--teal); color: var(--teal-light); }
.amount-preset-btn.active { background: var(--teal-glow); border-color: var(--teal-light); color: var(--teal-light); }

/* Live investment preview panel */
.invest-preview {
    background: var(--navy-mid); border: 1px solid var(--card-border);
    border-radius: var(--radius-sm); padding: 14px 16px;
    margin: 14px 0 4px;
}
.invest-preview-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: .875rem;
}
.invest-preview-row + .invest-preview-row { border-top: 1px solid var(--card-border); }
.invest-preview-row span { color: var(--white-muted); }
.invest-preview-row strong { font-family: var(--font-mono); font-weight: 600; color: var(--white); }

/* ── Risk Assessment ────────────────────────────────────────────── */
.risk-header {
    display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.risk-score-num {
    font-family: var(--font-mono); font-size: 2rem; font-weight: 700; line-height: 1;
}
.risk-score-denom {
    font-size: .8125rem; color: var(--white-muted);
    font-family: var(--font-body); margin-left: 2px;
}
.risk-factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.risk-factor {
    background: var(--navy-mid); border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.risk-factor-label {
    font-size: .75rem; color: var(--white-muted);
    text-transform: uppercase; letter-spacing: .05em;
    margin-bottom: 6px;
}
.risk-factor-val {
    font-family: var(--font-mono); font-size: .875rem;
    font-weight: 600; margin-bottom: 6px;
}

/* ================================================================
   PAGE: AUTH (Login / Register)
   ================================================================ */
.auth-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 64px); padding: 40px 24px;
}
.auth-box {
    width: 100%; max-width: 420px;
}
.auth-box h2 {
    font-size: 1.75rem; font-weight: 700; margin-bottom: 8px;
}
.auth-box .sub {
    color: var(--white-muted); margin-bottom: 32px;
}
.auth-toggle {
    text-align: center; margin-top: 24px; font-size: .875rem; color: var(--white-muted);
}
.auth-toggle a { font-weight: 600; }

/* ================================================================
   PAGE: DASHBOARD
   ================================================================ */
.dash-header { padding: 40px 0 0; }
.dash-header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 4px; }
.dash-header p { color: var(--white-muted); margin-bottom: 32px; }

.dash-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 48px;
}
.dash-summary-card {
    padding: 24px; border-radius: var(--radius);
    background: var(--card-bg); border: 1px solid var(--card-border);
}
.dash-summary-card .label {
    font-size: .75rem; color: var(--white-muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 8px;
}
.dash-summary-card .value {
    font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700;
}
.dash-summary-card .value.teal { color: var(--teal-light); }

.dash-section-title {
    font-size: 1.25rem; font-weight: 700;
    margin-bottom: 20px; letter-spacing: -.01em;
}
.dash-chart-wrap {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius-lg); padding: 28px;
    margin-bottom: 48px; max-width: 520px;
}
.holdings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px; margin-bottom: 48px;
}
.holding-card { padding: 20px; border-radius: var(--radius); }
.holding-card .address { font-weight: 600; margin-bottom: 8px; font-size: .9375rem; }
.holding-card .holding-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.holding-card .holding-stat-label { font-size: .6875rem; color: var(--white-muted); text-transform: uppercase; letter-spacing: .05em; }
.holding-card .holding-stat-value { font-family: var(--font-mono); font-weight: 600; font-size: .9375rem; }

/* Transaction table */
.tx-table-wrap { overflow-x: auto; margin-bottom: 80px; }
.tx-table {
    width: 100%; border-collapse: collapse;
    font-size: .875rem;
}
.tx-table th {
    text-align: left; padding: 12px 16px;
    font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--white-muted); border-bottom: 1px solid var(--card-border);
}
.tx-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    color: var(--white-dim);
}
.tx-table tr:hover td { background: rgba(255,255,255,.02); }

/* ================================================================
   PAGE: ADMIN
   ================================================================ */
.admin-section { padding: 48px 0 80px; }
.admin-section h1 { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.admin-section > .container > p { color: var(--white-muted); margin-bottom: 32px; }
.admin-prop-card {
    padding: 24px; border-radius: var(--radius);
    background: var(--card-bg); border: 1px solid var(--card-border);
    margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
}
.admin-prop-info { flex: 1; min-width: 200px; }
.admin-prop-info .addr { font-weight: 600; margin-bottom: 4px; }
.admin-prop-info .meta { font-size: .8125rem; color: var(--white-muted); }
.admin-actions { display: flex; align-items: center; gap: 12px; }
.admin-actions input {
    width: 140px; padding: 10px 12px;
    background: var(--navy-mid); border: 1px solid var(--card-border);
    border-radius: var(--radius-sm); color: var(--white);
    font-family: var(--font-mono); font-size: .875rem;
}

/* ================================================================
   TOAST / Notifications
   ================================================================ */
.toast-container {
    position: fixed; top: 80px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 24px; border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 500;
    color: #fff; min-width: 280px; max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    animation: toast-in .3s ease-out;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.toast-success { background: #065F46; border: 1px solid var(--success); }
.toast-error { background: #7F1D1D; border: 1px solid var(--danger); }
.toast-info { background: var(--navy-mid); border: 1px solid var(--teal); }
.toast .close-toast {
    background: none; border: none; color: rgba(255,255,255,.6);
    cursor: pointer; font-size: 1.1rem; padding: 0; line-height: 1;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ================================================================
   LOADING SPINNER
   ================================================================ */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--card-border);
    border-top-color: var(--teal-light);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
    padding: 40px 0;
    border-top: 1px solid var(--card-border);
    text-align: center; font-size: .8125rem;
    color: var(--white-muted);
}

/* ================================================================
   PAGE TRANSITIONS
   ================================================================ */
.page { display: none; animation: fade-in .35s ease; }
.page.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ================================================================
   RESPONSIVE TWEAKS
   ================================================================ */
@media (max-width: 640px) {
    .hero { padding: 60px 0 40px; }
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 24px; }
    .properties-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .invest-card { position: static; }
    .dash-summary { grid-template-columns: 1fr; }
    .holdings-grid { grid-template-columns: 1fr; }
    .admin-prop-card { flex-direction: column; align-items: flex-start; }
}