/* ============================================================
   CâmaraFácil — Mobile App CSS
   Design mobile-first, botões grandes, app-like
   ============================================================ */

/* ---- Reset mobile ---- */
html { -webkit-text-size-adjust: 100%; }
input, select, textarea, button { font-size: 16px !important; } /* evita zoom iOS */

/* ============================================================
   APP SHELL (header fixo + bottom nav + conteúdo)
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #f0f4f8;
}

/* ---- App Header ---- */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: env(safe-area-inset-top) 0 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.app-header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  gap: 12px;
}
.app-header-back {
  color: #fff;
  font-size: 1.3rem;
  text-decoration: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .15s;
}
.app-header-back:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.app-header-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-subtitle {
  font-size: .72rem;
  opacity: .75;
  font-weight: 400;
  display: block;
  line-height: 1.1;
}
.app-header-action {
  color: rgba(255,255,255,.85);
  font-size: .82rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.3);
  flex-shrink: 0;
  transition: all .15s;
}
.app-header-action:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.app-header-notif {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
}
.app-header-notif .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  background: #fc3d3d;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

/* ---- Scrollable Body ---- */
.app-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #a0aec0;
  font-size: .68rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s;
  position: relative;
  padding-top: 6px;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item:hover { color: var(--primary); text-decoration: none; }
