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

:root {
  --green: #64d403;       /* verde de UI (botões, pills) */
  --green-neon: #77fe02;  /* verde do logo (glow, dark theme) */
  --black: #000000;
  --dark-bg: #242321;     /* fundo das telas de chamada (visitante) */
  --light-bg: #f4f5f7;    /* fundo do app/portal */
  --card-white: #ffffff;
  --text-dark: #111214;
  --text-muted: #6b7280;
  --danger: #ff3b30;
  --call-blue: #3b82f6;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: 'Inter', -apple-system, Roboto, Arial, sans-serif; overflow-x: hidden; }

/* ============ TEMA CLARO — app / portal do morador e síndico ============ */
.app-shell { background: var(--light-bg); min-height: 100vh; padding-bottom: 90px; }

.app-header {
  background: var(--black);
  padding: calc(18px + env(safe-area-inset-top)) 20px 18px;
  display: flex; align-items: center;
  position: sticky; top: 0; z-index: 50;
}
.app-header img { height: 30px; }

.app-body { max-width: 480px; margin: 0 auto; padding: 22px 18px; }

.page-title { font-size: 26px; font-weight: 800; color: var(--text-dark); margin: 0 0 18px 0; letter-spacing: -0.02em; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-title-row .page-title { margin: 0; }

.pill-btn {
  background: var(--green); color: #06210a; border: none; border-radius: 20px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.pill-btn.outline { background: transparent; border: 1.5px solid var(--green); color: #3f8a02; }
.pill-btn.dark { background: #1a3d02; color: var(--green); }

.unit-card {
  background: var(--card-white); border-radius: 16px; padding: 18px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.08);
  border: 2px solid transparent; transition: border-color .15s ease, box-shadow .15s ease;
}
.unit-card.fulfill-active {
  border-color: #f0b429; box-shadow: 0 0 0 4px rgba(240,180,41,.15), 0 1px 3px rgba(0,0,0,.06);
}
.unit-card.fulfill-success {
  animation: fulfill-flash-green .7s ease;
}
@keyframes fulfill-flash-green {
  0% { border-color: #3f8a02; box-shadow: 0 0 0 6px rgba(63,138,2,.18); }
  100% { border-color: transparent; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.08); }
}
.unit-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.unit-card-title { font-size: 18px; font-weight: 800; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.unit-card-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.unit-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.unit-card-actions .pill-btn { flex: 1; justify-content: center; }

.settings-list { background: var(--card-white); border-radius: 16px; overflow: hidden; }
.settings-item {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border-bottom: 1px solid #eef0f2; font-size: 15px; font-weight: 600; color: var(--text-dark);
  cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-item .chev { margin-left: auto; color: #c6cad0; }
.settings-item.danger { color: var(--danger); }
.settings-item .ico { width: 22px; text-align: center; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
  border-top: 1px solid #eceef1; padding: 12px 30px 22px;
  display: flex; align-items: center; justify-content: space-between; z-index: 60;
}
.nav-circle {
  width: 46px; height: 46px; border-radius: 50%; background: #eef0f3;
  display: flex; align-items: center; justify-content: center; color: #444; border: none;
}
.nav-fab {
  width: 62px; height: 62px; border-radius: 50%; background: var(--green);
  display: flex; align-items: center; justify-content: center; color: #06210a;
  font-size: 30px; font-weight: 400; border: none; box-shadow: 0 6px 16px rgba(100,212,3,.45);
  margin-top: -34px;
}

form.light input, form.light select, .app-shell input, .app-shell select {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid #e2e4e8;
  background: #fff; color: var(--text-dark); margin-top: 6px; margin-bottom: 14px; font-size: 15px;
  font-family: inherit;
}
.app-shell label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.app-shell .btn-primary {
  background: var(--green); color: #06210a; border: none; border-radius: 12px;
  padding: 15px; font-size: 15px; font-weight: 700; width: 100%; cursor: pointer;
}
.app-shell .btn-secondary {
  background: #fff; color: var(--text-dark); border: 1.5px solid #e2e4e8; border-radius: 12px;
  padding: 15px; font-size: 15px; font-weight: 700; width: 100%; cursor: pointer; margin-top: 10px;
}
.app-shell .card-plain { background: #fff; border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.app-shell .error { background: #fdeaea; color: #b42318; padding: 12px; border-radius: 10px; margin: 10px 0; font-size: 13px; }
.app-shell .success-box { background: #eafce0; color: #1c6b02; padding: 12px; border-radius: 10px; margin: 10px 0; font-size: 13px; }
.app-shell .muted-text { color: var(--text-muted); font-size: 13px; }

/* ============ TEMA ESCURO — visitante / tela de chamada ============ */
.call-shell {
  background: var(--dark-bg); min-height: 100vh; color: #fff;
  display: flex; flex-direction: column; align-items: center;
}
.call-logo { margin: 34px 0 10px; height: 46px; }
.call-content { flex: 1; width: 100%; max-width: 480px; padding: 0 20px; display: flex; flex-direction: column; align-items: center; }

.white-card {
  background: #fff; color: var(--text-dark); border-radius: 18px; padding: 26px 22px;
  width: 100%; text-align: center; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.white-card h2 { font-size: 21px; font-weight: 800; margin: 0 0 10px; }
.white-card p { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }

.directory-row {
  background: var(--green); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.directory-row .name { color: #06210a; font-weight: 700; font-size: 15px; }
.directory-row .call-ico {
  width: 40px; height: 40px; border-radius: 10px; background: rgba(0,0,0,.18);
  display: flex; align-items: center; justify-content: center; color: #06210a; font-size: 16px; border: none;
}

.ring-status { text-align: center; margin-top: 60px; }
.ring-status h2 { font-size: 24px; font-weight: 700; margin-bottom: 22px; }
.dots-loader { display: flex; gap: 10px; justify-content: center; margin-bottom: 26px; }
.dots-loader span {
  width: 14px; height: 14px; border-radius: 50%; background: #6b6a63;
  animation: dot-pulse 1.2s infinite ease-in-out;
}
.dots-loader span:nth-child(1) { animation-delay: 0s; }
.dots-loader span:nth-child(2) { animation-delay: 0.2s; }
.dots-loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { background: #6b6a63; box-shadow: none; transform: scale(1) translateY(0); }
  40% { background: var(--green-neon); box-shadow: 0 0 14px var(--green-neon); transform: scale(1.6) translateY(-8px); }
}
.ring-hint { color: #9a9990; font-size: 13px; margin-bottom: 26px; }

.call-control {
  width: 58px; height: 58px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff;
}
.call-control.blue { background: var(--call-blue); }
.call-control.red { background: var(--danger); }
.call-controls-row { display: flex; gap: 22px; justify-content: center; margin: 30px 0; }

.avatar-circle {
  width: 190px; height: 190px; border-radius: 50%; border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center; margin: 50px auto 20px; font-size: 90px;
}
.timer-pill {
  background: #000; color: #fff; border-radius: 20px; padding: 8px 16px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 0px;
}

.call-footer { text-align: center; color: #7d7c74; font-size: 11.5px; line-height: 1.6; padding: 20px 0; }

.call-video-frame {
  width: 100%; aspect-ratio: 4/5; background: #000; border-radius: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #444; position: relative;
}
.call-map-frame { width: 100%; aspect-ratio: 5/4; background: #dfe6dc; position: relative; overflow: hidden; }

/* ---------------- Feedback de carregamento em ações (spinner de botão) ---------------- */
.btn-spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: btn-spin .7s linear infinite; vertical-align: -2px; margin-right: 2px;
}
button[data-loading="true"] { opacity: .85; cursor: wait; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------------- Barra global de carregamento (qualquer fetch em andamento) ---------------- */
.global-loading-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10000;
  background: linear-gradient(90deg, #3f8a02, #7ed321, #3f8a02);
  background-size: 200% 100%; animation: global-loading-sweep 1.1s linear infinite;
  pointer-events: none;
}
@keyframes global-loading-sweep { from { background-position: 0% 0; } to { background-position: -200% 0; } }
