/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f0f2f5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
}

/* ── App Container ── */
.app {
  width: 100%;
  max-width: 420px;
}

/* ── Screens ── */
.screen[hidden] {
  display: none !important;
}

/* ── Logo Header ── */
.logo-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  width: 180px;
  height: auto;
  margin-bottom: 12px;
}

.logo-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1e3a5f;
}

/* ── Cards ── */
.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.card.center {
  text-align: center;
}

/* ── Form Elements ── */
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  border-color: #2b54a3;
  box-shadow: 0 0 0 3px rgba(43, 84, 163, 0.15);
}

/* Code input special styling */
#code-input {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
}

/* ── Form Groups ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  margin-bottom: 6px;
}

/* ── Buttons ── */
.btn-primary,
button[type="submit"] {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background: #2b54a3;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s, transform 0.1s;
  -webkit-appearance: none;
}

.btn-primary:hover:not(:disabled),
button[type="submit"]:hover:not(:disabled) {
  background: #234589;
}

.btn-primary:active:not(:disabled),
button[type="submit"]:active:not(:disabled) {
  background: #1c3a75;
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid #2b54a3;
  outline-offset: 2px;
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s, transform 0.1s;
  -webkit-appearance: none;
}

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

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

.btn-outline {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #2b54a3;
  background: transparent;
  border: 2px solid #2b54a3;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s, transform 0.1s;
  -webkit-appearance: none;
}

.btn-outline:hover {
  background: #eff6ff;
}

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

.link-button {
  display: block;
  margin: 20px auto 0;
  padding: 8px;
  background: none;
  border: none;
  color: #2b54a3;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Icon Headers ── */
.icon-header {
  text-align: center;
  margin-bottom: 24px;
}

.icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  background: #eff6ff;
  color: #2b54a3;
}

.icon-circle.success {
  background: #ecfdf5;
  color: #059669;
  font-size: 32px;
}

.icon-circle.error {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 700;
}

/* ── Subtitle ── */
.subtitle {
  color: #4b5563;
  font-size: 15px;
  margin-bottom: 8px;
}

/* ── Divider ── */
.divider-text {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: #6b7280;
  font-size: 13px;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.divider-text span {
  padding: 0 12px;
}

/* ── Event List ── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.event-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 16px 20px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  font-family: inherit;
}

.event-card:hover {
  border-color: #2b54a3;
  background: #eff6ff;
}

.event-card:active {
  background: #dbeafe;
  transform: scale(0.98);
}

.event-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.event-date {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

/* ── Consent ── */
#screen-consent h2 {
  text-align: center;
}

.consent-text {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  margin: 16px 0 24px;
  text-align: justify;
}

.consent-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.consent-btn {
  margin-top: 0;
}

.confirm-help {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin: 12px 0 0;
}

/* ── Confirm Info Details ── */
.confirm-details {
  margin: 20px 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
  text-align: right;
}

/* ── Read-only field in edit form ── */
.read-only-field {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.read-only-field .detail-label {
  display: block;
  margin-bottom: 4px;
}

.read-only-field .detail-value {
  display: block;
  text-align: left;
}

.read-only-note {
  display: block;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  margin-top: 4px;
}

/* ── Error Messages ── */
.error-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 14px;
}

.error-message[hidden] {
  display: none;
}

/* ── Spinner ── */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid #e5e7eb;
  border-top-color: #2b54a3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Success Screen ── */
.success-event {
  font-size: 18px;
  font-weight: 600;
  color: #1e3a5f;
  margin-top: 8px;
}

.print-notice {
  margin-top: 20px;
  padding: 16px;
  background: #f0fdf4;
  border-radius: 8px;
  color: #166534;
  font-size: 15px;
  font-weight: 500;
}

.attendee-summary {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.attendee-summary .summary-name {
  font-size: 18px;
  font-weight: 600;
}

.attendee-summary .summary-detail {
  font-size: 14px;
  color: #4b5563;
  margin-top: 2px;
}

/* ── Schedule Link ── */
.schedule-link {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  background: #1e3a5f;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
}

.schedule-link:hover {
  background: #15294a;
}

/* ── Offline Banner ── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #dc2626;
  color: #fff;
  text-align: center;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Auto-Reset Countdown ── */
.reset-countdown {
  font-size: 13px;
  color: #6b7280;
  margin-top: 20px;
  text-align: center;
}

/* ── Responsive ── */
@media (min-width: 480px) {
  body {
    padding: 48px 24px;
    align-items: center;
  }

  .card {
    padding: 36px 32px;
  }
}
