/* PropertyHub MVP - Design System
   Custom CSS vars, Inter font, Feather SVG icons
   Inspired by Linear/Vercel/Stripe dashboards */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99,102,241,.08);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --bg: #f8f9fb;
  --sidebar-bg: #fff;
  --card: #fff;
  --card-hover: #f8f9fb;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(99,102,241,.3); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #000; }
.btn-outline { background: #fff; color: var(--text-dim); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── CARDS ─── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat-card .sub.up { color: var(--success); }

/* ─── BADGES ─── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.badge-pending { background: rgba(245,158,11,.1); color: #f59e0b; }
.badge-reviewing { background: rgba(59,130,246,.1); color: #3b82f6; }
.badge-quoted { background: rgba(99,102,241,.1); color: #6366f1; }
.badge-accepted { background: rgba(16,185,129,.1); color: #10b981; }
.badge-rejected { background: rgba(239,68,68,.1); color: #ef4444; }
.badge-scheduled { background: rgba(99,102,241,.1); color: #6366f1; }
.badge-in_progress { background: rgba(59,130,246,.1); color: #3b82f6; }
.badge-completed { background: rgba(16,185,129,.1); color: #10b981; }
.badge-cancelled { background: rgba(156,163,175,.1); color: #9ca3af; }
.badge-offered { background: rgba(245,158,11,.1); color: #f59e0b; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 14px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; font-family: inherit; transition: border .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 16px; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:hover { background: var(--card-hover); }

/* ─── FLASH MESSAGES ─── */
.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px;
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.flash-success { background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2); color: #047857; }
.flash-error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); color: #b91c1c; }
.flash-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: #92400e; }
.flash-info { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); color: #1e40af; }

/* ─── LAYOUT: DASHBOARD ─── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
  font-size: 18px; font-weight: 700; color: var(--text);
}
.sidebar-brand span { color: var(--primary); }
.sidebar-section { padding: 12px 0; }
.sidebar-section-title {
  padding: 0 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; color: var(--text-dim); font-size: 14px; font-weight: 500;
  transition: all .2s; cursor: pointer; border-left: 3px solid transparent;
}
.sidebar-item svg { width: 18px; height: 18px; }
.sidebar-item:hover { color: var(--text); background: var(--card-hover); }
.sidebar-item.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.sidebar-user .name { font-size: 13px; font-weight: 600; }
.sidebar-user .role { font-size: 11px; color: var(--text-muted); }

.main { margin-left: 260px; flex: 1; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 24px; }

/* ─── LAYOUT: PUBLIC ─── */
.navbar {
  position: sticky; top: 0; z-index: 100; background: #fff;
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar .brand { font-size: 18px; font-weight: 700; }
.navbar .brand span { color: var(--primary); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  padding: 6px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  color: var(--text-dim); transition: all .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--card-hover); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  padding: 80px 24px; text-align: center; color: #fff;
}
.hero h1 { font-size: clamp(32px, 5vw, 56px); font-weight: 900; margin-bottom: 16px; line-height: 1.1; }
.hero p { font-size: 18px; opacity: .85; max-width: 600px; margin: 0 auto 32px; font-weight: 400; }

/* Service cards */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.service-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06); transition: all .3s; cursor: pointer;
}
.service-card:hover { box-shadow: 0 8px 32px rgba(99,102,241,.15); transform: translateY(-4px); border-color: var(--primary); }
.service-card .icon {
  width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.service-card .icon svg { width: 24px; height: 24px; color: #fff; }
.service-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.service-card p { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.step { text-align: center; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; margin: 0 auto 12px;
}
.step h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.step p { font-size: 13px; color: var(--text-dim); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer;
  color: var(--text-muted); transition: all .2s;
}
.upload-zone:hover { border-color: var(--primary); color: var(--primary); }
.upload-zone svg { width: 32px; height: 32px; margin: 0 auto 8px; }

/* Estimate box */
.estimate-box {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border-radius: var(--radius-lg); padding: 24px; text-align: center;
}
.estimate-box .amount { font-size: 36px; font-weight: 800; }

/* Price table */
.price-table { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.price-table th { background: var(--bg); }
.price-table .price { color: var(--primary); font-weight: 700; }

/* Job cards (contractor) */
.job-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.job-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.job-card .job-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.job-card h3 { font-size: 15px; font-weight: 600; }
.job-card .pay { font-size: 20px; font-weight: 800; color: var(--primary); }
.job-card .meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.job-card .meta span { display: flex; align-items: center; gap: 4px; }
.job-card .meta svg { width: 14px; height: 14px; }
.job-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.job-card .tag { background: var(--bg); padding: 3px 10px; border-radius: 6px; font-size: 12px; color: var(--text-dim); }

/* Privacy notice */
.privacy-notice {
  background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
  display: flex; gap: 10px; align-items: flex-start;
}
.privacy-notice svg { width: 18px; height: 18px; color: #f59e0b; flex-shrink: 0; margin-top: 2px; }
.privacy-notice strong { color: #92400e; }
.privacy-notice p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* Status tracker */
.tracker { display: flex; gap: 0; margin: 24px 0; }
.tracker-step {
  flex: 1; text-align: center; position: relative; padding-top: 32px; font-size: 12px; color: var(--text-muted);
}
.tracker-step::before {
  content: ''; position: absolute; top: 10px; left: 0; right: 0; height: 2px; background: var(--border);
}
.tracker-step:first-child::before { left: 50%; }
.tracker-step:last-child::before { right: 50%; }
.tracker-step .dot {
  width: 20px; height: 20px; border-radius: 50%; background: var(--border);
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%); z-index: 1;
}
.tracker-step.done .dot { background: var(--success); }
.tracker-step.done::before { background: var(--success); }
.tracker-step.active .dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.2); }
.tracker-step.done, .tracker-step.active { color: var(--text); font-weight: 600; }

/* Gallery grid */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery-item {
  aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px; transition: all .2s;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item:hover { box-shadow: var(--shadow-md); }

/* Media grid (admin review) */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media-item {
  aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden;
  background: var(--bg); border: 1px solid var(--border); position: relative;
}
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item .media-badge {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6);
  color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px;
}

/* Footer */
.footer {
  background: #fff; border-top: 1px solid var(--border);
  padding: 48px 24px 24px; margin-top: 64px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; max-width: 1100px; margin: 0 auto; }
.footer h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.footer a { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; transition: color .2s; }
.footer a:hover { color: var(--primary); }
.footer-bottom { text-align: center; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }

/* Section */
.section { max-width: 1100px; margin: 0 auto; padding: 64px 24px; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: clamp(24px, 3vw, 36px); font-weight: 800; color: #0f172a; margin-bottom: 8px; }
.section-title p { font-size: 15px; color: var(--text-dim); }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-dim); transition: all .2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab {
  padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--text-dim);
  border-bottom: 2px solid transparent; transition: all .2s; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .nav-links { display: none; }
  .form-row { flex-direction: column; gap: 0; }
  .hero h1 { font-size: 28px; }
  .services-grid { grid-template-columns: 1fr; }
  .job-cards { grid-template-columns: 1fr; }
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
