/* Emergency alerts: admin management and cache-independent public display. */

.pcap-alerts-admin {
  --pcap-alert-surface: #fff;
  --pcap-alert-soft: #f4f7fa;
  --pcap-alert-line: #dce5ed;
  --pcap-alert-ink: #153650;
  --pcap-alert-muted: #667b8e;
  max-width: 1380px;
  color: var(--pcap-alert-ink);
}

.pcap-alerts-admin [hidden] {
  display: none !important;
}

.pcap-alerts-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 22px 0 18px;
  padding: 27px 29px;
  border: 1px solid var(--pcap-alert-line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 10%, rgba(220, 57, 76, 0.12), transparent 32%),
    linear-gradient(135deg, #fff, #f8fafc);
  box-shadow: 0 14px 40px rgba(20, 60, 95, 0.07);
}

.pcap-alerts-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #c33248;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.pcap-alerts-hero h1 {
  margin: 0;
  color: var(--pcap-alert-ink);
  font-size: clamp(26px, 3vw, 36px);
}

.pcap-alerts-hero p {
  margin: 8px 0 0;
  color: var(--pcap-alert-muted);
  font-size: 14px;
}

.pcap-alerts-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.pcap-alerts-summary article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--pcap-alert-line);
  border-radius: 14px;
  background: var(--pcap-alert-surface);
}

.pcap-alerts-summary span {
  color: var(--pcap-alert-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.pcap-alerts-summary strong {
  font-size: 24px;
}

.pcap-alerts-list {
  display: grid;
  gap: 10px;
}

.pcap-alert-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 17px 18px;
  border: 1px solid var(--pcap-alert-line);
  border-left: 4px solid #3083c5;
  border-radius: 15px;
  background: var(--pcap-alert-surface);
  box-shadow: 0 7px 24px rgba(20, 60, 95, 0.05);
}

.pcap-alert-row.is-important {
  border-left-color: #d98b22;
}

.pcap-alert-row.is-critical {
  border-left-color: #d63750;
}

.pcap-alert-row__icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: var(--pcap-alert-soft);
  color: #be354a;
}

.pcap-alert-row__icon .dashicons {
  width: auto;
  height: auto;
  font-size: 24px;
}

