/* ==========================================================================
   Palco Agenda — Teatro em Pernambuco (Fase 1)
   Design System Palco PE (Apple Liquid Glass)
   ========================================================================== */

:root {
  --studio-bg: #0b0b0e;
  --studio-surface: #14141a;
  --studio-surface-2: #1c1c24;
  --studio-text: #f5f5f7;
  --studio-muted: #9ca3af;

  --glass-surface: rgba(24, 24, 30, 0.72);
  --glass-surface-strong: rgba(20, 20, 26, 0.94);
  --glass-pill-bg: rgba(255, 255, 255, 0.06);
  --glass-pill-hover: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --glass-blur: blur(20px) saturate(165%);

  --primary: #eb8018;
  --primary-glow: rgba(235, 128, 24, 0.28);
  --primary-ink: #111111;

  color-scheme: dark;
  accent-color: var(--primary);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100dvh;
  background: var(--studio-bg);
  color: var(--studio-text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  flex-direction: column;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 44px;
  width: auto;
  display: block;
}

.app-tag {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--studio-muted);
  white-space: nowrap;
}

.topbar__island {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--studio-muted);
  padding: 4px 10px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--studio-text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn--pill {
  border-radius: 999px;
}

.btn--subtle {
  background: var(--glass-pill-bg);
  border-color: var(--glass-border);
}

.btn--subtle:hover {
  background: var(--glass-pill-hover);
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 0 18px var(--primary-glow);
}

.btn--primary:hover {
  background: #f5912e;
}

/* Main & Busca Única */
.main-wrap {
  flex: 1;
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 18px 14px 48px;
}

.search-section {
  margin-bottom: 18px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--studio-surface);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 4px 14px;
  box-shadow: var(--glass-highlight);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box__icon {
  color: var(--studio-muted);
  flex-shrink: 0;
  margin-right: 10px;
}

.search-box__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px 4px;
  font-size: 14px;
  outline: none;
}

.search-box__clear {
  border: none;
  background: var(--glass-pill-bg);
  color: var(--studio-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.search-meta {
  margin-top: 8px;
  padding-left: 12px;
  font-size: 12.5px;
  color: var(--studio-muted);
}

/* Grid de Cards */
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.event-card {
  background: var(--studio-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.event-card:hover {
  transform: translateY(-2px);
  border-color: rgba(235, 128, 24, 0.5);
}

.event-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0d0d12;
  overflow: hidden;
}

.event-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Grafismo padrão nas cores do Palco Pernambuco */
.palco-poster-fallback {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 85% 18%, rgba(235, 128, 24, 0.34), transparent 52%),
    radial-gradient(circle at 12% 90%, rgba(235, 128, 24, 0.18), transparent 48%),
    linear-gradient(145deg, #15151e 0%, #0b0b0e 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.palco-poster-fallback::before {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1.5px solid rgba(235, 128, 24, 0.25);
}

.palco-poster-fallback__group {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 4px;
}

.palco-poster-fallback__title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.card-status-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(11, 11, 14, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f5f5f7;
}

.card-status-pill.is-live {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-ink);
}

.event-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.event-card__title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.25;
}

.event-card__group {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.event-card__meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--studio-muted);
}

.meta-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.meta-line svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.event-card__footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge-price {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-border);
}

.badge-price.is-free {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.12);
}

.badge-age {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--studio-surface-2);
  color: var(--studio-text);
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--studio-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Modal de Detalhes */
.palco-dialog {
  margin: auto;
  width: min(560px, calc(100vw - 20px));
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--studio-text);
  box-shadow: var(--glass-shadow);
  padding: 0;
}

.palco-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.detail-media {
  aspect-ratio: 16 / 9;
  background: #0b0b0e;
  overflow: hidden;
}

.detail-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-top-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
}

.detail-group {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.detail-info-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13.5px;
  color: var(--studio-text);
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 14px;
}

.detail-synopsis {
  font-size: 14px;
  line-height: 1.55;
  color: var(--studio-muted);
}

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

.detail-footer {
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--studio-muted);
  flex-wrap: wrap;
}

.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--studio-muted);
  background: var(--glass-surface);
  border-top: 1px solid var(--glass-border);
}

.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 28, 0.96);
  border: 1.5px solid var(--primary);
  color: #ffffff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--glass-shadow);
  z-index: 90;
}

/* Área Exclusiva do Grupo (?g=...&k=...) */
.group-box {
  background: var(--studio-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.group-box--error {
  border-color: rgba(248, 113, 113, 0.5);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.group-header__title {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.group-card {
  background: var(--studio-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.group-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.group-card__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.group-card__head .group-card__title {
  margin-bottom: 0;
}

.group-events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--glass-pill-bg);
  border: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.group-event-row__title {
  font-size: 14.5px;
  font-weight: 700;
}

.group-event-row__meta {
  font-size: 12px;
  color: var(--studio-muted);
}

.group-event-row__actions {
  display: flex;
  gap: 8px;
}

.group-editor-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
  align-items: start;
}

.group-preview-col {
  position: sticky;
  top: 76px;
}

.group-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--studio-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--studio-bg);
  color: var(--studio-text);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 2px;
}

.check-chips label,
.responsibility-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--studio-text);
  cursor: pointer;
}

.responsibility-check {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(235, 128, 24, 0.1);
  border: 1px solid rgba(235, 128, 24, 0.35);
}

@media (max-width: 900px) {
  .group-editor-grid {
    grid-template-columns: 1fr;
  }

  .group-preview-col {
    position: static;
  }
}

@media (max-width: 720px) {
  .hide-on-xs {
    display: none;
  }

  .topbar {
    padding: 7px 12px;
  }

  .brand-logo-img {
    height: 32px;
  }

  .agenda-grid {
    grid-template-columns: 1fr;
  }

  .palco-dialog {
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .palco-dialog,
  .bottombar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--studio-surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
