/* Event Portal - mobile-first stylesheet (no frameworks) */

:root {
  --color-primary: #0f766e;
  --color-primary-dark: #115e59;
  --color-primary-soft: #ccfbf1;
  --color-accent: #f59e0b;
  --color-accent-soft: #fef3c7;
  --color-danger: #dc2626;
  --color-whatsapp: #16a34a;

  --color-bg: #f1f5f4;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-border: #e2e8f0;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd, ol, ul {
  margin: 0;
}

a {
  color: var(--color-primary);
}

/* ---------- Layout ---------- */
.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--color-bg);
}

@media (min-width: 481px) {
  body {
    background: #dfe7e5;
  }
  .app {
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 20px 56px;
  background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
  margin-bottom: -40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-compact {
  padding-top: 24px;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.hero-title {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  text-wrap: balance;
}

.hero-greeting {
  font-size: 18px;
  font-weight: 600;
}

.hero-meta {
  font-size: 14px;
  opacity: 0.9;
}

.avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* ---------- Quick nav ---------- */
.quick-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 16px;
  padding: 6px;
  display: flex;
  gap: 4px;
  background: var(--color-surface);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.quick-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-muted);
  border-radius: 999px;
}

.quick-nav a:hover,
.quick-nav a:focus-visible {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* ---------- Cards ---------- */
.card {
  margin: 0 16px;
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: 72px;
}

.card-muted {
  background: transparent;
  box-shadow: none;
  border: 1px dashed var(--color-border);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: -8px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--color-muted);
}

/* ---------- Form ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

[hidden] {
  display: none !important;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--color-muted) 50%),
    linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.field [aria-invalid="true"] {
  border-color: var(--color-danger);
}

.field-hint {
  font-size: 12px;
  color: var(--color-muted);
}

.field-error {
  font-size: 13px;
  color: var(--color-danger);
}

.alert {
  padding: 12px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.alert-error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

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

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

.btn-outline {
  color: var(--color-primary);
  background: #fff;
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
}

.btn-whatsapp {
  color: #fff;
  background: var(--color-whatsapp);
}

.btn-whatsapp:hover {
  background: #15803d;
}

.btn-danger-outline {
  color: var(--color-danger);
  background: #fff;
  border-color: #fecaca;
}

.btn-danger-outline:hover {
  background: #fef2f2;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-light {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.badge-done {
  color: var(--color-muted);
  background: #f1f5f9;
}

.badge-live {
  color: #92400e;
  background: var(--color-accent-soft);
}

.badge-upcoming {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
}

/* ---------- Details ---------- */
.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail {
  padding: 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.detail dt {
  font-size: 12px;
  color: var(--color-muted);
}

.detail dd {
  font-size: 14px;
  font-weight: 600;
}

.location {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.location-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.location-venue {
  font-weight: 700;
}

.location-address {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  padding: 0;
  position: relative;
}

.timeline-item {
  position: relative;
  padding: 0 0 20px 28px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 18px;
  bottom: -2px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-primary);
}

.timeline-item.is-done::after {
  background: var(--color-muted);
  border-color: var(--color-muted);
}

.timeline-item.is-live::after {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timeline-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.is-done .timeline-time,
.is-done .timeline-title {
  color: var(--color-muted);
}

.timeline-title {
  font-weight: 600;
  margin-top: 2px;
}

.timeline-place {
  font-size: 13px;
  color: var(--color-muted);
}

/* ---------- Contacts ---------- */
.contacts {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.contact-info {
  min-width: 0;
}

.contact-name {
  font-weight: 600;
}

.contact-role,
.contact-phone {
  font-size: 13px;
  color: var(--color-muted);
}

.contact-phone {
  font-variant-numeric: tabular-nums;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: auto;
  padding: 8px 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
}

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

.alert-success {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

/* ---------- Admin ---------- */
.admin-body {
  background: var(--color-bg);
}

.admin-container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

.admin-topbar {
  color: #fff;
  background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.admin-topbar-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-brand {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.admin-brand span {
  font-weight: 500;
  opacity: 0.8;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.btn-outline-light {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
}

.admin-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.admin-nav-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.admin-nav a {
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.admin-nav a:hover {
  color: var(--color-text);
}

.admin-nav a[aria-current="page"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.admin-nav .admin-nav-external {
  margin-left: auto;
}

.admin-main {
  padding-top: 24px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-main .card {
  margin: 0;
}

.admin-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.admin-page-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

.admin-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 960px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }
}

.admin-auth {
  width: 100%;
  max-width: 420px;
  margin: 32px auto 0 !important;
}

.admin-form-card {
  max-width: 820px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-label {
  font-size: 13px;
  color: var(--color-muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters input,
.filters select {
  flex: 1 1 220px;
  min-height: 36px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.table-wrap {
  margin: 0 -20px;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 20px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: #f8fafc;
}

.table tbody tr:hover {
  background: #f8fafc;
}

.table tr.is-editing {
  background: var(--color-primary-soft);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.cell-strong {
  font-weight: 600;
}

.cell-muted {
  color: var(--color-muted);
}

.cell-nowrap {
  white-space: nowrap;
}

.empty-state {
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  color: var(--color-muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.pagination-links {
  display: flex;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.form-row {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .form-grid,
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .field-wide {
    grid-column: 1 / -1;
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.optional {
  font-weight: 400;
  color: var(--color-muted);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
