/**
 * Light UI inspired by Apple Human Interface Guidelines (typography, spacing, materials).
 * Uses system fonts; accent follows system blue on Apple platforms.
 */

:root {
  color-scheme: light;

  /* Labels (Apple-style hierarchy) */
  --label-primary: #1d1d1f;
  --label-secondary: rgba(60, 60, 67, 0.6);
  --label-tertiary: rgba(60, 60, 67, 0.45);

  /* Surfaces */
  --bg-page: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-grouped: #f2f2f7;
  --fill-quaternary: rgba(116, 116, 128, 0.08);
  --fill-tertiary: rgba(118, 118, 128, 0.12);

  /* Separators & hairlines */
  --separator-opaque: #d2d2d7;
  --separator-nonopaque: rgba(60, 60, 67, 0.18);

  /* Accent — system blue */
  --accent: #007aff;
  --accent-hover: #0066dd;
  --accent-active: #0051d5;
  --destructive: #ff3b30;

  /* Radii (pt-aligned) */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 980px;

  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", system-ui, sans-serif;
  --tracking-tight: -0.022em;
  --tracking-headline: -0.03em;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-stack);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.011em;
  background: var(--bg-page);
  color: var(--label-primary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a:hover {
  opacity: 0.85;
}

a:active {
  opacity: 0.65;
}

/* ——— App chrome ——— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem max(1.25rem, env(safe-area-inset-right)) 0.75rem
    max(1.25rem, env(safe-area-inset-left));
  min-height: 52px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator-nonopaque);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  color: var(--label-primary);
  text-decoration: none;
}

.app-brand:hover {
  opacity: 0.92;
}

.app-brand:active {
  opacity: 0.85;
}

.app-brand-logo {
  flex-shrink: 0;
  display: block;
  width: auto;
  height: 2rem;
  object-fit: contain;
}

.app-brand-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.2;
}

@media (max-width: 480px) {
  .app-brand-title {
    font-size: 15px;
  }

  .app-brand-logo {
    height: 1.75rem;
  }
}

/* Per-view OpenShift branding (Presenter / Attendee) */
.view-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.view-brand-logo {
  flex-shrink: 0;
  display: block;
  height: 2rem;
  width: auto;
  object-fit: contain;
}

.view-brand-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-secondary);
}

.modal-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 0.5rem;
}

.modal-brand-logo {
  display: block;
  height: 2.5rem;
  width: auto;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 500;
  color: var(--label-primary);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover {
  background: var(--fill-tertiary);
  opacity: 1;
}

.nav-links a:active {
  background: var(--fill-quaternary);
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem max(1.25rem, env(safe-area-inset-right)) 3rem
    max(1.25rem, env(safe-area-inset-left));
}

/* ——— Page sections ——— */
.page-intro {
  margin: 0 0 1.25rem;
  font-size: 15px;
  line-height: 1.5;
  color: var(--label-secondary);
}

.page-intro strong {
  color: var(--label-primary);
  font-weight: 600;
}

.presenter-day-block {
  margin-bottom: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--separator-nonopaque);
}

.presenter-day-title {
  margin: 0 0 0.65rem;
  font-size: 15px;
  font-weight: 600;
  color: var(--label-primary);
}

.presenter-skip-row {
  margin-bottom: 0.5rem;
}

.presenter-skip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 15px;
  color: var(--label-primary);
  cursor: pointer;
}

.presenter-skip-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.presenter-file-hint {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

.presenter-day-block.is-day-skipped .presenter-file-row,
.presenter-day-block.is-day-skipped .presenter-file-hint {
  opacity: 0.45;
  pointer-events: none;
}


.presenter-form-columns-hint {
  margin-bottom: 1rem;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-toolbar p {
  margin: 0;
  font-size: 15px;
  color: var(--label-secondary);
}

.page-toolbar strong {
  color: var(--label-primary);
  font-weight: 600;
}

/* ——— Timezone world map (Leaflet + OSM, Attendee) ——— */
.tz-map-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--separator-nonopaque);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tz-map-inner {
  height: min(240px, 42vh);
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-grouped);
}

.tz-map-panel .leaflet-container {
  font-family: var(--font-stack);
  z-index: 1;
}

.tz-map-panel .leaflet-top,
.tz-map-panel .leaflet-bottom {
  z-index: 2;
}

.tz-map-id {
  margin: 0.75rem 0 0;
  padding-top: 0.65rem;
  border-top: 0.5px solid var(--separator-nonopaque);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--label-tertiary);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.tz-map-attribution {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.35;
  color: var(--label-tertiary);
}

