/**
 * mobile-ui.css — Shared UI/UX Polish for Resident, Responder, Auth & Public Interfaces
 * Preserves existing layouts, theme variables, and workflows while unifying spacing,
 * responsive desktop/tablet centering, form controls, shadows, and interactive states.
 */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: #f4f6f9;
}

/* ── 1. Responsive Desktop & Tablet Proportions (Centering) ─────────── */
.login-body,
.fp-body {
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

.mobile-content,
.page-body {
  width: 100%;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

body.auth-register .mobile-content {
  max-width: 560px;
}

/* Align full-bleed fixed bars' inner content with centered column on wide screens */
@media (min-width: 720px) {
  .mobile-header:not(.dash-map-header) {
    padding-left: max(16px, calc(50vw - 340px));
    padding-right: max(16px, calc(50vw - 340px));
  }

  body.auth-register .mobile-header {
    padding-left: max(16px, calc(50vw - 280px));
    padding-right: max(16px, calc(50vw - 280px));
  }

  .tab-bar {
    padding-left: max(12px, calc(50vw - 340px));
    padding-right: max(12px, calc(50vw - 340px));
  }

  .bottom-nav {
    padding-left: max(0px, calc(50vw - 340px));
    padding-right: max(0px, calc(50vw - 340px));
    border-radius: 0;
  }
}

/* Responder live map floating cards & swipe bar centered on tablet/desktop */
@media (min-width: 768px) {
  .floating-card,
  .swipe-panel {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .login-hero,
  .fp-hero {
    padding-top: 44px;
    padding-bottom: 40px;
  }
}

/* Constrain bottom sheets & toasts cleanly on wider viewports without altering transform */
.faq-sheet,
.terms-sheet,
.detail-sheet,
.assess-sheet,
.followup-sheet,
.confirm-sheet,
.contacts-modal-sheet {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.mobile-toast,
.missions-toast,
.acc-toast,
.validation-toast {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── 2. Unified Card Surfaces, Borders & Soft Shadows ───────────────── */
.login-card,
.fp-card {
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05), 0 14px 34px rgba(15, 23, 42, 0.06);
}

.reg-card,
.section-card,
.settings-card,
.acc-card,
.history-card,
.mission-list-card,
.summary-card {
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.045);
}

/* ── 3. Header, Brand Logo & Bottom Navigation Polish ───────────────── */
.mobile-header {
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.14);
}

.mobile-header img {
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.38);
}

/* Track Report public header alignment with app headers */
.track-header {
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.12);
}

.track-header .brand img {
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  object-fit: cover;
  flex-shrink: 0;
}

.track-header .brand span.track-subtitle {
  display: block;
  font-size: 12px;
  opacity: 0.88;
  font-weight: 500;
  line-height: 1.3;
}

.bottom-nav {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
}

.bottom-nav a {
  color: #64748b;
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}

.bottom-nav a:hover:not(.active) {
  color: #334155;
  background-color: rgba(15, 23, 42, 0.035);
}

.bottom-nav a:focus-visible {
  outline: 2px solid var(--sys-accent, #008000);
  outline-offset: -2px;
}

/* ── 4. Form Controls, Chevrons & Input Spacing Fixes ───────────────── */
.input-wrap {
  border-color: #dbe2ea;
  background-color: #fafbfc;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.input-wrap:focus-within {
  background-color: #ffffff;
}

/* Prevent long option labels from overlapping custom SVG chevron */
.form-select-mobile {
  padding-right: 42px !important;
  border-color: #dbe2ea;
  text-overflow: ellipsis;
}

/* Guest Contact inputs in reports_mobile.php / guest_report.php */
#guestName,
#guestPhone,
#guestEmail {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1.5px solid #dbe2ea;
  background-color: #fafbfc;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#guestName:focus:not(.is-invalid),
#guestPhone:focus:not(.is-invalid),
#guestEmail:focus:not(.is-invalid) {
  background-color: #ffffff;
  border-color: var(--sys-accent, #008000);
  box-shadow: 0 0 0 3px rgba(var(--sys-accent-rgb, 0, 128, 0), 0.14);
}

/* Responder account password inputs: reserve space for eye toggle button */
.form-field .input-wrap input {
  padding-right: 44px;
}

/* Registration voter status select custom chevron */
#voterStatus {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px !important;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 14px 14px !important;
}

/* OTP 6-digit inputs responsive fit down to 320px viewports */
.otp-inputs {
  gap: clamp(5px, 2vw, 8px);
}

.otp-input {
  width: clamp(38px, 11.8vw, 46px);
  height: clamp(48px, 14vw, 56px);
  font-size: clamp(18px, 5.2vw, 22px);
}

/* ── 5. Pagination, Interactive Buttons & Logout Consistency ────────── */
.mp-btn {
  min-width: 38px;
  height: 38px;
  border-radius: 10px;
  border-width: 1.5px;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.mp-btn:hover:not(.active):not(.disabled) {
  background-color: var(--sys-accent-tint, #f0fdf4);
  border-color: var(--sys-accent, #008000);
}

.mp-btn:active:not(.disabled) {
  transform: scale(0.96);
}

.btn-logout {
  background: #fff5f5;
  color: #dc2626;
  border: 1.5px solid #fecaca;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.05);
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
}

.btn-logout:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.btn-logout:active {
  transform: scale(0.98);
}

/* Resident Emergency Offcanvas responsive max-width on mobile */
#residentEmergencyOffcanvas {
  max-width: 100vw;
}
