/* ============================================================
   SKYLINE GLOW — Property Portfolio Manager
   Dark glass theme, ambient glow, premium type pairing
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  /* Core surface */
  --bg: #1b1d21;
  --bg-elevated: rgba(255, 255, 255, 0.05);
  --bg-elevated-hover: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.11);
  --border-glass-strong: rgba(255, 255, 255, 0.19);

  /* Accents */
  --gold: #f0b23d;
  --gold-soft: #f7cd7a;
  --gold-glow: rgba(240, 178, 61, 0.45);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.35);
  --green: #34d399;
  --green-glow: rgba(52, 211, 153, 0.35);
  --red: #f87171;
  --red-glow: rgba(248, 113, 113, 0.35);
  --amber: #fbbf5a;
  --violet: #a78bfa;
  --violet-glow: rgba(167, 139, 250, 0.4);

  /* Text */
  --text: #eef2f6;
  --text-dim: #b7c0cc;
  --muted: #8a94a3;
  --muted-dim: #5f6875;

  /* Geometry */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Ambient glow background ---------- */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
}
.ambient-glow-1 {
  width: 560px; height: 560px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  animation: drift1 24s ease-in-out infinite alternate;
}
.ambient-glow-2 {
  width: 620px; height: 620px;
  bottom: -220px; right: -160px;
  background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
  animation: drift2 28s ease-in-out infinite alternate;
}
@keyframes drift1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.12); }
}
@keyframes drift2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-50px, -30px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .ambient-glow { animation: none !important; }
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: 140px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(to top, rgba(255,255,255,0.05), transparent),
    repeating-linear-gradient(
      90deg,
      transparent 0 26px,
      rgba(240,178,61,0.06) 26px 28px
    );
  mask-image: linear-gradient(to top, black, transparent);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 70px;
  position: relative;
  z-index: 1;
  animation: pageIn 0.5s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .container { animation: none; }
}

/* ---------- Topbar ---------- */
.topbar {
  background: rgba(28, 30, 34, 0.75);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 18px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-display);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--gold-soft), var(--gold) 60%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav { display: flex; gap: 22px; flex: 1; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  border-radius: 2px;
  transition: width 0.25s ease;
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { width: 100%; }
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; color: var(--muted); }

/* ---------- Mobile nav toggle (hamburger → X) ---------- */
.nav-toggle {
  display: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 9px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-footer { display: none; }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: nowrap; justify-content: space-between; padding: 12px 16px; gap: 10px; }
  .brand { font-size: 1.05rem; }
  .user-menu { display: none; }
  .nav-toggle { display: flex; }

  .nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(28, 30, 34, 0.98);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border-glass);
    padding: 6px 18px 18px;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.3s ease, opacity 0.25s ease;
  }
  .nav.open { max-height: 480px; opacity: 1; pointer-events: auto; }
  .nav a {
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 1rem;
  }
  .nav a::after { display: none; }
  .nav a:hover { color: var(--gold-soft); }

  .nav-mobile-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none; }
  .nav-toggle span { transition: none; }
}

