/* ── Design tokens ── */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #1f2937;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-accent: #f59e0b;
  --color-accent-hover: #d97706;
  --color-accent-soft: #fffbeb;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ── Reset & Base ── */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

body {
  padding: 0 0 3rem;
}

/* ── Links ── */
a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: #374151;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
a.btn:hover {
  text-decoration: none;
}
.btn:hover {
  background: #f1f5f9;
  border-color: #9ca3af;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}
.btn-danger {
  border-color: #fca5a5;
  color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger-bg);
  border-color: #f87171;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: #f1f5f9;
  border-color: transparent;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}
.btn-large {
  padding: 11px 20px;
  font-size: 15px;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
}
.action-icon {
  width: 12px;
  height: 12px;
  margin-right: 5px;
  flex-shrink: 0;
}

/* ── Forms ── */
input, select, textarea {
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
}
input.input-error, select.input-error, textarea.input-error, .input-error {
  border-color: var(--color-danger) !important;
}
input.input-error:focus, select.input-error:focus, textarea.input-error:focus {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
}
input[type="number"] {
  width: 100%;
  -moz-appearance: textfield;
}
input[type="date"], input[type="time"] {
  width: 100%;
}

/* ── Alerts / toasts ── */
.banner-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(560px, calc(100vw - 2rem));
}
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-shadow: var(--shadow-md);
  animation: toast-in .18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.alert-error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: #991b1b;
}
.alert-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #166534;
}
.alert button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Cards ── */
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}
.card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}
.card-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Grid (minimal, replacing Bootstrap's row/span) ── */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}
.row > [class*="span"] {
  padding: 0 10px;
  box-sizing: border-box;
}
.span1  { flex: 0 0 8.33%;  }
.span2  { flex: 0 0 16.66%; }
.span3  { flex: 0 0 25%;    }
.span4  { flex: 0 0 33.33%; }
.span5  { flex: 0 0 41.66%; }
.span6  { flex: 0 0 50%;    }
.offset3 { margin-left: 25%; }
.span7  { flex: 0 0 58.33%; }
.span8  { flex: 0 0 66.66%; }
.span9  { flex: 0 0 75%;    }
.span10 { flex: 0 0 83.33%; }
.span11 { flex: 0 0 91.66%; }
.span12 { flex: 0 0 100%;   }

/* ── Utility ── */
.muted { color: var(--color-text-muted); }
.text-info { color: #3b82f6; }
.input-block-level { display: block; width: 100%; box-sizing: border-box; }

/* ── Form card ── */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.form-card h3 {
  margin-top: 0;
}

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Site header (dashboard) ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0 .75rem;
  margin-bottom: 1.25rem;
}
.site-header-logo img {
  height: 84px;
  width: auto;
  display: block;
}
.site-header-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.page-header {
  text-align: center;
  padding: 2rem 0 1rem;
}
.page-header img {
  max-width: 200px;
  height: auto;
}

/* ── Toggle switch ── */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  padding: 2px;
  gap: 2px;
}
.toggle-group button {
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.toggle-group button.active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

/* ── Form row ── */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.form-row > * {
  flex: 1;
  min-width: 80px;
}
.form-row > .flex-2 {
  flex: 2;
}
.form-row > .flex-3 {
  flex: 3;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.form-help {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* ── Meteogram container ── */
.meteogram-wrap {
  margin-top: 12px;
  background: #fbfcfe;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  overflow-x: auto;
}

/* ── Forecast summary chips ── */
.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.chip-emoji {
  background: var(--color-accent-soft);
}
.chip-countdown {
  background: #fffbeb;
  color: var(--color-accent);
  border: 1px solid #fde68a;
}
.chip-muted {
  background: #f1f5f9;
  color: var(--color-text-muted);
}

/* ── Skeleton loading ── */
.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-stack .skeleton-line:first-child {
  width: 100%;
}
.skeleton-stack .skeleton-line:last-child {
  width: 70%;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}
.empty-state h3 {
  margin: 0 0 .5rem;
}
.empty-state p {
  margin: 0 0 1.25rem;
  color: var(--color-text-secondary);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem 0 1rem;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Example rotation (login screen) ── */
.example {
  display: inline-block;
  transition: opacity .3s ease;
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
}
.example-visible {
  opacity: 1;
}
.example-hidden {
  opacity: 0;
}

/* ── Login ── */
.login-header {
  text-align: center;
  padding: 3rem 0;
}
.login-logo {
  max-width: 390px;
  margin-bottom: 1rem;
}
.login-subtitle {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--color-text-secondary);
}
.login-handle-input {
  padding: 7px 9px;
  font-size: 18px;
  margin-bottom: 12px;
}

/* ── Loading ── */
.loading-view {
  text-align: center;
  padding: 4rem 0;
}

/* ── Shared View ── */
.shared-container {
  padding-top: 2rem;
}
.shared-header {
  text-align: center;
  margin-bottom: 1rem;
}
.shared-logo {
  max-width: 390px;
}
.shared-not-found {
  padding-top: 4rem;
  text-align: center;
}

/* ── Event Form Elements ── */
.form-label-spaced {
  margin-top: 12px;
}
.geocoding-error {
  color: var(--color-danger);
  margin-top: 4px;
  margin-bottom: 4px;
}
.typeahead {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.typeahead-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--color-text);
}
.typeahead-item:hover,
.typeahead-item.typeahead-active {
  background: var(--color-accent-soft);
}
.typeahead-actor {
  display: flex;
  align-items: center;
  gap: 8px;
}
.typeahead-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.form-row-spaced {
  margin-top: 12px;
}
.forecast-hours-setting {
  margin-top: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
input[type="number"].input-hours {
  display: inline-block;
  width: 60px;
  margin: 0 4px;
  text-align: center;
}
.form-actions-wrap {
  margin-top: 12px;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.form-validation-error {
  color: var(--color-danger);
  font-size: 13px;
}
.map-container {
  position: relative;
  width: 100%;
  height: 340px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.map-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.map-placeholder {
  height: 340px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

/* ── Footer ── */
.footer-heart {
  color: #ec4899;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .form-row {
    flex-direction: column;
  }
  .site-header {
    flex-wrap: wrap;
  }
  .card-header {
    flex-direction: column;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