.pcap-alert-row__meta,
.pcap-alert-row__details,
.pcap-alert-row__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.pcap-alert-row__meta span,
.pcap-alert-row__meta b,
.pcap-alert-row__meta small {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--pcap-alert-soft);
  color: var(--pcap-alert-muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.pcap-alert-row__meta span.is-active {
  background: #e8f8f1;
  color: #16835b;
}

.pcap-alert-row__meta span.is-scheduled {
  background: #fff3d9;
  color: #9b6818;
}

.pcap-alert-row__meta span.is-pending {
  background: #f7eefe;
  color: #7941a7;
}

.pcap-alert-row h2 {
  margin: 7px 0 4px;
  color: var(--pcap-alert-ink);
  font-size: 15px;
}

.pcap-alert-row p {
  margin: 0;
  color: var(--pcap-alert-muted);
  font-size: 11px;
}

.pcap-alert-row__details {
  margin-top: 8px;
  color: var(--pcap-alert-muted);
  font-size: 9px;
}

.pcap-alert-row__details span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pcap-alert-row__details .dashicons {
  width: 14px;
  height: 14px;
  font-size: 14px;
}

.pcap-alert-close {
  color: #b93249 !important;
}

.pcap-alerts-empty {
  padding: 50px 20px;
  border: 1px dashed var(--pcap-alert-line);
  border-radius: 16px;
  color: var(--pcap-alert-muted);
  text-align: center;
}

.pcap-alert-back {
  display: inline-block;
  margin-top: 20px;
  color: var(--pcap-alert-muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.pcap-alert-editor__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 18px;
}

.pcap-alert-editor__main,
.pcap-alert-editor__side {
  display: grid;
  gap: 17px;
  padding: 23px;
  border: 1px solid var(--pcap-alert-line);
  border-radius: 17px;
  background: var(--pcap-alert-surface);
  box-shadow: 0 8px 28px rgba(20, 60, 95, 0.055);
}

.pcap-alert-editor__side {
  position: sticky;
  top: 48px;
}

.pcap-alert-editor__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pcap-alert-editor label {
  display: grid;
  gap: 7px;
}

.pcap-alert-editor label > span {
  font-size: 11px;
  font-weight: 800;
}

.pcap-alert-editor label > small {
  color: var(--pcap-alert-muted);
  font-size: 9px;
  line-height: 1.4;
}

.pcap-alert-editor input[type="text"],
.pcap-alert-editor input[type="url"],
.pcap-alert-editor input[type="datetime-local"],
.pcap-alert-editor textarea,
.pcap-alert-editor select {
  width: 100%;
  max-width: none;
  border-color: var(--pcap-alert-line);
  border-radius: 9px;
}

.pcap-alert-editor input[type="text"],
.pcap-alert-editor input[type="url"],
.pcap-alert-editor input[type="datetime-local"],
.pcap-alert-editor select {
  min-height: 41px;
}

.pcap-alert-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 9px !important;
  padding: 11px;
  border: 1px solid var(--pcap-alert-line);
  border-radius: 10px;
}

.pcap-alert-check input {
  margin: 0;
}

.pcap-alert-permission-note {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  padding: 12px;
  border-radius: 10px;
  background: var(--pcap-alert-soft);
}

.pcap-alert-preview {
  --preview-color: #3083c5;
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--preview-color) 35%, transparent);
  border-left: 4px solid var(--preview-color);
  border-radius: 10px;
  background: color-mix(in srgb, var(--preview-color) 7%, var(--pcap-alert-surface));
}

.pcap-alert-preview.is-important {
  --preview-color: #d98b22;
}

.pcap-alert-preview.is-critical {
  --preview-color: #d63750;
}

.pcap-alert-preview small {
  color: var(--preview-color);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.pcap-alert-preview strong {
  color: var(--pcap-alert-ink);
  font-size: 12px;
}

.pcap-alert-preview p {
  max-height: 70px;
  margin: 0;
  overflow: hidden;
  color: var(--pcap-alert-muted);
  font-size: 10px;
  line-height: 1.45;
}

.pcap-alert-permission-note .dashicons {
  color: var(--pcap-accent);
}

.pcap-alert-permission-note p {
  margin: 0;
  color: var(--pcap-alert-muted);
  font-size: 10px;
  line-height: 1.5;
}

.pcap-alert-editor form.is-critical-alert .pcap-alert-editor__side {
  border-color: rgba(214, 55, 80, 0.45);
  box-shadow: 0 8px 28px rgba(214, 55, 80, 0.1);
}

body.primaria-admin-premium.pcap-dark-active .pcap-alerts-admin {
  --pcap-alert-surface: #102335;
  --pcap-alert-soft: #172d40;
  --pcap-alert-line: #294156;
  --pcap-alert-ink: #ecf5fb;
  --pcap-alert-muted: #9fb3c4;
}

body.primaria-admin-premium.pcap-dark-active .pcap-alerts-hero {
  background: linear-gradient(135deg, #102335, #152d41);
}

/* Public alerts. */
.pcap-alert-stack {
  position: relative;
  z-index: 999990;
  display: grid;
  width: 100%;
  gap: 1px;
  font-family: inherit;
}

.pcap-alert-stack--top {
  position: sticky;
  top: 0;
}

body.admin-bar .pcap-alert-stack--top {
  top: 32px;
}

.pcap-alert-stack--bottom {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(560px, calc(100% - 36px));
}

.pcap-emergency-alert {
  --alert-bg: #eaf4fc;
  --alert-border: #2f80bf;
  --alert-ink: #123a59;
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  padding: 15px clamp(16px, 3vw, 30px);
  border: 1px solid color-mix(in srgb, var(--alert-border) 34%, transparent);
  border-left: 5px solid var(--alert-border);
  background: var(--alert-bg);
  color: var(--alert-ink);
  box-shadow: 0 10px 28px rgba(20, 45, 65, 0.12);
}

.pcap-emergency-alert.is-important {
  --alert-bg: #fff5df;
  --alert-border: #d88617;
  --alert-ink: #5f3c0a;
}

.pcap-emergency-alert.is-critical {
  --alert-bg: #fff0f2;
  --alert-border: #d3314c;
  --alert-ink: #6e1626;
}

.pcap-emergency-alert__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--alert-border) 14%, transparent);
  color: var(--alert-border);
}