/* ---------- Headings & structure ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: 1.65rem; margin-bottom: 4px; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: #1a1305;
  box-shadow: 0 0 0 rgba(240,178,61,0);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px -6px var(--gold-glow), 0 0 0 1px rgba(240,178,61,0.3);
}
.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-glass);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--bg-elevated-hover); border-color: var(--border-glass-strong); transform: translateY(-1px); }
.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: #ffb4b4;
  border-color: rgba(248, 113, 113, 0.25);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.18); box-shadow: 0 4px 18px -6px var(--red-glow); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  animation: cardIn 0.5s ease both;
}
.stat-grid .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.07s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.17s; }
.stat-grid .stat-card:nth-child(5) { animation-delay: 0.22s; }
.stat-grid .stat-card:nth-child(6) { animation-delay: 0.27s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(240,178,61,0.08), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 178, 61, 0.35);
  box-shadow: 0 10px 34px -12px rgba(240, 178, 61, 0.28), 0 0 0 1px rgba(240,178,61,0.08);
}
.stat-card:hover::before { opacity: 1; }
.stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; position: relative; z-index: 1; }
.stat-value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; color: var(--text); position: relative; z-index: 1; letter-spacing: -0.01em; }
.stat-sub { font-size: 0.78rem; color: var(--muted-dim); position: relative; z-index: 1; font-family: var(--font-mono); }
.text-good { color: var(--green); text-shadow: 0 0 18px var(--green-glow); }
.text-bad { color: var(--red); text-shadow: 0 0 18px var(--red-glow); }

/* ---------- Panels ---------- */
.panel {
  background: var(--bg-elevated);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  transition: border-color 0.25s ease;
}
.panel:hover { border-color: var(--border-glass-strong); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head a { color: var(--cyan); text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.panel-head a:hover { text-decoration: underline; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border-glass); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table td { color: var(--text-dim); }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.row-overdue { background: rgba(248, 113, 113, 0.06); }
.row-overdue:hover { background: rgba(248, 113, 113, 0.1) !important; }
.table a { color: var(--cyan); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge-blue { background: rgba(34, 211, 238, 0.12); color: var(--cyan); }
.badge-blue::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.badge-green { background: rgba(52, 211, 153, 0.12); color: var(--green); }
.badge-green::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge-gray { background: rgba(255,255,255,0.06); color: var(--muted); }
.badge-gray::before { background: var(--muted); }
.badge-amber { background: rgba(240, 178, 61, 0.14); color: var(--gold-soft); }
.badge-amber::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.badge-red { background: rgba(248, 113, 113, 0.14); color: #ffb4b4; }
.badge-red::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.badge-violet { background: rgba(167, 139, 250, 0.14); color: var(--violet); }
.badge-violet::before { background: var(--violet); box-shadow: 0 0 8px var(--violet); }

/* ---------- Forms ---------- */
.form-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-dim); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(240, 178, 61, 0.15);
}
select { color-scheme: dark; }
select option {
  background: #24262b;
  color: var(--text);
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.inline-check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }

.inline-form { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px dashed var(--border-glass); }
.inline-form input, .inline-form select { padding: 8px 10px; font-size: 0.83rem; }

/* ---------- Scrollable tables (mobile) ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table-scroll .table { min-width: 560px; }
@media (min-width: 721px) {
  .table-scroll { overflow-x: visible; margin: 0; padding: 0; }
  .table-scroll .table { min-width: 0; }
}

a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Auth ---------- */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 78vh;
  position: relative;
}
.auth-card {
  background: rgba(30, 32, 36, 0.7);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6), 0 0 60px -20px rgba(240,178,61,0.15);
  animation: cardIn 0.6s ease both;
}
.auth-card h1 {
  font-size: 1.4rem;
  background: linear-gradient(120deg, var(--gold-soft), var(--gold) 55%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Alerts ---------- */
.alert { padding: 11px 15px; border-radius: 10px; font-size: 0.86rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: rgba(248, 113, 113, 0.1); color: #ffb4b4; border-color: rgba(248, 113, 113, 0.25); }
.alert-info { background: rgba(34, 211, 238, 0.1); color: #a6ecfb; border-color: rgba(34, 211, 238, 0.25); }

/* ---------- Property cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.property-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.property-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.property-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glass-strong);
  box-shadow: 0 14px 38px -16px rgba(0,0,0,0.6), 0 0 24px -10px var(--gold-glow);
}
.property-card:hover::before { transform: scaleX(1); }
.property-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.property-card-head h3 { font-size: 1rem; font-weight: 600; }
.property-card-foot { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); font-family: var(--font-mono); }

/* ---------- Filter chips ---------- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.chip:hover { border-color: var(--border-glass-strong); color: var(--text); }
.chip-active {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: #1a1305;
  border-color: transparent;
  box-shadow: 0 4px 18px -6px var(--gold-glow);
}
.chip-active:hover { color: #1a1305; }

/* ---------- Map ---------- */
.map-box {
  height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border-glass);
  filter: saturate(0.85) brightness(0.92);
}

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 26px; color: var(--muted-dim); font-size: 0.78rem; position: relative; z-index: 1; }

/* ---------- Mobile refinements for forms & buttons ---------- */
@media (max-width: 720px) {
  .container { padding: 20px 14px 60px; }
  .page-head h1 { font-size: 1.4rem; }
  .page-head .btn-primary { width: 100%; justify-content: center; }

  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select, .inline-form button, .inline-form .inline-check { width: 100%; }

  .form-card { padding: 20px; }
  .auth-card { padding: 30px 24px; max-width: 340px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 1.2rem; }

  .card-grid { grid-template-columns: 1fr; }

  .panel { padding: 16px; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
