/* ==========================================================================
   AI SMART LOCAL AGENT — Auth & Report Forms
   Shared glassmorphic form system for login, register, and report pages.
   ========================================================================== */

.form-page {
  min-height: 100vh;
  padding-top: calc(var(--nav-height) + 32px);
  padding-bottom: 56px;
}

.form-page .bg-grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
  -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

/* Nav slot alignment */
.auth-nav-slot {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav-user-chip {
  display: inline-flex;
  align-items: center;
  max-width: 140px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Auth layout
   -------------------------------------------------------------------------- */
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: 28px;
  align-items: stretch;
}

.auth-brand-panel,
.auth-form-card,
.report-hero-card,
.report-form-card,
.report-success-card {
  position: relative;
  overflow: hidden;
}

.auth-brand-panel {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 560px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(37, 99, 235, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(6, 182, 212, 0.16), transparent 55%),
    var(--glass-bg);
}

.auth-brand-panel::after,
.report-hero-card::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 70%);
  pointer-events: none;
}

.auth-kicker {
  margin-bottom: 18px;
}

.auth-brand-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.auth-brand-copy {
  margin: 0;
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}

.auth-role-list {
  display: grid;
  gap: 14px;
  margin: 32px 0;
}

.auth-role-item {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-role-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan-bright);
}

.auth-role-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.auth-role-item span {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.auth-brand-note {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.16);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.auth-form-card {
  padding: 34px;
  align-self: center;
}

.auth-form-header {
  margin-bottom: 24px;
}

.auth-form-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.5vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-form-subtitle {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
.form-stack {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field label,
.field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.field-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.input-wrap {
  position: relative;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text-primary);
  font: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: rgba(148, 163, 184, 0.34);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
  background: rgba(15, 23, 42, 0.72);
}

.input.has-toggle {
  padding-right: 86px;
}

.textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.65;
}

.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.password-toggle:hover {
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.3);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--accent-cyan-bright);
  outline-offset: 2px;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.char-counter.is-limit {
  color: #fbbf24;
}

/* --------------------------------------------------------------------------
   Alerts / notices / buttons
   -------------------------------------------------------------------------- */
.form-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px solid transparent;
}
.form-alert[hidden] { display: none !important; }
.form-alert--error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}
.form-alert--info {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.24);
}
.form-alert--success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.24);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  font-size: 0.92rem;
  text-align: center;
}
.auth-switch a, .inline-link {
  color: var(--accent-cyan-bright);
  font-weight: 600;
}
.auth-switch a:hover, .inline-link:hover {
  text-decoration: underline;
}

.auth-guest {
  margin-top: 16px;
  text-align: center;
}
.auth-guest a {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-decoration: underline;
  text-decoration-color: rgba(148, 163, 184, 0.3);
}
.auth-guest a:hover { color: var(--text-secondary); }

.auth-session-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}
.auth-session-note strong { color: var(--text-primary); }
.auth-session-note a { color: var(--accent-cyan-bright); font-weight: 600; }

/* --------------------------------------------------------------------------
   Report layout
   -------------------------------------------------------------------------- */
.report-shell {
  display: grid;
  gap: 24px;
}

.report-hero-card {
  padding: 32px;
  background:
    radial-gradient(ellipse 70% 70% at 0% 0%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 60% at 100% 100%, rgba(6, 182, 212, 0.12), transparent 55%),
    var(--glass-bg);
}

.report-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
}

.report-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.report-subtitle {
  margin: 0;
  max-width: 720px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.report-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}
.meta-pill svg { width: 15px; height: 15px; color: var(--accent-cyan-bright); }

.report-notice {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #fde68a;
  font-size: 0.9rem;
  line-height: 1.55;
}
.report-notice p { margin: 0; color: var(--text-secondary); }
.report-notice strong { color: #fde68a; }
.report-notice[hidden] { display: none !important; }

.report-form-card {
  padding: 30px;
}

.report-form {
  display: grid;
  gap: 28px;
}

.form-section {
  display: grid;
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}
.form-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.form-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.form-section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-section-desc {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.section-badge {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-cyan-bright);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.18);
}

/* AI classify */
.ai-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ai-result {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
  font-size: 0.85rem;
}
.ai-result[hidden] { display: none !important; }
.ai-result strong { color: #dcfce7; }

/* Location */
.location-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto;
  gap: 14px;
  align-items: end;
}
.location-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gps-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 1.3em;
}
.gps-status.is-error { color: #fca5a5; }
.gps-status.is-ok { color: #86efac; }

/* Map picker modal */
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.map-modal.is-open { display: flex; }
.map-modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
}
.map-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}
.map-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.map-modal-close:hover { color: var(--text-primary); border-color: rgba(148, 163, 184, 0.35); }
.picker-map {
  width: 100%;
  height: min(52vh, 420px);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  overflow: hidden;
}
.map-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.map-modal-coords { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Uploads
   -------------------------------------------------------------------------- */
.upload-zone {
  position: relative;
  padding: 24px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.3);
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.upload-zone:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(15, 23, 42, 0.45);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-zone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent-cyan-bright);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.16);
}
.upload-zone-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.upload-zone-hint { color: var(--text-muted); font-size: 0.84rem; }

.photo-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.photo-previews:empty { display: none; margin: 0; }
.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.5);
}
.photo-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}
.photo-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.photo-card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.photo-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.photo-remove:hover { background: rgba(239, 68, 68, 0.18); color: #fecaca; }
.photo-remove svg { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   Submit / success
   -------------------------------------------------------------------------- */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.form-actions .btn-primary { min-width: 200px; }

.report-success-card {
  padding: 36px;
  text-align: center;
}
.report-success-card[hidden] { display: none !important; }
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.06);
}
.success-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}
.success-desc {
  margin: 0 auto 24px;
  max-width: 560px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.tracking-id-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 28px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.22);
}
.tracking-id-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tracking-id-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan-bright);
  letter-spacing: 0.02em;
}
.copy-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.copy-btn:hover { color: var(--text-primary); border-color: rgba(56, 189, 248, 0.3); }
.copy-btn svg { width: 16px; height: 16px; }

.success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-brand-panel {
    min-height: 0;
    padding: 32px;
  }
  .auth-form-card {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 900px) {
  .report-hero-grid {
    grid-template-columns: 1fr;
  }
  .report-hero-meta { justify-content: flex-start; }
  .location-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .location-grid .location-actions-wrap {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .form-page {
    padding-top: calc(var(--nav-height) + 20px);
    padding-bottom: 40px;
  }
  .auth-brand-panel,
  .auth-form-card,
  .report-hero-card,
  .report-form-card,
  .report-success-card {
    padding: 24px;
  }
  .form-grid,
  .location-grid {
    grid-template-columns: 1fr;
  }
  .location-grid .location-actions-wrap {
    grid-column: span 1;
  }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn, .form-actions .btn-primary { width: 100%; min-width: 0; }
  .report-notice { flex-direction: column; align-items: stretch; }
  .map-modal-foot { flex-direction: column; align-items: stretch; }
  .tracking-id-row { width: 100%; justify-content: center; flex-wrap: wrap; }
  .auth-nav-slot { gap: 8px; }
  .nav-user-chip { max-width: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .input, .select, .textarea, .btn, .password-toggle, .photo-remove, .copy-btn, .map-modal-close {
    transition: none;
  }
}
