/* ═══════════════════════════════════════════════════
   CondoTrack — Design System (Dark Theme)
   ═══════════════════════════════════════════════════ */

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

/* ── Custom Properties ──────────────────────────── */
:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --border:   #30363d;
  --accent:   #f0a500;
  --accent-d: #c8880a;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --green:    #3fb950;
  --red:      #f85149;
  --blue:     #58a6ff;
  --purple:   #bc8cff;

  --green-bg:  #0d2818;
  --red-bg:    #2d0f0f;
  --blue-bg:   #051d36;
  --purple-bg: #1e1040;
  --yellow-bg: #3d2e00;

  --font:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;

  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  --shadow:    0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ─────────────────────────────────── */
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.text-purple { color: var(--purple); }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-22 { font-size: 22px; }

.label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  letter-spacing: 1px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ── Layout ─────────────────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

.container--narrow {
  max-width: 420px;
}

.container--form {
  max-width: 360px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.mb-2 { margin-bottom: 2px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-22 { margin-bottom: 22px; }
.mb-44 { margin-bottom: 44px; }
.mt-4 { margin-top: 4px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.w-full { width: 100%; }

/* ── Card ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: border-color 0.2s ease;
}

.card--padded {
  padding: 28px;
}

.card--highlight-accent {
  border-left: 4px solid var(--accent);
}

.card--highlight-purple {
  border-left: 4px solid var(--purple);
}

.card--highlight-green {
  border-left: 3px solid var(--green);
}

.card--faded {
  opacity: 0.75;
}

.card--stat {
  text-align: center;
  padding: 14px;
}

.card--stat .stat-icon { font-size: 22px; }
.card--stat .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}
.card--stat .stat-label {
  font-size: 11px;
  color: var(--muted);
}

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font);
  transition: opacity 0.15s, transform 0.1s, background 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  opacity: 0.88;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--accent  { background: var(--accent); color: #000; }
.btn--green   { background: var(--green);  color: #000; }
.btn--red     { background: var(--red);    color: #fff; }
.btn--blue    { background: var(--blue);   color: #fff; }
.btn--purple  { background: var(--purple); color: #fff; }
.btn--ghost   { background: transparent;   color: var(--muted); padding: 4px 0; }
.btn--subtle  { background: #21262d;       color: var(--muted); padding: 6px 10px; font-size: 12px; }
.btn--dark    { background: #30363d;       color: var(--text); }

.btn--lg {
  width: 100%;
  padding: 13px 0;
  font-size: 15px;
}

.btn--full {
  width: 100%;
}

/* ── Selection Card (Tela Inicial) ──────────────── */
.selection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.selection-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.selection-card--accent:hover { border-color: var(--accent); }
.selection-card--purple:hover { border-color: var(--purple); }

.selection-card__icon { font-size: 36px; margin-bottom: 8px; }
.selection-card__title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.selection-card__sub { font-size: 13px; color: var(--muted); }

/* ── Inputs ─────────────────────────────────────── */
.input,
.select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.2s;
}

.input:focus,
.select:focus {
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.input--mono {
  font-family: var(--font-mono);
}

.input--prateleira {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--yellow {
  background: var(--yellow-bg);
  color: var(--accent);
  border: 1px solid var(--accent-d);
}

.badge--green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #238636;
}

.badge--blue {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid #1f6feb;
}

.badge--purple {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid #7d52e5;
}

.badge--red {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #da3633;
}

/* ── Header / Navbar ────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header__logo { font-size: 22px; }

.header__title {
  font-weight: 700;
  color: var(--accent);
  font-size: 16px;
  font-family: var(--font-mono);
}

.header__subtitle {
  font-size: 10px;
  color: var(--muted);
}

/* ── Tab Bar ────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 12px 4px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: var(--font);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Alerts / Banners ───────────────────────────── */
.alert {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
}

.alert--success {
  background: var(--green-bg);
  border-bottom: 1px solid #238636;
  color: var(--green);
}

.alert--error {
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--red);
}

.alert--purple {
  background: var(--purple-bg);
  border-bottom: 1px solid #7d52e5;
  padding: 10px 16px;
}

.alert--info {
  background: var(--blue-bg);
  border: 1px solid #1f6feb;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--blue);
}

/* ── Banner (Morador) ───────────────────────────── */
.banner-pendentes {
  background: #1a0e30;
  border: 1px solid #7d52e5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.banner-pendentes__icon { font-size: 48px; margin-bottom: 8px; }
.banner-pendentes__count { font-size: 22px; font-weight: 700; color: var(--purple); }
.banner-pendentes__sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.banner-ok {
  text-align: center;
  padding: 36px;
  margin-bottom: 16px;
}

.banner-ok__icon { font-size: 44px; margin-bottom: 8px; }
.banner-ok__title { font-weight: 600; color: var(--muted); font-size: 15px; }
.banner-ok__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Aviso do morador (na portaria) ─────────────── */
.aviso-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #2d1f60;
}

.aviso-row__info-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.aviso-row__info-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ── Notificação confirmada (morador) ───────────── */
.notif-confirmada {
  background: var(--purple-bg);
  border: 1px solid #7d52e5;
  border-radius: 8px;
  padding: 12px 14px;
}

.notif-confirmada__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 4px;
}

.notif-confirmada__sub {
  font-size: 12px;
  color: var(--muted);
}

/* ── IA Data Card ───────────────────────────────── */
.ia-card {
  border-color: #1f6feb;
  margin-bottom: 12px;
}

.ia-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 13px;
  line-height: 1.9;
}

.ia-card__grid .span-full {
  grid-column: 1 / -1;
}

/* ── Demo hint ──────────────────────────────────── */
.demo-hint {
  margin-top: 14px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--muted);
}

/* ── User info bar ──────────────────────────────── */
.user-bar {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 16px;
}

/* ── Loading spinner ────────────────────────────── */
.loading {
  text-align: center;
  padding: 24px;
}

.loading__icon {
  font-size: 32px;
  margin-bottom: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading__text {
  color: var(--blue);
  font-weight: 600;
}

/* ── Camera overlay ─────────────────────────────── */
.camera-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.camera-overlay video {
  width: 100%;
  max-width: 600px;
  border-radius: 8px;
}

.camera-overlay canvas {
  display: none;
}

.camera-overlay__actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ── Section title ──────────────────────────────── */
.section-title {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
}

/* ── Divider ────────────────────────────────────── */
.divider {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

/* ── Empty state ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state__icon { font-size: 40px; margin-bottom: 12px; }
.empty-state__text { font-size: 14px; }

/* ── Animations ─────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-slideDown {
  animation: slideDown 0.3s ease-out;
}

.animate-slideUp {
  animation: slideUp 0.4s ease-out;
}

/* ── Logo animation ─────────────────────────────── */
.logo-icon {
  font-size: 60px;
  margin-bottom: 10px;
  animation: float 3s ease-in-out infinite;
}

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

.logo-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -1px;
  font-family: var(--font-mono);
}

.logo-address {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Hidden ─────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .tabs { gap: 0; }
  .tab { font-size: 11px; padding: 10px 2px; }
  .container { padding: 12px; }
  .header { padding: 10px 12px; }
}

@media (max-width: 360px) {
  .grid-3 { grid-template-columns: 1fr; }
  .logo-title { font-size: 24px; }
}

/* ── Scrollbar (Webkit) ─────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Toast notification ─────────────────────────── */
.toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  animation: slideDown 0.3s ease-out;
}

.toast--hidden {
  display: none;
}
