/* Reusable UI pieces: buttons, inputs, cards, nav, footer, toast, modal. */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--color-teal);
  color: var(--color-teal-text);
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-hover);
}

.btn-gold {
  background: var(--color-gold);
  color: #1a1300;
  border-radius: var(--radius-lg);
}

.btn-gold:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: #ffffff;
  color: #17171a;
  border-radius: var(--radius-lg);
}

.btn-secondary:hover {
  opacity: 0.9;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 8px 20px;
  font-size: 14px;
}

/* --- Forms --- */
.field {
  margin-bottom: var(--space-4);
  text-align: left;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--color-input-bg);
  font-size: 18px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-input-text);
  transition: box-shadow 0.15s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-input-text);
  opacity: 0.85;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(50, 193, 206, 0.5);
}

.field .hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.field .error-text {
  font-size: 13px;
  color: var(--color-danger);
  margin-top: var(--space-1);
  display: none;
}

.field.has-error input {
  box-shadow: 0 0 0 2px var(--color-danger);
}

.field.has-error .error-text {
  display: block;
}

/* --- Auth card layout --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  position: relative;
}

.auth-card {
  background: var(--color-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-7) var(--space-6);
  width: 100%;
  max-width: 620px;
  position: relative;
}

.auth-card h1 {
  text-align: center;
  font-size: 42px;
  color: var(--color-text);
  text-shadow: var(--shadow-text);
}

.auth-card .subtext {
  text-align: center;
  margin-bottom: var(--space-6);
  color: var(--color-text);
  font-size: 15px;
}

.auth-card .subtext a {
  color: var(--color-cyan);
  font-weight: 700;
}

.auth-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  font-size: 26px;
  font-weight: 300;
  color: var(--color-text);
  line-height: 1;
}

.auth-back {
  position: absolute;
  top: var(--space-5);
  left: var(--space-5);
  font-size: 22px;
  color: var(--color-text);
  line-height: 1;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-top: -var(--space-2);
  margin-bottom: var(--space-5);
  color: var(--color-text);
}

.auth-links a {
  color: var(--color-cyan);
  font-weight: 700;
}

.auth-card .form-hint {
  font-size: 13px;
  color: var(--color-text);
  margin-top: -4px;
  margin-bottom: var(--space-3);
}

.auth-card .btn-primary {
  display: block;
  margin: var(--space-5) auto 0;
}

.code-input {
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 28px !important;
  font-variant-numeric: tabular-nums;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-cyan);
  font-weight: 700;
  font-family: var(--font-display);
  font-size: inherit;
  cursor: pointer;
}

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

/* --- Header / Nav --- */
.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  transition: padding 0.2s ease;
}

.site-header.is-scrolled {
  box-shadow: inset 0 4px 0 var(--color-accent-blue);
}

.site-header.is-scrolled .header-inner {
  padding-top: 6px;
  padding-bottom: 6px;
}

.site-header.is-scrolled .brand-logo {
  width: 40px;
  height: 40px;
}

.site-header .header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 18px;
  color: var(--color-text);
  flex-shrink: 0;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-wordmark {
  display: none;
}

@media (min-width: 900px) {
  .brand-wordmark { display: inline; }
}

.search-bar {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #ececec;
  border-radius: var(--radius-pill);
  padding: 12px 22px;
}

.search-bar svg {
  flex-shrink: 0;
  color: #55565f;
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  font-family: var(--font-display);
  width: 100%;
  color: #1a1a1a;
}

.search-bar input::placeholder {
  color: #6b6b6b;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1a1300;
  border: none;
  font-family: var(--font-display);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.icon-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: rgba(15, 20, 45, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  min-width: 210px;
  padding: var(--space-2);
  display: none;
  flex-direction: column;
}

.menu-dropdown-panel.open {
  display: flex;
}

.menu-dropdown-panel a,
.menu-dropdown-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-size: 15px;
  font-family: var(--font-display);
  color: var(--color-text);
}

.menu-dropdown-panel a:hover,
.menu-dropdown-panel button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* --- Event card --- */
.event-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: block;
  aspect-ratio: 383 / 413;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.event-card .cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26, 31, 61, 0.95), rgba(201, 162, 39, 0.85));
}

.cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(26, 31, 61, 0.95), rgba(201, 162, 39, 0.85));
}

.event-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-card .badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  background: var(--color-gold);
  color: #1a1300;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  z-index: 2;
}

.event-card .overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.event-card .body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 18px 16px;
  text-align: center;
  color: #fff;
}

.event-card h3 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--color-gold-bright);
  font-family: var(--font-display);
  font-weight: 700;
}

.event-card .meta {
  font-size: 13px;
  margin: 0;
  color: #fff;
  line-height: 1.35;
}

.event-card .meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.event-card .meta-row span:first-child {
  flex: 0 1 auto;
  white-space: nowrap;
}

