/* ═══════════════════════════════════════════════════════════════
   PREMIUM UX — Scroll Reveal · Active Nav · Toast · Badges
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Page entrance ─────────────────────────────────────────── */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-shell {
  animation: pageEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── 2. Scroll reveal ─────────────────────────────────────────── */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes revealFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: none;
}

[data-reveal].is-visible {
  animation: revealUp 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-reveal="fade"].is-visible {
  animation: revealFade 0.52s ease both;
}

[data-reveal-delay="100"].is-visible  { animation-delay: 0.10s; }
[data-reveal-delay="200"].is-visible  { animation-delay: 0.20s; }
[data-reveal-delay="300"].is-visible  { animation-delay: 0.30s; }
[data-reveal-delay="400"].is-visible  { animation-delay: 0.40s; }
[data-reveal-delay="500"].is-visible  { animation-delay: 0.50s; }

/* ── 3. Active nav link ───────────────────────────────────────── */
.site-nav a[aria-current="page"],
.site-nav-home a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(15, 124, 130, 0.15), rgba(20, 151, 159, 0.22));
  color: var(--accent-strong) !important;
  font-weight: 700;
}

/* ── 4. Flash messages — auto-dismiss animation ───────────────── */
@keyframes flashDismiss {
  0%   { opacity: 1; transform: translateY(0) scaleY(1); max-height: 6rem; }
  80%  { opacity: 0; transform: translateY(-6px) scaleY(0.95); max-height: 6rem; }
  100% { opacity: 0; transform: translateY(-10px) scaleY(0.9); max-height: 0; margin: 0; padding: 0; }
}

.flash {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.flash-success {
  border-color: rgba(47, 127, 87, 0.22);
}

.flash-error {
  border-color: rgba(180, 71, 50, 0.22);
}

.flash-info {
  border-color: rgba(15, 124, 130, 0.22);
}

.flash::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.flash-success::before { background: var(--success); }
.flash-error::before   { background: var(--danger); }
.flash-info::before    { background: var(--accent); }

.flash-dismiss {
  margin-left: auto;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  flex-shrink: 0;
}

.flash-dismiss:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
}

.flash.is-dismissing {
  animation: flashDismiss 0.42s ease forwards;
  pointer-events: none;
}

/* ── 5. Toast notification system ────────────────────────────── */
.toast-region {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: grid;
  gap: 0.6rem;
  width: min(100%, 380px);
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 8rem; }
  to   { opacity: 0; transform: translateX(16px) scale(0.95); max-height: 0; margin: 0; }
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(8, 34, 41, 0.1);
  box-shadow: 0 18px 48px rgba(8, 34, 41, 0.16), 0 2px 8px rgba(8, 34, 41, 0.06);
  backdrop-filter: blur(18px);
  pointer-events: all;
  animation: toastIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

.toast.is-leaving {
  animation: toastOut 0.28s ease forwards;
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: rgba(47, 127, 87, 0.14); color: var(--success); }
.toast-error   .toast-icon { background: rgba(180, 71, 50, 0.14); color: var(--danger); }
.toast-info    .toast-icon { background: rgba(15, 124, 130, 0.14); color: var(--accent); }

.toast-body {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-message {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}

.toast-close {
  padding: 0.2rem 0.4rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  flex-shrink: 0;
  align-self: flex-start;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

/* ── 6. Premium member badge in header ───────────────────────── */
.nav-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 124, 130, 0.18), rgba(20, 151, 159, 0.28));
  border: 1px solid rgba(15, 124, 130, 0.22);
  color: var(--accent-strong);
  font-family: var(--data-font);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-premium-badge svg {
  width: 0.78rem;
  height: 0.78rem;
  flex-shrink: 0;
}

/* ── 7. Enhanced premium lock panel ──────────────────────────── */
.premium-lock-panel {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 2.5rem 2rem;
}

.premium-lock-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(15, 124, 130, 0.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(20, 151, 159, 0.06), transparent 50%);
  pointer-events: none;
}

.premium-lock-panel .eyebrow {
  position: relative;
}

.premium-lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15, 124, 130, 0.14), rgba(20, 151, 159, 0.22));
  border: 1px solid rgba(15, 124, 130, 0.18);
  margin-bottom: 1rem;
  color: var(--accent);
}

.premium-lock-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* ── 8. Empty state with icon ────────────────────────────────── */
.empty-state-rich {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(15, 124, 130, 0.08);
  color: var(--accent);
  opacity: 0.7;
}

.empty-state-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.empty-state-rich strong {
  color: var(--text);
  font-size: 1.05rem;
}

.empty-state-rich p {
  margin: 0;
  font-size: 0.92rem;
  max-width: 28ch;
}

/* ── 9. Account stats enhanced ───────────────────────────────── */
.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.account-stat-card {
  display: grid;
  gap: 0.3rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 124, 130, 0.1);
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.account-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(8, 34, 41, 0.08);
}