.bottom-nav-item .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.bottom-nav-item .nav-badge {
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(4px);
  background: #fc3d3d;
  color: #fff;
  border-radius: 20px;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* ============================================================
   BOTÕES GRANDES — APP STYLE
   ============================================================ */
.btn-app {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  transition: all .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn-app:hover { text-decoration: none; transform: scale(0.98); }
.btn-app:active { transform: scale(0.95); }

.btn-app-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(26,58,92,0.3); }
.btn-app-primary:hover { color: #fff; background: var(--primary-dark); }

.btn-app-secondary { background: var(--secondary); color: var(--primary); box-shadow: 0 4px 16px rgba(200,169,81,0.3); }
.btn-app-secondary:hover { color: var(--primary); }

.btn-app-danger { background: #e53e3e; color: #fff; box-shadow: 0 4px 16px rgba(229,62,62,0.3); }
.btn-app-success { background: #38a169; color: #fff; box-shadow: 0 4px 16px rgba(56,161,105,0.3); }
.btn-app-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }

.btn-app-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.btn-app-text { text-align: left; flex: 1; }
.btn-app-text strong { display: block; font-size: 1rem; }
.btn-app-text small { font-size: .78rem; opacity: .75; font-weight: 400; }
.btn-app .btn-arrow { margin-left: auto; opacity: .6; font-size: 1rem; }

/* ============================================================
   CARDS APP STYLE
   ============================================================ */
.app-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  margin-bottom: 14px;
}
.app-card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f0f4f8;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-card-icon { font-size: 1.4rem; }
.app-card-title { font-weight: 700; font-size: .95rem; color: var(--primary); }
.app-card-subtitle { font-size: .78rem; color: #718096; margin-top: 1px; }
.app-card-body { padding: 14px 18px; }

/* Row item (lista app style) */
.app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f4f8;
  text-decoration: none;
  color: inherit;
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.app-row:last-child { border-bottom: none; }
.app-row:hover { background: #f8fafc; text-decoration: none; color: inherit; }
.app-row-icon { font-size: 1.5rem; flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px; background: #f0f4f8; display: flex; align-items: center; justify-content: center; }
.app-row-body { flex: 1; min-width: 0; }
.app-row-title { font-weight: 600; font-size: .92rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-row-sub { font-size: .78rem; color: #718096; margin-top: 2px; }
.app-row-right { flex-shrink: 0; }
.app-row-chevron { color: #cbd5e0; font-size: 1.1rem; }

/* ============================================================
   HERO MOBILE
   ============================================================ */
.mobile-hero {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 40px 20px 48px;
  text-align: center;
}
.mobile-hero-icon { font-size: 4rem; margin-bottom: 16px; }
.mobile-hero h1 { font-size: 1.8rem; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.mobile-hero h1 span { color: var(--secondary); }
.mobile-hero p { font-size: .95rem; opacity: .85; margin-bottom: 28px; line-height: 1.6; }
.mobile-hero-btns { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0 auto; }

/* ============================================================
   FORMULÁRIO CIDADÃO — App Style
   ============================================================ */
.form-app { padding: 0; }
.form-section { margin-bottom: 8px; }
.form-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #718096;
  padding: 16px 18px 8px;
}
.form-app .field {
  background: #fff;
  padding: 0;
  border-radius: 0;
  border-bottom: 1px solid #f0f4f8;
}
.form-app .field:first-of-type { border-radius: 14px 14px 0 0; }
.form-app .field:last-of-type { border-bottom: none; border-radius: 0 0 14px 14px; }
.form-app .field-inner {
  display: flex;
  align-items: center;
  padding: 4px 18px;
  gap: 12px;
  min-height: 56px;
}
.form-app .field-icon { font-size: 1.2rem; flex-shrink: 0; opacity: .6; }
.form-app .field-content { flex: 1; min-width: 0; }
.form-app .field-label { font-size: .72rem; color: #718096; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; }
.form-app .field-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  font-family: inherit;
  padding: 0;
}
.form-app .field-input::placeholder { color: #cbd5e0; }
.form-app .field-select {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  font-family: inherit;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.form-app .field-textarea {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  font-family: inherit;
  padding: 10px 0;
  resize: none;
  min-height: 80px;
}

/* Tipo selector chips */
.tipo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 0;
}
.tipo-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
.tipo-chip:hover { border-color: var(--primary); }
.tipo-chip.selected { border-color: var(--primary); background: #ebf8ff; }
.tipo-chip .tipo-emoji { font-size: 1.8rem; }
.tipo-chip .tipo-label { font-size: .72rem; font-weight: 700; color: var(--text); text-align: center; line-height: 1.2; }
.tipo-chip.selected .tipo-label { color: var(--primary); }
.tipo-chip input { display: none; }

/* Foto upload app */
.foto-app {
  background: #f0f4f8;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  border: 2px dashed #cbd5e0;
  margin: 0 18px;
  transition: all .15s;
}
.foto-app.has-photo { border-style: solid; border-color: var(--primary); }
.foto-app-preview { width: 100%; height: 200px; object-fit: cover; display: none; }
.foto-app-placeholder { text-align: center; padding: 24px; }
.foto-app-placeholder .icon { font-size: 2.5rem; margin-bottom: 8px; }
.foto-app-placeholder p { font-size: .85rem; color: #718096; }

/* GPS button */
.gps-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #fff;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.gps-btn:hover { border-color: var(--primary); }
.gps-btn.active { border-color: var(--success); background: #f0fff4; }
.gps-btn .gps-icon { font-size: 1.5rem; flex-shrink: 0; }
.gps-btn .gps-text strong { display: block; font-size: .95rem; font-weight: 700; color: var(--text); }
.gps-btn .gps-text small { font-size: .78rem; color: #718096; }
.gps-btn .gps-arrow { margin-left: auto; color: #cbd5e0; }

/* ============================================================
   STAT PILLS (dashboard mobile)
   ============================================================ */
.stat-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px; }
.stat-pill {
  background: #fff;
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-pill-value { font-size: 1.7rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-pill-label { font-size: .68rem; color: #718096; font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.2; }
.stat-pill.danger  .stat-pill-value { color: #e53e3e; }
.stat-pill.success .stat-pill-value { color: #38a169; }
.stat-pill.warning .stat-pill-value { color: #d69e2e; }

/* ============================================================
   NOTIFICATION ITEM
   ============================================================ */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f4f8;
  align-items: flex-start;
}
.notif-item.unread { background: #f0f7ff; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 6px;
}
.notif-dot.read { background: transparent; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: .88rem; font-weight: 600; color: var(--text); }
.notif-sub { font-size: .78rem; color: #718096; margin-top: 2px; }
.notif-time { font-size: .72rem; color: #a0aec0; margin-top: 4px; }

/* ============================================================
   SUCESSO / STATUS SCREENS
   ============================================================ */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  min-height: 60vh;
}
.success-icon { font-size: 5rem; margin-bottom: 24px; animation: pop .4s ease-out; }
@keyframes pop { 0% { transform: scale(0); } 80% { transform: scale(1.1); } 100% { transform: scale(1); } }
.success-title { font-size: 1.5rem; font-weight: 800; color: var(--success); margin-bottom: 10px; }
.success-sub { color: #718096; font-size: .95rem; line-height: 1.6; max-width: 280px; }
.success-protocol { background: #f0f4f8; border-radius: 12px; padding: 16px 24px; margin: 24px 0; font-size: .88rem; color: var(--text); }
.success-protocol strong { display: block; font-size: 1.2rem; color: var(--primary); }

/* ============================================================
   STATUS BADGE (solicitações)
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.status-aberta       { background: #fff5f5; color: #c53030; }
.status-em_analise   { background: #fffbeb; color: #92400e; }
.status-em_atendimento { background: #ebf8ff; color: #2b6cb0; }
.status-resolvida    { background: #f0fff4; color: #276749; }
.status-arquivada    { background: #f7fafc; color: #718096; }

/* ============================================================
   RESPONSIVE OVERRIDES (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Esconde sidebar no mobile, usa bottom nav */
  .sidebar { display: none !important; }
  .app-layout { display: block; }
  .main-content { display: block; }
  .topbar { display: none; }
  .page-body { padding: 12px; padding-bottom: 80px; }

  /* Tabelas viram cards empilhados no mobile */
  .table-mobile thead { display: none; }
  .table-mobile tr { display: block; background: #fff; border-radius: 12px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #e2e8f0; overflow: hidden; }
  .table-mobile td { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-bottom: 1px solid #f0f4f8; font-size: .88rem; }
  .table-mobile td:last-child { border-bottom: none; }
  .table-mobile td::before { content: attr(data-label); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #a0aec0; flex-shrink: 0; margin-right: 12px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 1.7rem; }

  .card { border-radius: 14px; padding: 16px; }
  .btn-primary, .btn-secondary, .btn-danger, .btn-success { padding: 13px 18px; font-size: .92rem; }

  .vereadores-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .numeros-grid    { grid-template-columns: 1fr; }
  .news-grid       { grid-template-columns: 1fr; }
  .camaras-grid    { grid-template-columns: 1fr; }
  .hero { padding: 36px 0 44px; }
  .hero h1 { font-size: 1.6rem; }
  .hero-stats { gap: 20px; flex-wrap: wrap; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid > div:first-child { grid-column: 1; }

  /* Modais full-screen no mobile */
  [id^="modal-"] > div { border-radius: 20px 20px 0 0 !important; position: fixed !important; bottom: 0; left: 0; right: 0; max-width: 100% !important; max-height: 90vh; }
}

@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .app-body { padding-bottom: 0; }
}