.event-card .meta-row span:last-child {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card .fee {
  font-weight: 700;
  color: var(--color-gold-bright);
}

.event-card .fee.free {
  color: #6fe0a3;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

/* --- Registration list item (My Registrations page) --- */
.registration-item {
  background: var(--color-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.registration-item .cover {
  height: 160px;
  position: relative;
  background: linear-gradient(135deg, rgba(26, 31, 61, 0.95), rgba(201, 162, 39, 0.85));
}

.registration-item .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.registration-item .body {
  padding: var(--space-4);
}

.registration-item h3 {
  font-size: 18px;
  color: var(--color-text);
  margin-bottom: 6px;
}

.registration-item .meta {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.registration-item .footer-row {
  margin-top: var(--space-3);
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

/* --- Filter panel (Event Listings page) --- */
.listings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-6);
  align-items: flex-start;
}

.filter-panel {
  background: var(--color-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 96px;
}

.filter-panel h3 {
  font-size: 18px;
  margin-bottom: var(--space-4);
}

.filter-group {
  margin-bottom: var(--space-5);
}

.filter-group h4 {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-family: var(--font-sans);
  font-weight: 700;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-chip-bg);
  color: #1a1a1a;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 var(--space-2) var(--space-2) 0;
  border: 1.5px solid transparent;
  cursor: pointer;
}

.filter-tag.active {
  background: var(--color-gold);
  border-color: var(--color-gold-soft);
  color: #1a1300;
  font-weight: 700;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  font-size: 14px;
  font-weight: 600;
  min-width: 260px;
  animation: toast-in 0.2s ease;
  backdrop-filter: blur(12px);
}

.toast-action {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toast-success {
  background: rgba(20, 30, 25, 0.9);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.toast-error {
  background: rgba(35, 15, 15, 0.9);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Footer --- */
.site-footer {
  background: var(--color-footer-overlay);
  margin-top: var(--space-8);
  padding: var(--space-7) 0 var(--space-5);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(48px, 8vw, 96px);
  row-gap: var(--space-6);
  align-items: start;
  justify-content: space-between;
}

.footer-contact p {
  color: #fff;
  margin: 0 0 var(--space-3);
  font-size: 15px;
}

.footer-contact-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 15px;
}

.footer-contact-line img {
  width: 24px;
  height: 24px;
}

.footer-social {
  text-align: center;
}

.footer-social p {
  color: #fff;
  margin-bottom: var(--space-3);
}

.footer-socials {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
}

.footer-socials a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #fff;
}

.footer-socials img {
  width: 40px;
  height: 40px;
}

.mailing-card {
  background: var(--color-card-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-4) var(--space-5);
  color: #111;
  text-align: center;
  justify-self: end;
  width: 100%;
  max-width: 340px;
}

.mailing-card h4 {
  font-size: 18px;
  margin-bottom: 2px;
  color: #111;
}

.mailing-card p {
  font-size: 13px;
  color: #333;
  margin-bottom: 4px;
}

.mailing-card a {
  color: #085066;
  font-weight: 700;
}

.mailing-form {
  display: flex;
  margin-top: var(--space-3);
}

.mailing-form input {
  flex: 1;
  border-radius: var(--radius-pill);
  border: none;
  padding: 14px 20px;
  background: var(--color-gold-soft);
  color: #fff;
  font-family: var(--font-display);
}

.mailing-form input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.mailing-form button {
  display: none;
}

.footer-bottom {
  text-align: center;
  margin-top: var(--space-6);
  font-size: 12px;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .listings-layout {
    grid-template-columns: 1fr;
  }
  .filter-panel {
    position: static;
  }
  .footer-grid {
    column-gap: var(--space-5);
  }
  .mailing-card {
    justify-self: center;
    max-width: none;
  }
  .footer-contact-line {
    justify-content: center;
  }
  .search-bar {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .search-bar {
    display: none;
  }
}

.header-actions { margin-left: auto; }
.header-account {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
}
.header-avatar { width: 32px; height: 32px; font-size: 12px; }
.menu-label {
  margin: 8px 14px 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-dim);
}
.footer-col { text-align: center; }
.footer-col h4 { margin-bottom: 8px; }
.footer-socials { justify-content: center; }
.mailing-form { justify-content: center; gap: 8px; }
.mailing-form button { display: inline-flex; }
.mailing-status { min-height: 1.2em; font-size: 13px; }

.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #333;
  cursor: pointer;
  display: flex;
}

.bookmark-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bookmark-btn img { width: 18px; height: 18px; }
.bookmark-btn.is-saved { background: #fff; color: #d0122d; }
.bookmark-btn.is-saved img { filter: invert(16%) sepia(90%) saturate(5000%) hue-rotate(340deg); }
.event-card .register-out { margin: 0 12px 12px; align-self: center; }
.event-card { display: flex; flex-direction: column; aspect-ratio: auto; background: rgba(255,255,255,0.06); }
.event-card .cover { position: relative; inset: auto; height: 150px; }
.event-card .body { position: static; text-align: left; }
.event-card .tag-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.event-card .tag {
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}
.badge-ended { background: #8d8d8d !important; color: #fff !important; }
.event-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.event-row .event-card { min-width: 260px; max-width: 280px; flex: 0 0 auto; }
.section-note { color: var(--color-text-muted); margin: 0 0 12px; }
.coming-soon-card {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
}
.profile-tabs button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 8px 14px;
}
.profile-tabs button.active { color: var(--color-cyan); }
