/* ==========================================================================
   PropManWay — core stylesheet
   Theme system: every color reference uses a CSS custom property below.
   theme.js overwrites these at runtime with a property's custom palette
   (fetched from GET /properties/{id}/theme) when one exists; otherwise
   these WAY defaults stand as-is. Property-scoped variables are applied
   on the #app-root element, not :root, so a page can render a specific
   property's theme without affecting global chrome if ever needed.
   ========================================================================== */

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

:root {
  /* WAY default palette — mirrors App\Models\PropertyTheme::WAY_DEFAULT keys
     exactly (t9..t0, gold) so the API response maps straight onto these. */
  --t9: #0B2A4A;   /* deepest navy — headers, hero backgrounds */
  --t8: #123C66;   /* primary bar/button background */
  --t7: #1B5087;   /* interactive accent, active states, links */
  --t5: #3B76B3;   /* primary blue — buttons, highlights */
  --t3: #7FA8D4;   /* light blue-gray — secondary accents */
  --t0: #EAF1F9;   /* pale tint — subtle backgrounds, badges */
  --gold: #E68A2E; /* orange/gold accent — CTAs, alerts, brand mark */

  /* Structural tokens — not part of the per-property palette, stay fixed
     app-wide regardless of theme. */
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --card2: #F1F4F8;
  --border: rgba(15, 35, 60, 0.12);
  --border2: rgba(15, 35, 60, 0.07);
  --tx: #14202E;
  --tx2: #47576B;
  --tx3: #8592A3;
  --danger: #CC2222;
  --danger-bg: #FEF2F2;
  --success: #1E9E5A;
  --success-bg: #EAF9EF;
  --warn: #B45309;
  --warn-bg: #FFF3E0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 2px 10px rgba(15, 35, 60, 0.06);
  --shadow-float: 0 8px 32px rgba(15, 35, 60, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1620;
    --card: #16202C;
    --card2: #1C2836;
    --border: rgba(255, 255, 255, 0.10);
    --border2: rgba(255, 255, 255, 0.06);
    --tx: #F2F5F8;
    --tx2: #B9C3CF;
    --tx3: #7C8A99;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--tx);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .display-font {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Layout shell ─────────────────────────────────────────────────── */

#app-root { min-height: 100vh; display: flex; flex-direction: column; }

.top-bar {
  background: linear-gradient(135deg, var(--t9), var(--t8));
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.top-bar .brand { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.top-bar .role-label { font-size: 10px; font-weight: 400; color: rgba(255,255,255,.55); letter-spacing: .14em; text-transform: uppercase; margin-top: 2px; }
.top-bar .actions { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: #fff;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative;
  color: #fff;
}
.icon-btn .badge-dot {
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  background: var(--gold); border-radius: 50%; border: 1.5px solid var(--t8);
}

.content-scroll { flex: 1; padding: 16px 16px 90px; max-width: 720px; margin: 0 auto; width: 100%; }

.bottom-nav {
  background: var(--card); border-top: 0.5px solid var(--border2);
  display: flex; position: sticky; bottom: 0; z-index: 40;
  max-width: 720px; margin: 0 auto; width: 100%;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 10px 4px 12px; border: none; background: transparent; cursor: pointer;
  min-height: 56px; position: relative; color: var(--tx3);
}
.nav-btn .label { font-size: 10px; }
.nav-btn.active { color: var(--t7); }
.nav-btn.active .label { font-weight: 500; }
.nav-btn .indicator {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 20px; height: 2px; background: var(--t7); border-radius: 1px; display: none;
}
.nav-btn.active .indicator { display: block; }

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 18px; border-radius: var(--radius-md); border: none; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: 'DM Sans', sans-serif;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--t8), var(--t5)); color: #fff; }
.btn-accent { background: var(--gold); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--card2); color: var(--tx2); }
.btn-outline { background: transparent; color: var(--t7); border: 1px solid var(--t7); }
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: var(--radius-sm); }

/* ── Cards ────────────────────────────────────────────────────────── */

.card {
  background: var(--card); border: 0.5px solid var(--border2);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  padding: 16px;
}

/* ── Forms ────────────────────────────────────────────────────────── */

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 10px; font-weight: 500; color: var(--tx3);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border: 0.5px solid var(--border);
  border-radius: 10px; background: var(--card); color: var(--tx);
  font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--t5); box-shadow: 0 0 0 3px rgba(59, 118, 179, 0.15);
}
.field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.field-error {
  font-size: 12px; color: var(--danger); background: var(--danger-bg);
  border: 0.5px solid rgba(204,34,34,.25); border-radius: 9px; padding: 9px 11px;
  margin-bottom: 14px; display: none;
}
.field-error.show { display: block; }
.field-success {
  font-size: 12px; color: var(--success); background: var(--success-bg);
  border: 0.5px solid rgba(30,158,90,.25); border-radius: 9px; padding: 9px 11px;
  margin-bottom: 14px; display: none;
}
.field-success.show { display: block; }

/* ── Sheets / modals ──────────────────────────────────────────────── */

.sheet-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(11,26,46,.5);
  z-index: 200; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  background: var(--card); border-radius: 20px 20px 0 0; padding: 0 0 32px;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-float);
}
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 12px auto 16px; }
.sheet-header {
  padding: 0 18px 14px; border-bottom: 0.5px solid var(--border2);
  display: flex; align-items: center; justify-content: space-between;
}
.sheet-title { font-size: 18px; font-weight: 500; color: var(--tx); }
.sheet-close {
  width: 28px; height: 28px; border-radius: 50%; background: var(--card2);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--tx2);
}
.sheet-body { padding: 18px; }

/* ── Toast ────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  border-radius: 12px; padding: 12px 20px; font-size: 13px; font-weight: 500;
  z-index: 500; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--t8); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: #185FA5; color: #fff; }

/* ── Badges / pills ───────────────────────────────────────────────── */

.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.badge-info { background: var(--t0); color: var(--t7); border: 0.5px solid var(--t3); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 0.5px solid rgba(204,34,34,.2); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border: 0.5px solid rgba(180,83,9,.2); }
.badge-success { background: var(--success-bg); color: var(--success); border: 0.5px solid rgba(30,158,90,.2); }

/* ── Utility ──────────────────────────────────────────────────────── */

.text-muted { color: var(--tx3); }
.text-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
