/* ============================================================
   JC Apartments — styles.css  (Dark Theme — all pages)
   ============================================================ */

/* ── Animations ── */
@keyframes gradientShift {
  0%, 100% { background: linear-gradient(180deg, #1c2333 0%, #111827 100%); }
  50% { background: linear-gradient(180deg, #1f2844 0%, #16213e 100%); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-2px); }
}

@keyframes glow {
  0%, 100% { text-shadow: 0 0 10px rgba(77,86,214,0), 0 0 20px rgba(77,86,214,0); }
  50% { text-shadow: 0 0 10px rgba(77,86,214,.3), 0 0 20px rgba(77,86,214,.15); }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes buttonPulse {
  0% { box-shadow: 0 0 0 0 rgba(77,86,214,.4); }
  70% { box-shadow: 0 0 0 10px rgba(77,86,214,0); }
  100% { box-shadow: 0 0 0 0 rgba(77,86,214,0); }
}

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

/* ── Base — dark background everywhere ── */
body {
  background:
    linear-gradient(160deg, rgba(10,10,22,0.88) 0%, rgba(15,18,40,0.85) 100%),
    url('/bg-skyline.svg') center top / cover no-repeat fixed;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.5;
}

/* Centered pages (login, onboarding) */
body.center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ── Top Nav — dark with animated gradient ── */
.topbar {
  background: linear-gradient(180deg, #1c2333 0%, #111827 100%);
  animation: gradientShift 6s ease-in-out infinite, slideInDown .6s ease-out;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(99,102,241,.25);
  border-top: 3px solid #4d56d6;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,.45), 0 0 30px rgba(77,86,214,.1);
  transition: box-shadow .3s ease;
}
.topbar:hover {
  box-shadow: 0 4px 28px rgba(0,0,0,.6), 0 0 40px rgba(77,86,214,.2);
}
.topbar-brand  { flex: 1; min-width: 0; }
.brand-name    { font-weight: 800; font-size: 16px; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.2px; animation: float 3s ease-in-out infinite, glow 4s ease-in-out infinite; transition: color .3s ease; }
.topbar:hover .brand-name { color: #4d56d6; }
.brand-sub     { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px; letter-spacing: .1px; animation: slideInDown .8s ease-out .1s both; }

/* Logged-in user chip in the nav */
.topbar-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.nav-toggle {
  display: none;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 20px;
  cursor: pointer;
  color: #e2e8f0;
  padding: 5px 9px;
  border-radius: 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s, box-shadow .3s ease, transform .2s ease;
}
.nav-toggle:hover { 
  background: rgba(255,255,255,.15);
  box-shadow: 0 0 12px rgba(77,86,214,.3);
  transform: scale(1.05);
}
.nav-toggle:active { transform: scale(0.98); }

.nav-links { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; animation: slideInDown .7s ease-out .2s both; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 0;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all .25s cubic-bezier(.34,.1,.68,1);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.btn:hover:not(:disabled) { opacity: .88; transform: translateY(-2px); }
.btn:active               { transform: translateY(0); }
.btn:disabled             { opacity: .4; cursor: not-allowed; transform: none; }

/* Default button colours (nav context — on dark topbar) */
.btn.primary   { 
  background: #4d56d6; 
  color: #fff; 
  box-shadow: 0 4px 15px rgba(77,86,214,.3);
  animation: slideInDown .7s ease-out .3s both;
}
.btn.primary:hover { 
  box-shadow: 0 6px 25px rgba(77,86,214,.5), inset 0 1px 0 rgba(255,255,255,.2);
  background: #5a63e6;
}

.btn.secondary { 
  background: rgba(255,255,255,.1); 
  color: #d1d5db; 
  border: 1px solid rgba(255,255,255,.1);
  transition: all .25s ease;
  animation: slideInDown .7s ease-out calc(.3s + 60ms) both;
}
.btn.secondary:hover { 
  background: rgba(255,255,255,.18); 
  color: #fff; 
  opacity: 1;
  border-color: rgba(255,255,255,.3);
  box-shadow: 0 4px 12px rgba(255,255,255,.1);
}

.btn.danger    { 
  background: #dc2626; 
  color: #fff;
  box-shadow: 0 4px 12px rgba(220,38,38,.3);
  animation: slideInDown .7s ease-out .45s both;
}
.btn.danger:hover { 
  box-shadow: 0 6px 20px rgba(220,38,38,.5);
  background: #ea5555;
}

.btn.success   { background: #059669; color: #fff; box-shadow: 0 4px 12px rgba(5,150,105,.3); }
.btn.success:hover { box-shadow: 0 6px 20px rgba(5,150,105,.5); }

.btn.warning   { background: #d97706; color: #fff; box-shadow: 0 4px 12px rgba(217,119,6,.3); }
.btn.warning:hover { box-shadow: 0 6px 20px rgba(217,119,6,.5); }

.btn.sm        { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg        { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn.full      { width: 100%; }

/* Inside white panels, secondary buttons look normal dark */
.panel .btn.secondary,
.card  .btn.secondary {
  background: #f0f0f0; color: #222; border: none;
}
.panel .btn.secondary:hover,
.card  .btn.secondary:hover { background: #ddd; opacity: 1; transform: none; }

/* ── Page layout ── */
.page  { padding: 16px 20px; max-width: 1440px; margin: 0 auto; }

/* White content panels float on the dark background */
.panel {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 4px 28px rgba(0,0,0,.35);
}
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 28px rgba(0,0,0,.35);
  overflow: hidden;
  margin-bottom: 20px;
}

/* Login card (centered on dark bg) */
.card.login-wrap { padding: 32px 28px; text-align: center; }
.card.login-wrap .logo { font-size: 48px; margin-bottom: 12px; }
.card.login-wrap h1   { font-size: 22px; margin-bottom: 6px; }
.card.login-wrap form label { text-align: left; }

/* Hero card header — login / portal pages (centered, large, colored) */
.card-hd { padding: 28px 28px 22px; text-align: center; color: #fff; }
.card-hd.purple { background: linear-gradient(135deg, #4d56d6, #764ba2); }
.card-hd.green  { background: linear-gradient(135deg, #059669, #047857); }
.card-hd.red    { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.card-hd.dark   { background: linear-gradient(135deg, #374151, #1f2937); }
.card-hd .logo, .card-hd .hd-icon { font-size: 44px; margin-bottom: 10px; display: block; }
.card-hd h2 { font-size: 20px; font-weight: 900; margin-bottom: 4px; }
.card-hd p  { font-size: 13px; opacity: .85; margin: 0; }

/* Coloured card headers */
.card-head {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  border-bottom: 1px solid #f3f4f6;
}
.card-head .icon { font-size: 18px; }
.card-head.purple { background: linear-gradient(120deg,#4d56d6,#764ba2); color:#fff; border-bottom:0; }
.card-head.green  { background: linear-gradient(120deg,#059669,#047857); color:#fff; border-bottom:0; }
.card-head.amber  { background: linear-gradient(120deg,#d97706,#b45309); color:#fff; border-bottom:0; }
.card-head.blue   { background: linear-gradient(120deg,#0284c7,#0369a1); color:#fff; border-bottom:0; }
.card-head.red    { background: linear-gradient(120deg,#dc2626,#b91c1c); color:#fff; border-bottom:0; }
.card-body { padding: 18px; }

/* ── Grids ── */
.grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── KPI / Stats ── */
.kpiRow     { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-top: 12px; }
.kpi        { background: #f7f7ff; border: 1px solid #ececff; border-radius: 12px; padding: 12px; }
.kpi .label { color: #6b7280; font-weight: 700; font-size: 13px; }
.kpi .val   { font-size: 22px; font-weight: 900; margin-top: 6px; color: #1a1a2e; }
.stats-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card   { background: #fff; padding: 16px; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.25); text-align: center; }
.stat-number { font-size: 28px; font-weight: 800; color: #4d56d6; margin-bottom: 4px; }
.stat-label  { color: #888; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ── Forms ── */
label { display: block; margin-top: 10px; font-weight: 700; font-size: 13px; color: #374151; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 5px;
  border-radius: 10px;
  border: 2px solid #e4e4e4;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a2e;
  background: #fafafa;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4d56d6;
  box-shadow: 0 0 0 3px rgba(77,86,214,.08);
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"] { width: auto; margin-top: 0; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 380px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; font-size: 13px; white-space: nowrap; }
th { font-weight: 700; color: #374151; background: #f8f9ff; }
th:last-child, td:last-child { text-align: right; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges / Pills ── */
.pill, .badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.unpaid,  .badge.unpaid  { background: #fff3cd; color: #6b5200; }
.pill.pending, .badge.pending { background: #e7f1ff; color: #003a8c; }
.pill.paid,    .badge.paid    { background: #e9f7ef; color: #0a7b34; }
.pill.overdue, .badge.overdue { background: #fde2e2; color: #b00020; }
.badge-REQUESTED       { background: #fff3cd; color: #856404; }
.badge-LANDLORD_REVIEW { background: #dbeafe; color: #1e40af; }
.badge-TENANT_NOTIFIED { background: #e0e7ff; color: #4338ca; }
.badge-SETTLED         { background: #dcfce7; color: #166534; }
.badge-CANCELLED       { background: #f3f4f6; color: #6b7280; }

/* ── Messages ── */
.msg { margin-top: 10px; font-weight: 700; font-size: 13px; }
.msg.error { color: #991b1b; }
.msg.ok    { color: #166534; }
.alert { padding: 12px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1.5px solid #fecaca; }
.alert.ok    { background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0; }
.alert.info  { background: #eff6ff; color: #1e40af; border: 1.5px solid #bfdbfe; }

/* ── Info rows ── */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #6b7280; font-weight: 600; flex-shrink: 0; }
.info-value { font-weight: 700; color: #1a1a2e; text-align: right; }

/* ── Modals ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 300; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 48px rgba(0,0,0,.6); }
.modal-header { padding: 16px 18px 12px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #888; padding: 0 4px; }
.modal-body   { padding: 18px; }
.modal-footer { padding: 0 18px 18px; display: flex; gap: 10px; }
.modal-footer .btn { flex: 1; padding: 12px; font-size: 14px; }
.warning-info { background: #fff8e1; border: 1.5px solid #f59e0b; border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; font-size: 13px; color: #92400e; }
.tenant-info-box { background: #f8f9ff; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.tenant-info-box .ti-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.tenant-info-box .ti-lbl { color: #888; }
.tenant-info-box .ti-val { font-weight: 700; color: #1a1a2e; }

/* ── Settlement ── */
.statement { background: #fafbff; border: 1px solid #e0e7ff; border-radius: 12px; overflow: hidden; }
.stmt-row { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 14px; border-bottom: 1px solid #f0f0ff; }
.stmt-row .lbl { color: #4b5563; }
.stmt-row .amt { font-weight: 700; }
.stmt-divider  { border: none; border-top: 2px solid #e0e7ff; }
.stmt-total { display: flex; justify-content: space-between; padding: 14px 16px; font-size: 15px; font-weight: 800; }
.stmt-total.refund { background: #f0fdf4; color: #166534; }
.stmt-total.owed   { background: #fef2f2; color: #991b1b; }
.stmt-total.zero   { background: #f9fafb; color: #374151; }
.stmt-total .direction-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.08); margin-left: 8px; text-transform: uppercase; }

/* ── Banners ── */
.completed-banner { border-radius: 16px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; color: #fff; }
.completed-banner .banner-top { display: flex; align-items: center; gap: 14px; }
.completed-banner .icon { font-size: 30px; flex-shrink: 0; }
.completed-banner h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.completed-banner p  { font-size: 13px; opacity: .88; }

/* ── Toolbar / Filter ── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.spacer  { flex: 1 1 auto; }

/* ── Misc utilities ── */
.muted  { color: #6b7280; }
.small  { color: #6b7280; font-size: .9rem; }
.fw-800 { font-weight: 800; }
.text-right { text-align: right; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.btnrow  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.overdue-row  { background: #fff1f1; }
.overdue-text { color: #b00020; font-weight: 900; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #6b7280; margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: #4d56d6; text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: #d1d5db; }
.breadcrumb-cur { font-weight: 700; color: #1a1a2e; }

/* Loading */
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; gap: 12px; color: #9ca3af; }
.spinner { width: 32px; height: 32px; border: 3px solid rgba(255,255,255,.1); border-top-color: #4d56d6; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Deductions ── */
.ded-list  { display: flex; flex-direction: column; gap: 8px; }
.ded-item  { display: flex; align-items: flex-start; gap: 10px; background: #fafafa; border: 1px solid #f0f0f0; border-radius: 10px; padding: 10px 14px; }
.ded-body  { flex: 1; min-width: 0; }
.ded-label { font-weight: 700; font-size: 13px; color: #1a1a2e; word-break: break-word; }
.ded-cat   { font-size: 11px; color: #9ca3af; margin-top: 2px; text-transform: uppercase; letter-spacing: .5px; }
.ded-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ded-amount { font-weight: 800; font-size: 13px; color: #dc2626; white-space: nowrap; }
.ded-del   { background: none; border: none; color: #d1d5db; font-size: 14px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.ded-del:hover { color: #ef4444; background: #fee2e2; }
.ded-empty { text-align: center; padding: 24px 16px; color: #9ca3af; }
.inline-msg { display: none; margin-top: 10px; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.inline-msg.error { background: #fef2f2; color: #991b1b; display: block; }
.inline-msg.ok    { background: #f0fdf4; color: #166534; display: block; }

/* ════════════════════════════════════════════════════
   MOBILE — 768px and below
   ════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hamburger nav */
  .nav-toggle { display: flex; align-items: center; }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.08);
    gap: 5px;
  }
  .nav-links.open { display: flex; }
  .nav-links .btn { width: 100%; justify-content: center; padding: 12px 14px; font-size: 14px; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 0; }
  .topbar-brand { flex: 1 1 calc(100% - 56px); }

  /* Layouts */
  .grid, .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 12px; }
  .kpiRow     { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page   { padding: 12px 14px; }
  .panel  { padding: 14px; }
  .card-body { padding: 14px; }

  /* Table scroll */
  .table-wrap { overflow-x: auto; }

  /* Panels — full-bleed on mobile */
  .panel { border-radius: 10px; }

  /* Modals */
  .modal { margin: 0 8px; max-width: calc(100% - 16px); }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }

  /* Form inputs — bigger tap targets */
  input, select, textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px !important;
  }

  /* Button rows — stack on mobile */
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }
}

@media (max-width: 480px) {
  .kpiRow     { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 14px; }
  .brand-sub  { font-size: 10px; }

  /* Panels — tighter padding */
  .panel { padding: 12px; }

  /* Tables — horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
