/* ============================================
   PFL App — Components
   Buttons, cards, tables, pills, tags
   ============================================ */

/* ---- Primary Button ---- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, #1E8FE1 0%, #0F6FC0 100%);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: filter var(--transition-fast), transform 0.05s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(15, 111, 192, 0.35);
}

.btn:hover {
  filter: brightness(0.93);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button loading state */
.btn.is-loading {
  position: relative;
  pointer-events: none;
}

.btn.is-loading .btn-label {
  opacity: 0;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ---- Link Button ---- */
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  background: var(--brand-bg);
  color: var(--brand);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: filter var(--transition-fast);
}

.link-btn:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

/* ---- Card ---- */
.card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  overflow: hidden;
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
}

:root[data-theme="dark"] .card {
  background: var(--card);
}

.card-title {
  margin: 0;
  font-size: var(--card-title-font-size);
  font-weight: 600;
  line-height: 1.3;
}

.card-subtitle {
  margin: var(--spacing-xs) 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---- Card Cover Image ---- */
.card-cover {
  position: relative;
  margin: calc(var(--spacing-sm) * -1) calc(var(--spacing-md) * -1) var(--spacing-sm);
  height: 100px;
  overflow: hidden;
}

/* Blurred background — same image stretched & blurred */
.card-cover__blur {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(24px) saturate(1.4);
  transform: scale(1.2);
  z-index: 0;
}

.card-cover__img {
  display: block;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Wide screens — taller cover, image centered with blurred sides */
@media (min-width: 600px) {
  .card-cover {
    height: 160px;
  }

  .card-cover__img {
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
  }
}

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--spacing-md) * -1);
  width: calc(100% + var(--spacing-md) * 2);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  font-family: var(--font-table);
}

th, td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

td {
  font-size: var(--table-font-size);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="dark"] td {
  border-bottom: 1px solid var(--border);
}

/* Zebra striping */
tbody tr:nth-child(even) {
  background: #F4F5F9;
}

:root[data-theme="dark"] tbody tr:nth-child(even) {
  background: #273038;
}

tr:last-child td {
  border-bottom: 0;
}

/* Row highlight on tap */
tbody tr.row-highlight td {
  background: rgba(18, 122, 201, 0.10);
}

:root[data-theme="dark"] tbody tr.row-highlight td {
  background: rgba(78, 163, 255, 0.14);
}

/* ---- Table Header (collapsible) ---- */
.table-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-xs) 0;
  cursor: pointer;
  user-select: none;
}

.table-header__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-sm);
  flex: 1;
  min-width: 0;
}

.table-header__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: var(--spacing-sm);
}

/* ---- Share Button ---- */
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand-bg);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.share-btn:active {
  transform: scale(0.90);
  background: rgba(18, 122, 201, 0.18);
}

.share-btn svg {
  width: 18px;
  height: 18px;
}

.table-collapsed {
  display: none;
}

/* Table content spacing */
.table-content {
  margin-top: 12px;
}

.table-content .loading-text {
  padding: 6px 0;
}

.table-content .table-wrap {
  margin-top: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="dark"] .table-content .table-wrap {
  border-color: var(--border);
}

/* ---- Chevron ---- */
.chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--muted);
  transition: transform var(--transition-normal), background var(--transition-fast);
  transform: rotate(0deg);
}

.chevron-icon {
  width: 18px;
  height: 18px;
}

.chevron.open {
  transform: rotate(180deg);
}

.chevron:active {
  background: var(--brand-bg);
  transform: scale(0.92);
}

.chevron.open:active {
  transform: scale(0.92) rotate(180deg);
}

/* ---- Segmented Control ---- */
.segmented-control {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin: var(--spacing-md) 0 var(--spacing-lg);
  border-radius: var(--radius-full);
  background: var(--brand-bg);
  font-family: var(--font-ui);
}

.segment {
  flex: 1;
  appearance: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.segment.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

:root[data-theme="dark"] .segment.active {
  background: var(--card);
  color: var(--text);
  box-shadow: none;
}

.segment.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- Pills & Tags ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 15px;
}