.pcap-emergency-alert__content {
  min-width: 0;
}

.pcap-emergency-alert__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--alert-border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.pcap-emergency-alert h2 {
  margin: 0 0 4px;
  color: var(--alert-ink);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.25;
}

.pcap-emergency-alert p {
  margin: 0;
  color: var(--alert-ink);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.pcap-emergency-alert__location {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
}

.pcap-emergency-alert__location .dashicons {
  width: 15px;
  height: 15px;
  font-size: 15px;
}

.pcap-emergency-alert__validity {
  display: block;
  margin-top: 7px;
  opacity: 0.76;
  font-size: 10px;
}

.pcap-emergency-alert__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pcap-emergency-alert__actions a,
.pcap-emergency-alert__understood {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: var(--alert-border);
  color: #fff !important;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none !important;
}

.pcap-emergency-alert__close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--alert-ink);
  cursor: pointer;
  font-size: 0;
}

.pcap-emergency-alert__close::before {
  font-size: 22px;
  content: "×";
}

.pcap-alert-stack--bottom .pcap-emergency-alert {
  border-radius: 15px;
}

.pcap-alert-modal-backdrop {
  position: fixed;
  z-index: 999999;
  display: grid;
  inset: 0;
  place-items: center;
  padding: 20px;
  background: rgba(5, 20, 32, 0.7);
  backdrop-filter: blur(5px);
}

.pcap-emergency-alert.is-modal {
  grid-template-columns: 48px minmax(0, 1fr);
  width: min(650px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  padding: clamp(22px, 5vw, 36px);
  overflow-y: auto;
  border: 0;
  border-top: 6px solid var(--alert-border);
  border-radius: 20px;
  background: #fff;
}

.pcap-emergency-alert.is-modal .pcap-emergency-alert__understood {
  grid-column: 1 / -1;
  justify-self: end;
}

html.pcap-alert-modal-open {
  overflow: hidden;
}

@media (max-width: 782px) {
  .pcap-alerts-admin {
    margin-right: 10px;
  }

  .pcap-alert-editor__layout {
    grid-template-columns: 1fr;
  }

  .pcap-alert-editor__side {
    position: static;
  }

  body.admin-bar .pcap-alert-stack--top {
    top: 46px;
  }

  .pcap-alert-stack--bottom {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (max-width: 600px) {
  .pcap-alerts-hero {
    display: grid;
    padding: 20px;
  }

  .pcap-alerts-hero .button {
    width: 100%;
    text-align: center;
  }

  .pcap-alerts-summary,
  .pcap-alert-editor__grid {
    grid-template-columns: 1fr;
  }

  .pcap-alert-row {
    grid-template-columns: 43px minmax(0, 1fr);
    padding: 14px;
  }

  .pcap-alert-row__icon {
    width: 42px;
    height: 42px;
  }

  .pcap-alert-row__actions {
    grid-column: 1 / -1;
  }

  .pcap-emergency-alert {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 13px 12px;
  }

  .pcap-emergency-alert__icon {
    width: 31px;
    height: 31px;
  }

  .pcap-emergency-alert.is-modal {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pcap-alert-modal-backdrop {
    backdrop-filter: none;
  }
}
