/* ===========================
   TicketsFest Frontend Styles v6.0
   i18n-ready badges · Language switcher · Refined design
   =========================== */

/* ─── Tokens ─── */
:root {
  --tfe-bg: #f6f7fb;
  --tfe-text: #0f172a;
  --tfe-muted: #6b7280;
  --tfe-line: #dbeafe;
  --tfe-primary: #1d4ed8;
  --tfe-primary-hover: #1e40af;
  --tfe-accent-yellow: #ffcc00;
  --tfe-red: #d73149;
  --tfe-green: #10b981;
  --tfe-radius: 24px;
  --tfe-font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tfe-shadow: 0 10px 26px rgba(15,23,42,0.08);
  --tfe-shadow-strong: 0 26px 70px rgba(15,23,42,0.16);
}

/* ─── Base ─── */
.tfe-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  font-family: var(--tfe-font-main);
  box-sizing: border-box;
}
.tfe-wrap * { box-sizing: border-box; }


/* ════════════════════════════════════════════════
   1. Toolbar & Filters
   ════════════════════════════════════════════════ */

.tfe-toolbar-compact {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 0 0 26px 0;
  justify-content: center;
  align-items: center;
}

.tfe-select-chip {
  appearance: none; -webkit-appearance: none;
  background: #fff;
  border: 1px solid var(--tfe-line);
  border-radius: 999px;
  padding: 10px 38px 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  cursor: pointer;
  width: 200px;
  flex: 0 0 auto;
  box-shadow: 0 10px 24px rgba(15,23,42,0.06);
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%233b82f6%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px;
  transition: border-color .2s ease;
}
.tfe-select-chip:hover { border-color: var(--tfe-primary); }
.tfe-select-chip:disabled { opacity: 0.6; cursor: not-allowed; background-color: #f8fafc; }

.tfe-btn-reset {
  background: none;
  color: var(--tfe-muted);
  border: none;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
  flex-shrink: 0;
  font-weight: 700;
}

@media (max-width: 520px) {
  .tfe-toolbar-compact { flex-direction: column; align-items: stretch; }
  .tfe-select-chip { width: 100%; }
}


/* ════════════════════════════════════════════════
   2. Grid & Cards
   ════════════════════════════════════════════════ */

.tfe-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) { .tfe-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 1200px) { .tfe-grid { grid-template-columns: repeat(5, 1fr); gap: 24px; } }

/* Mobile horizontal scroll */
@media (max-width: 768px) {
  .tfe-grid {
    display: flex !important;
    flex-direction: row;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 24px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin-right: -20px; padding-right: 20px;
    grid-template-columns: none !important;
  }
  .tfe-grid .tfe-card-item {
    min-width: 260px; max-width: 260px;
    scroll-snap-align: center;
    flex-shrink: 0;
  }
}

/* Card */
.tfe-card-item {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--tfe-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
  transition: transform .25s ease, box-shadow .25s ease;
  transform: translateZ(0);
}
.tfe-card-item:hover {
  transform: translateY(-6px);
  box-shadow: var(--tfe-shadow-strong);
}
.tfe-card-link { position: absolute; inset: 0; z-index: 20; }
.tfe-card-inner { width: 100%; height: 100%; position: relative; }
.tfe-poster {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}


/* ════════════════════════════════════════════════
   3. Overlay & Content
   ════════════════════════════════════════════════ */

.tfe-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, #3b82f6 0%, var(--tfe-primary) 100%);
  padding: 18px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
  color: #fff;
  z-index: 5;
  pointer-events: none;
}
.tfe-card-item:hover .tfe-overlay,
.tfe-card-item.active .tfe-overlay {
  opacity: 1;
  visibility: visible;
}

.tfe-date-badge {
  background: #fff;
  color: var(--tfe-primary);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 10px 22px rgba(0,0,0,0.10);
  margin-bottom: auto;
}

.tfe-ov-center {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tfe-title {
  color: #fff;
  font-size: 16px;
  font-weight: 950;
  text-transform: uppercase;
  margin: 10px 0 8px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tfe-meta { font-size: 12px; opacity: .96; line-height: 1.35; }
.tfe-price { font-weight: 900; font-size: 14px; margin-top: 6px; }
.tfe-ov-bottom { margin-top: auto; z-index: 10; }

.tfe-btn-details {
  background: #fff;
  color: var(--tfe-primary) !important;
  text-align: center;
  padding: 11px 12px;
  border-radius: 16px;
  font-weight: 950;
  text-decoration: none;
  display: block;
  font-size: 13px;
  box-shadow: 0 14px 30px rgba(15,23,42,0.12);
  transition: transform .18s ease;
}


/* ════════════════════════════════════════════════
   4. Slider (Swiper)
   ════════════════════════════════════════════════ */

.tfe-slider-shell { width: 100%; position: relative; }

.tfe-slider-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: -6px 0 14px 0;
}

.tfe-slider-controls { display: flex; align-items: center; gap: 10px; }

.tfe-nav-btn {
  width: 46px; height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(191,219,254,0.95);
  background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(248,251,255,0.95) 100%);
  box-shadow: 0 14px 30px rgba(15,23,42,0.10);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  color: var(--tfe-primary);
}
.tfe-nav-btn:hover {
  transform: translateY(-3px);
  background: var(--tfe-primary);
  color: #fff;
  border-color: var(--tfe-primary);
}
.tfe-nav-btn svg { width: 18px; height: 18px; display: block; }
.tfe-nav-btn.swiper-button-disabled {
  opacity: .35 !important;
  pointer-events: none !important;
  filter: grayscale(1);
}
.tfe-swiper {
  width: 100%;
  overflow: visible !important;
  padding-bottom: 20px !important;
}


