/* ============================================================
   Vagas Condomínio — Design System
   Mobile-first, acessível, sem dependências externas
   ============================================================ */

:root {
  --clr-primary: #1a6b3c;
  --clr-primary-dk: #134f2c;
  --clr-primary-lt: #e8f5ee;
  --clr-danger: #c0392b;
  --clr-danger-lt: #fdecea;
  --clr-warning: #d97706;
  --clr-warning-lt: #fef3c7;
  --clr-info: #1d4ed8;
  --clr-info-lt: #eff6ff;
  --clr-text: #111827;
  --clr-muted: #6b7280;
  --clr-border: #e5e7eb;
  --clr-bg: #f9fafb;
  --clr-white: #ffffff;

  --spot-active: #16a34a;
  --spot-occupied: #dc2626;
  --spot-reserved: #d97706;
  --spot-maintenance: #9ca3af;
  --spot-inactive: #374151;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.1);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.page-content { padding: 1.5rem 0 3rem; }

/* ── Nav ── */
nav.navbar {
  background: var(--clr-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}
.navbar-brand { font-size: 1.125rem; font-weight: 700; color: #fff; }
.navbar-nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.nav-link { color: rgba(255,255,255,.88); font-size: .875rem; padding: .4rem .6rem; border-radius: 4px; }
.nav-link:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.2); color: #fff; }

/* ── Cards ── */
.card {
  background: var(--clr-white);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card-header {
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: .75rem;
  margin-bottom: 1rem;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* ── Vagas Grid ── */
.spots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.spot-card {
  border-radius: var(--radius);
  padding: 1rem .75rem;
  text-align: center;
  cursor: default;
  transition: transform .15s, box-shadow .15s;
  border: 2px solid transparent;
  position: relative;
}
.spot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.spot-card.clickable { cursor: pointer; }
.spot-card.clickable:focus { outline: 3px solid var(--clr-primary); }

.spot-id { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.spot-status-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

.spot-active    { background: #f0fdf4; border-color: var(--spot-active); color: var(--spot-active); }
.spot-occupied  { background: #fef2f2; border-color: var(--spot-occupied); color: var(--spot-occupied); }
.spot-reserved  { background: #fffbeb; border-color: var(--spot-reserved); color: var(--spot-reserved); }
.spot-maintenance { background: #f9fafb; border-color: var(--spot-maintenance); color: var(--spot-maintenance); }
.spot-inactive  { background: #f3f4f6; border-color: var(--spot-inactive); color: var(--spot-inactive); opacity: .6; }

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: 100px;
  font-size: .875rem;
  font-weight: 600;
}
.stat-pill.active    { background: #f0fdf4; color: var(--spot-active); }
.stat-pill.occupied  { background: #fef2f2; color: var(--spot-occupied); }
.stat-pill.reserved  { background: #fffbeb; color: var(--spot-reserved); }
.stat-pill.maintenance { background: #f9fafb; color: var(--spot-maintenance); }

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-dk); color: #fff; text-decoration: none; }
.btn-danger  { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; text-decoration: none; }
.btn-secondary { background: var(--clr-border); color: var(--clr-text); }
.btn-secondary:hover { background: #d1d5db; text-decoration: none; }
.btn-outline { background: transparent; border: 1.5px solid var(--clr-primary); color: var(--clr-primary); }
.btn-outline:hover { background: var(--clr-primary-lt); text-decoration: none; }
.btn-sm { padding: .375rem .75rem; font-size: .8rem; }
.btn-lg { padding: .875rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* Botões de check-in/out grandes */
.checkin-btn  { background: var(--spot-active); color: #fff; font-size: 1.125rem; padding: 1rem 2rem; }
.checkin-btn:hover  { background: #15803d; color: #fff; text-decoration: none; }
.checkout-btn { background: var(--spot-occupied); color: #fff; font-size: 1.125rem; padding: 1rem 2rem; }
.checkout-btn:hover { background: #b91c1c; color: #fff; text-decoration: none; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; }
.form-control {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--clr-text);
  background: var(--clr-white);
  transition: border-color .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(26,107,60,.15);
}
.form-hint { font-size: .8rem; color: var(--clr-muted); margin-top: .25rem; }

/* ── Alertas ── */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  border-left: 4px solid transparent;
}
.alert-success { background: var(--clr-primary-lt); border-color: var(--clr-primary); color: var(--clr-primary-dk); }
.alert-danger  { background: var(--clr-danger-lt); border-color: var(--clr-danger); color: #7f1d1d; }
.alert-warning { background: var(--clr-warning-lt); border-color: var(--clr-warning); color: #78350f; }
.alert-info    { background: var(--clr-info-lt); border-color: var(--clr-info); color: #1e3a8a; }

/* ── Status atual (checker) ── */
.status-banner {
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.status-banner.no-checkin { background: var(--clr-bg); border: 2px dashed var(--clr-border); }
.status-banner.in-checkin { background: #f0fdf4; border: 2px solid var(--spot-active); }
.status-icon { font-size: 2rem; }
.status-text strong { display: block; font-size: 1rem; }
.status-text small { color: var(--clr-muted); font-size: .85rem; }

/* ── Tabelas ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--clr-bg);
  border-bottom: 2px solid var(--clr-border);
  padding: .625rem .875rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
tbody td {
  padding: .625rem .875rem;
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--clr-bg); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2em .6em;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-active      { background: #dcfce7; color: #166534; }
.badge-occupied    { background: #fee2e2; color: #991b1b; }
.badge-reserved    { background: #fef3c7; color: #92400e; }
.badge-maintenance { background: #f3f4f6; color: #374151; }
.badge-inactive    { background: #f3f4f6; color: #6b7280; }
.badge-cancelled   { background: #fee2e2; color: #991b1b; }
.badge-used        { background: #dbeafe; color: #1e40af; }
.badge-expired     { background: #fef3c7; color: #92400e; }
.badge-user        { background: #ede9fe; color: #5b21b6; }
.badge-admin       { background: #fce7f3; color: #9d174d; }

/* ── Paginação ── */
.pagination { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.pagination a, .pagination span {
  padding: .375rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid var(--clr-border);
}
.pagination a { color: var(--clr-primary); }
.pagination a:hover { background: var(--clr-primary-lt); text-decoration: none; }
.pagination .current { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); }

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--clr-primary-dk) 0%, var(--clr-primary) 100%);
}
.auth-box {
  background: var(--clr-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo h1 { color: var(--clr-primary); font-size: 1.5rem; }
.auth-logo p { color: var(--clr-muted); font-size: .875rem; }

/* ── LGPD ── */
.lgpd-box { max-width: 700px; margin: 2rem auto; }
.term-content {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-height: 350px;
  overflow-y: auto;
  font-size: .875rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* ── Realtime indicator ── */
.realtime-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--spot-active);
  animation: pulse 2s infinite;
  margin-right: .375rem;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--clr-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .spots-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .stats-bar { gap: .5rem; }
  .stat-pill { font-size: .8rem; padding: .375rem .75rem; }
  h1 { font-size: 1.375rem; }
  .btn-lg { font-size: 1rem; padding: .75rem 1.5rem; }
  .checkin-btn, .checkout-btn { width: 100%; }
}

/* ── Utility ── */
.text-muted { color: var(--clr-muted); }
.text-danger { color: var(--clr-danger); }
.text-success { color: var(--spot-active); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
