/* PostShow Agent – mobile-first, high contrast */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --error: #f87171;
  --success: #4ade80;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
}

.header {
  text-align: center;
  padding: 1.25rem 0 1.5rem;
}

.header-title {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}

.header-slogan {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
  white-space: nowrap;
}

.header-slogan::before {
  content: "";
  display: block;
  width: 2rem;
  height: 2px;
  margin: 0.6rem auto 0.5rem;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.7;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.panel.hidden,
.hidden {
  display: none;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 50vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#canvas {
  display: none;
}

.actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
}

.btn-secondary:hover {
  background: #334155;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
  flex-wrap: wrap;
}

/* Top logo: full width, safe spacing so it’s not cut off on mobile */
.app-top-logo {
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  padding-bottom: 0.5rem;
  margin-left: -1rem;
  margin-right: -1rem;
  width: calc(100% + 2rem);
  text-align: center;
}

.app-top-logo a {
  display: inline-block;
  line-height: 0;
}

.app-top-logo .app-logo {
  width: auto;
  max-width: 480px;
  height: 128px;
  object-fit: contain;
  display: block;
}

@media (min-width: 600px) {
  .app-top-logo {
    margin-left: -2rem;
    margin-right: -2rem;
    width: calc(100% + 4rem);
  }
}

.form-actions .btn {
  flex: 1;
  min-width: 120px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #334155;
  border-radius: 8px;
}

.form-group select {
  cursor: pointer;
  appearance: auto;
}

.followup-intro {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.followup-options {
  margin-bottom: 1.25rem;
}

.followup-options .form-group {
  margin-bottom: 0.75rem;
}

.followup-options #btn-followup {
  margin-top: 0.5rem;
  width: 100%;
}

#success-section #btn-new-scan {
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #64748b;
}

.form-group textarea {
  resize: vertical;
  min-height: 2.5rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
}

.error {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  padding: 1rem;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 0.5rem;
  text-align: center;
}

.error p {
  margin: 0 0 1rem 0;
  font-weight: 500;
}

.error.hidden {
  display: none;
}

.success-msg {
  color: var(--success);
  font-weight: 500;
  margin-bottom: 1rem;
}

#success-section .btn {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.phone-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.phone-row select {
  width: 6rem;
  min-width: 5rem;
  padding: 0.5rem 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #334155;
  border-radius: 8px;
}

.phone-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid #334155;
  border-radius: 8px;
}

@media (min-width: 600px) {
  #app {
    padding: 2rem;
  }
  .header h1 {
    font-size: 2rem;
  }
}

.legal-links {
  position: fixed;
  bottom: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
}
.privacy-link {
  color: var(--muted);
  text-decoration: none;
  opacity: 0.8;
}
.privacy-link:hover {
  opacity: 1;
  color: var(--primary);
}