.tz-map-attribution a {
  color: var(--label-secondary);
}

.tz-map-fallback {
  margin: 0;
  padding: 1.25rem;
  text-align: center;
  font-size: 14px;
  color: var(--label-secondary);
}

/* Timezone name labels (Leaflet divIcon) */
.tz-map-panel .leaflet-div-icon.tz-map-label-wrap {
  border: none !important;
  background: transparent !important;
}

.tz-map-label-wrap .tz-map-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 0.5px solid var(--separator-opaque);
  background: rgba(255, 255, 255, 0.94);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--label-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.tz-map-label-wrap--active .tz-map-label,
.tz-map-label--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 122, 255, 0.12);
  font-weight: 700;
}

/* ——— Buttons ——— */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn-row--start {
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-pill);
  border: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.022em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

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

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

.btn-secondary {
  background: var(--fill-tertiary);
  color: var(--label-primary);
}

.btn-secondary:hover {
  background: rgba(118, 118, 128, 0.18);
}

.btn-ghost {
  min-height: 40px;
  padding: 0 0.75rem;
  background: transparent;
  color: var(--accent);
  font-size: 17px;
  font-weight: 400;
}

.btn-ghost:hover {
  background: rgba(0, 122, 255, 0.08);
}

.btn-ghost:active {
  background: rgba(0, 122, 255, 0.14);
}

/* ——— Modals ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 420px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  -webkit-overflow-scrolling: touch;
}

.modal h2 {
  margin: 0 0 1.25rem;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.25;
  text-align: center;
  color: var(--label-primary);
}

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

.form-group:last-of-type {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--label-secondary);
}

.form-group input[type="file"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--separator-opaque);
  background: var(--bg-elevated);
  color: var(--label-primary);
  font-family: inherit;
  font-size: 17px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input[type="file"] {
  min-height: auto;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
}

.form-group input:focus-visible,
.form-group select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 0.25rem;
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--label-tertiary);
}

.error-msg {
  margin: 0.5rem 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--destructive);
}

.presenter-share-hint {
  margin-top: 0.5rem;
  max-width: 44rem;
}

.presenter-link-status {
  margin-top: 0.35rem;
  max-width: 44rem;
}

.attendee-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  font-size: 15px;
  line-height: 1.35;
  border-radius: var(--radius-md);
  background: var(--fill-quaternary);
  color: var(--label-primary);
}

.attendee-banner--error {
  background: rgba(255, 59, 48, 0.12);
  color: var(--destructive);
}

.attendee-banner--success {
  background: rgba(52, 199, 89, 0.14);
  color: var(--label-primary);
}

/* ——— Tables (presenter preview) ——— */
.preview-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  margin-top: 0.75rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 0.5px solid var(--separator-nonopaque);
  background: var(--bg-elevated);
}

.preview-table th,
.preview-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 0.5px solid var(--separator-nonopaque);
  vertical-align: top;
}

.preview-table tr:last-child td {
  border-bottom: none;
}

.preview-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-secondary);
  background: var(--bg-grouped);
}

.preview-table td {
  color: var(--label-primary);
}

.presenter-preview {
  margin-top: 1rem;
}

.presenter-preview h3 {
  margin: 0 0 0.5rem;
  font-size: 15px;
  font-weight: 600;
  color: var(--label-secondary);
}

/* ——— Attendee: grouped day cards ——— */
.day-block {
  margin-bottom: 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 0.5px solid var(--separator-nonopaque);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.day-header {
  padding: 0.65rem 1rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-secondary);
  background: var(--bg-grouped);
  border-bottom: 0.5px solid var(--separator-nonopaque);
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: baseline;
  padding: 0.9rem 1rem;
  border-bottom: 0.5px solid var(--separator-nonopaque);
}

.session-item:last-child {
  border-bottom: none;
}

.session-time {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.session-title {
  font-size: 17px;
  font-weight: 400;
  color: var(--label-primary);
  letter-spacing: -0.022em;
}

.session-duration {
  font-size: 13px;
  font-weight: 500;
  color: var(--label-secondary);
  white-space: nowrap;
}

.empty-state {
  margin: 2rem 0;
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: var(--label-secondary);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 0.5px dashed var(--separator-opaque);
}

@media (max-width: 600px) {
  .session-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .session-duration {
    justify-self: start;
  }

  .nav-links a {
    padding: 0.35rem 0.5rem;
    font-size: 14px;
  }
}