/* ════════════════════════════════════════════════
   5. Extras (Load More, Empty State)
   ════════════════════════════════════════════════ */

.tfe-load-more-wrap { text-align: center; margin-top: 34px; }

.tfe-btn-load-more {
  display: inline-block;
  background: var(--tfe-primary);
  color: #fff;
  border: none;
  padding: 12px 34px;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(15,23,42,0.12);
  transition: transform .15s ease;
}
.tfe-btn-load-more:hover { transform: translateY(-2px); }

.tfe-no-events {
  grid-column: 1/-1;
  text-align: center;
  padding: 40px 20px;
  color: var(--tfe-muted);
  font-size: 16px;
  background: #fff;
  border-radius: var(--tfe-radius);
  border: 1px dashed var(--tfe-line);
}


/* ════════════════════════════════════════════════
   6. i18n-Ready Badges (via data-attributes)
   ════════════════════════════════════════════════
   Badges now read text from data-badge-text attribute
   set in PHP via tfe_i18n(), making them translatable.

   PHP outputs:
     data-soldout="1" data-badge-text="РОЗПРОДАНО"
     data-onsale="1" data-badge-text="SALE"
   ════════════════════════════════════════════════ */

/* Sold Out badge */
.tfe-card-item[data-soldout="1"]::after {
  content: attr(data-badge-text);
  position: absolute; right: 12px; top: 12px;
  padding: 6px 10px; border-radius: 10px;
  background: var(--tfe-red);
  color: #fff; font-weight: 900; font-size: 11px;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
  z-index: 15;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Sale badge (only if NOT sold out) */
.tfe-card-item[data-onsale="1"]:not([data-soldout="1"])::after {
  content: attr(data-badge-text);
  position: absolute; right: 12px; top: 12px;
  padding: 6px 10px; border-radius: 10px;
  background: var(--tfe-green);
  color: #fff; font-weight: 900; font-size: 11px;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
  z-index: 15;
  pointer-events: none;
  text-transform: uppercase;
}

/* Fallback: if no data-badge-text, show nothing gracefully */
.tfe-card-item[data-soldout="1"]:not([data-badge-text])::after {
  content: "SOLD OUT";
}
.tfe-card-item[data-onsale="1"]:not([data-soldout="1"]):not([data-badge-text])::after {
  content: "SALE";
}

/* Price highlight for sale */
.tfe-card-item[data-onsale="1"] .tfe-price {
  color: var(--tfe-accent-yellow);
}


/* ════════════════════════════════════════════════
   7. Language Switcher (Frontend)
   ════════════════════════════════════════════════
   Usage in theme:
     <nav class="tfe-lang-switcher">
       <a href="/" class="tfe-lang-link active" data-lang="ua">🇺🇦 UA</a>
       <a href="/en/" class="tfe-lang-link" data-lang="en">🇬🇧 EN</a>
       <a href="/pl/" class="tfe-lang-link" data-lang="pl">🇵🇱 PL</a>
     </nav>
   ════════════════════════════════════════════════ */

.tfe-lang-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(219,234,254,0.7);
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}

.tfe-lang-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tfe-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tfe-lang-link:hover {
  color: var(--tfe-primary);
  background: rgba(29,78,216,0.06);
}
.tfe-lang-link.active {
  background: var(--tfe-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,78,216,0.25);
}

/* Compact variant (flags only) */
.tfe-lang-switcher.compact .tfe-lang-link {
  padding: 5px 8px;
  font-size: 14px;
  gap: 0;
}
.tfe-lang-switcher.compact .tfe-lang-code {
  display: none;
}

/* Dropdown variant for many languages */
.tfe-lang-dropdown {
  position: relative;
}
.tfe-lang-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(219,234,254,0.7);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tfe-text);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
  transition: border-color 0.2s;
}
.tfe-lang-dropdown-trigger:hover {
  border-color: var(--tfe-primary);
}
.tfe-lang-dropdown-trigger::after {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.5;
}
.tfe-lang-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--tfe-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
  padding: 6px;
  z-index: 100;
}
.tfe-lang-dropdown.open .tfe-lang-dropdown-menu {
  display: block;
  animation: tfe-fade-down 0.2s ease;
}
@keyframes tfe-fade-down {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tfe-lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tfe-text);
  text-decoration: none;
  transition: background 0.15s;
}
.tfe-lang-dropdown-item:hover {
  background: #f1f5f9;
}
.tfe-lang-dropdown-item.active {
  background: var(--tfe-primary);
  color: #fff;
}
.tfe-lang-dropdown-item .tfe-lang-flag {
  font-size: 16px;
}


/* ════════════════════════════════════════════════
   8. RTL Support (future-proof)
   ════════════════════════════════════════════════ */

[dir="rtl"] .tfe-toolbar-compact { direction: rtl; }
[dir="rtl"] .tfe-select-chip {
  padding: 10px 18px 10px 38px;
  background-position: left 14px center;
}
[dir="rtl"] .tfe-card-item[data-soldout="1"]::after,
[dir="rtl"] .tfe-card-item[data-onsale="1"]::after {
  right: auto; left: 12px;
}
[dir="rtl"] .tfe-date-badge { direction: ltr; }