.account-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: rgba(15, 124, 130, 0.1);
  color: var(--accent);
  margin: 0 auto 0.25rem;
}

.account-stat-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.account-stat-card strong {
  font-size: 1.8rem;
  font-family: var(--data-font);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.account-stat-card span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ── 10. Enhanced focus states ───────────────────────────────── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(15, 124, 130, 0.4);
  outline-offset: 1px;
  border-color: rgba(15, 124, 130, 0.5);
  box-shadow: 0 0 0 4px rgba(15, 124, 130, 0.08);
  transition: outline 120ms ease, box-shadow 120ms ease;
}

button:focus-visible {
  outline: 2px solid rgba(15, 124, 130, 0.5);
  outline-offset: 3px;
}

/* ── 11. Form loading state ──────────────────────────────────── */
@keyframes btnSpinner {
  to { transform: rotate(360deg); }
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}

.btn-loading::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  animation: btnSpinner 0.7s linear infinite;
}

/* ── 12. Score chip pulse for excellent scores ───────────────── */
@keyframes chipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 127, 87, 0.25); }
  50%      { box-shadow: 0 0 0 6px rgba(47, 127, 87, 0); }
}

.score-chip.score-excelente.large {
  animation: chipPulse 2.5s ease-in-out infinite;
}

/* ── 13. Smooth hover lift on cards ──────────────────────────── */
.spot-tile,
.favorite-card,
.alert-card,
.crowd-session-card,
.explore-result-card {
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 180ms ease;
}

.spot-tile:hover,
.favorite-card:hover,
.alert-card:hover,
.explore-result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(8, 34, 41, 0.12);
  border-color: rgba(15, 124, 130, 0.18);
}

/* ── 14. Auth card entrance ──────────────────────────────────── */
.auth-card {
  animation: revealUp 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── 15. Section header with action (spacing) ─────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.section-header.compact {
  margin-bottom: 0.9rem;
}

/* ── 16. Skeleton loader ─────────────────────────────────────── */
@keyframes skeletonShimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

.skeleton {
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(8, 34, 41, 0.06) 25%,
    rgba(8, 34, 41, 0.03) 50%,
    rgba(8, 34, 41, 0.06) 75%
  );
  background-size: 400px 100%;
  animation: skeletonShimmer 1.4s ease infinite;
}

.skeleton-line {
  height: 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.skeleton-line.wide  { width: 80%; }
.skeleton-line.short { width: 45%; }
.skeleton-title      { height: 1.4rem; width: 65%; border-radius: 8px; margin-bottom: 0.75rem; }

/* ── 17. Improved pill with dot indicator ────────────────────── */
.pill-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pill-dot::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}

.pill.status-active   { background: rgba(47, 127, 87, 0.14);  color: var(--success); }
.pill.status-inactive { background: rgba(180, 71, 50, 0.12);  color: var(--danger); }
.pill.status-pending  { background: rgba(241, 178, 74, 0.18); color: #9c6500; }

/* ── 18. Alert history status dots ──────────────────────────── */
.alert-history-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
}

.alert-history-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-family: var(--data-font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.alert-history-status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-sent    { color: var(--success); }
.status-sent::before    { background: var(--success); }
.status-queued  { color: #9c6500; }
.status-queued::before  { background: #f1b24a; }
.status-failed  { color: var(--danger); }
.status-failed::before  { background: var(--danger); }

/* ── 19. Premium inline callout enhanced ────────────────────── */
.premium-inline-callout {
  display: grid;
  gap: 0.6rem;
  padding: 1.25rem;
  border-radius: 18px;
  background:
    radial-gradient(circle at 15% 25%, rgba(15, 124, 130, 0.1), transparent 45%),
    rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 124, 130, 0.14);
}

.premium-inline-callout h3 {
  font-size: 1.05rem;
  margin: 0;
}

.premium-inline-callout .eyebrow {
  margin: 0;
}

.premium-inline-callout .muted {
  margin: 0;
  font-size: 0.92rem;
}

.premium-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

/* ── 20. Crowd session card improved ─────────────────────────── */
.crowd-session-card {
  position: relative;
  gap: 0.75rem;
}

.crowd-participant-count {
  font-family: var(--data-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
}

/* ── 21. Danger zone refined ─────────────────────────────────── */
.account-danger-panel {
  border-color: rgba(180, 71, 50, 0.18) !important;
  background: rgba(255, 245, 243, 0.8) !important;
}

/* ── 22. Mobile header improvements ─────────────────────────── */
@media (max-width: 720px) {
  .site-nav a,
  .site-nav .ghost-button {
    min-height: 2.4rem;
    padding: 0.55rem 0.78rem;
    font-size: 0.87rem;
    flex-shrink: 0;
  }

  .page-shell {
    animation-duration: 0.26s;
  }

  .toast-region {
    bottom: 1rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

/* ── 23. Print — hide interactive chrome ─────────────────────── */
@media print {
  .site-header,
  .floating-back-button,
  .toast-region,
  .flash-dismiss {
    display: none !important;
  }
}