.score-tag {
  display: inline-block;
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.score-tag--personal {
  background: rgba(0, 170, 255, 0.15);
  color: #127AC9;
}

.score-tag--team {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

.score-tag--combo {
  background: rgba(243, 141, 23, 0.16);
  color: #F09D1F;
}

/* ---- Year Tags ---- */
.fests-year-tags {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  margin-left: -18px;
  margin-right: -18px;
  padding-left: 18px;
  padding-right: 18px;
  padding-bottom: var(--spacing-sm);
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fests-year-tags::-webkit-scrollbar {
  display: none;
}

.fests-year-tag {
  appearance: none;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.70);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.80),
    0 2px 8px rgba(0, 99, 178, 0.06);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.fests-year-tag:hover {
  background: rgba(18, 122, 201, 0.12);
}

.fests-year-tag:active {
  background: rgba(18, 122, 201, 0.18);
  transform: translateY(1px);
}

.fests-year-tag.active {
  background: rgba(217, 242, 255, 0.85);
  color: var(--text);
  border-color: rgba(35, 139, 218, 0.28);
  box-shadow: 0 2px 8px rgba(0, 99, 178, 0.06);
}

/* Dark theme year tags */
:root[data-theme="dark"] .fests-year-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .fests-year-tag:not(.active):hover {
  background: rgba(78, 163, 255, 0.12);
}

:root[data-theme="dark"] .fests-year-tag.active {
  background: rgba(78, 163, 255, 0.22);
  color: var(--text);
  border-color: rgba(78, 163, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ============================================
   Year Row (year tags + quick-link round buttons)
   ============================================ */
.fests-year-row {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  margin-top: 4px;
  margin-bottom: var(--spacing-md);
}

.fests-year-row .fests-year-tags {
  flex: 1 1 auto;
  margin-bottom: 0;
  margin-right: 0;
  padding-right: var(--spacing-sm);
}

.fests-quick-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.quick-link-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform var(--transition-fast);

  /* Glass light — matches theme toggle */
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.80),
    0 8px 16px rgba(0, 99, 178, 0.06);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
}

.quick-link-btn:hover {
  text-decoration: none;
}

.quick-link-btn:active {
  transform: scale(0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.60),
    0 4px 8px rgba(0, 99, 178, 0.06);
}

.quick-link-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

:root[data-theme="dark"] .quick-link-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ---- Header Layout ---- */
.fests-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-lg);
  margin-bottom: 0;
}

.fests-header__text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.fests-header__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

/* ============================================
   Contact Cards (PFL TG + Instagram)
   ============================================ */
.contact-cards {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.contact-card {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 0;
}

.contact-card:hover {
  text-decoration: none;
}

.contact-card:active {
  transform: scale(0.97);
}

.contact-card__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}

.contact-card__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.contact-card__label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.contact-card__sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-updated-wrap {
  position: relative;
  display: inline-flex;
}

.last-updated {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
  line-height: 16px;
  margin-top: 6px;
}

/* ---- Theme Toggle ---- */
.btn.btn-theme {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  
  /* Glass light */
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.80),
    0 8px 16px rgba(0, 99, 178, 0.06);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
}

.btn.btn-theme:hover {
  filter: none;
}

.btn.btn-theme:active {
  transform: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.60),
    0 4px 8px rgba(0, 99, 178, 0.06);
}

:root[data-theme="dark"] .btn.btn-theme {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ---- Register / Action Buttons (2026 fest cards) ---- */
.card-btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.register-btn {
  flex: 1 1 400px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.register-btn--mono {
  background: #000000;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---- Donation Info ---- */
.donation-info {
  margin-top: 32px;
  margin-bottom: 32px;
  font-size: 16px;
  color: var(--muted);
  text-align: center;
}

/* ---- Table Content ---- */
.table-content {
  margin-top: 12px;
}

.table-content .loading-text {
  padding: 12px 0;
}

.table-content .table-wrap {
  margin-top: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="dark"] .table-content .table-wrap {
  border-color: var(--border);
}

/* ============================================
   About Section
   ============================================ */
.about-card {
  padding: var(--spacing-md);
}

.about-section-title {
  margin: 0 0 var(--spacing-sm);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.about-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.about-link {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.about-link:hover {
  text-decoration: none;
}

.about-link:active {
  transform: scale(0.95);
}

/* ---- About Author ---- */
.about-author {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  position: relative;
}

.about-author__badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.about-author__photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.about-author__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.about-author__role {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.about-author__name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.about-author__sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---- About Socials ---- */
.about-socials {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

.about-social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--brand-bg);
  transition: transform var(--transition-fast);
}

.about-social:active {
  transform: scale(0.90);
}

.about-social img {
  width: 24px;
  height: 24px;
  display: block;
}
