/* ==========================================================================
   Sports Taekwondo Federation (STF) — Master Stylesheet
   ========================================================================== */

:root {
  --primary-navy: #143E6D;
  --primary-darknavy: #143E6D;
  --primary-deepblue: #143E6D;
  --primary-gold: #E5A93B;
  --primary-goldhover: #D49629;
  --primary-lightgold: #FFF8EC;
  --accent-red: #D92525;
  --neutral-dark: #0A1118;
  --neutral-gray: #64748B;
  --neutral-light: #F8FAFC;
  --font-serif: Georgia, 'Times New Roman', Cambria, serif;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  box-sizing: border-box;
  overflow-x: clip;
  max-width: 100%;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* Security & Protection: Text selection and drag prevention */
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-sans);
  background-color: #FFFFFF;
  color: #1E293B;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main Navigation Header: Sticky on scroll */
header.sticky,
header#main-nav-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Desktop Adjustments (Desktop >= 1024px) */
@media (min-width: 1024px) {
  #mobile-sidebar, #mobile-menu-backdrop {
    display: none !important;
  }
}

.font-serif-title {
  font-family: 'Times New Roman', Times, Georgia, serif;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Join & Register Cards (Exact Same-to-Same Reference Engine)
   ========================================================================== */
.join-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
@media (min-width: 1024px) {
  .join-cards {
    padding: 0 10px;
    gap: 24px;
  }
}
@media (min-width: 1200px) {
  .join-cards {
    gap: 28px;
  }
}

.join-cards h3 {
  color: #ffca31;
  font-size: 16px;
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  text-transform: capitalize;
}
@media (min-width: 768px) {
  .join-cards h3 {
    font-size: 18px;
  }
}
@media (min-width: 1024px) {
  .join-cards h3 {
    font-size: 22px;
  }
}

.card {
  position: relative;
  border: 1px solid #ffca31;
  border-radius: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  width: 280px;
  padding: 24px 20px;
  text-decoration: none;
  background-color: transparent;
  box-sizing: border-box;
}
@media (min-width: 768px) {
  .card {
    width: 320px;
    padding: 30px 24px;
  }
}
@media (min-width: 1024px) {
  .card {
    width: 310px;
    padding: 34px 22px;
  }
}
@media (min-width: 1200px) {
  .card {
    width: 326px;
    padding: 36px 24px;
  }
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0px 12px 20px -6px rgba(0, 0, 0, 0.45);
}
@media (min-width: 1024px) {
  .card:hover {
    transform: translateY(-6px);
  }
}

.card::before {
  content: "";
  position: absolute;
  background-color: #ffca31;
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
  top: -5px;
  width: calc(100% - 18px);
  height: 5px;
}
@media (min-width: 768px) {
  .card::before {
    width: calc(100% - 28px);
  }
}
@media (min-width: 1024px) {
  .card::before {
    top: -8px;
    height: 8px;
  }
}

.card-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 768px) {
  .card-icon {
    width: 80px;
    height: 80px;
  }
}
@media (min-width: 1024px) {
  .card-icon {
    width: 90px;
    height: 90px;
    padding-bottom: 5px;
  }
}
.card-icon img,
.card-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card h3 {
  color: #ffca31;
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.02em;
}
@media (min-width: 768px) {
  .card h3 {
    font-size: 22px;
  }
}
@media (min-width: 1024px) {
  .card h3 {
    font-size: 24px;
  }
}

.card p {
  margin: 0;
  color: #d1d1d1;
  font-size: 12px;
  width: 100%;
  max-width: 260px;
  min-height: 50px;
  line-height: 1.6;
}
@media (min-width: 768px) {
  .card p {
    font-size: 13px;
    min-height: 65px;
  }
}
@media (min-width: 1024px) {
  .card p {
    font-size: 14px;
    min-height: 70px;
  }
}

.btn-join {
  background: none;
  color: #ffffff;
  border: 1px solid #ffffff;
  padding: 8px 20px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  width: 100%;
  max-width: 240px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-block;
  text-align: center;
}
@media (min-width: 768px) {
  .btn-join {
    max-width: 260px;
    font-size: 14px;
    padding: 10px 22px;
  }
}
@media (min-width: 1024px) {
  .btn-join {
    max-width: 280px;
    font-size: 15px;
    padding: 11px 24px;
  }
}
.btn-join:hover,
.card:hover .btn-join {
  background: #ffffff;
  color: #143E6D;
  border-color: #ffffff;
}

/* Mobile Right Off-Canvas Sidebar Drawer */
#mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  width: 320px;
  max-width: 85vw;
  box-sizing: border-box;
  background-color: #FFFFFF;
  color: #1E293B;
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid #E2E8F0;
  overflow-y: auto;
}
#mobile-sidebar.open {
  transform: translateX(0) !important;
}
#mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#mobile-menu-backdrop.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.protected-text {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

img, svg {
  -webkit-user-drag: none;
  user-select: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0A192F;
}
::-webkit-scrollbar-thumb {
  background: #E5A93B;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #D49629;
}

/* Typography Enhancements */
.font-display {
  font-family: 'Times New Roman', Times, Georgia, serif;
  letter-spacing: 0.03em;
}

/* Hero Carousel */
.hero-slider-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: #143E6D;
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
  z-index: 1;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.hero-slide-bg {
  transform: scale(1.05);
  transition: transform 7s ease-out;
}

.hero-slide.active .hero-slide-bg {
  transform: scale(1);
}

/* Gold Gradient Text */
.gold-gradient-text {
  background: linear-gradient(135deg, #FFF3D6 0%, #E5A93B 50%, #C98A19 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Athletic Button Glow */
.btn-gold {
  background: linear-gradient(135deg, #E5A93B 0%, #D49629 100%);
  color: #143E6D;
  font-weight: 800;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(229, 169, 59, 0.35);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(229, 169, 59, 0.5);
  background: linear-gradient(135deg, #F0B74E 0%, #E5A93B 100%);
}

.btn-outline-gold {
  border: 1.5px solid #E5A93B;
  color: #E5A93B;
  transition: all 0.3s ease;
}

.btn-outline-gold:hover {
  background-color: #E5A93B;
  color: #143E6D;
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(229, 169, 59, 0.3);
}

/* Modal Animations */
.modal-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.modal-overlay.open {
  opacity: 1 !important;
  visibility: visible !important;
}

#modal-site-popup {
  z-index: 9999 !important;
}

#modal-site-popup.open {
  opacity: 1 !important;
  visibility: visible !important;
}

#modal-payment-qr {
  z-index: 9999 !important;
}

#modal-payment-qr.open,
#modal-payment-qr:not(.hidden) {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
}

.modal-container {
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-container {
  transform: scale(1) translateY(0);
}

/* Image Upload Preview Box */
.image-dropzone {
  border: 2px dashed #CBD5E1;
  transition: all 0.2s ease;
  background-color: #F8FAFC;
}

.image-dropzone:hover, .image-dropzone.dragover {
  border-color: #143E6D;
  background-color: #EFF6FF;
}

/* Card Hover Lift */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(0, 34, 93, 0.15);
}

/* Pulse animation for live event badge */
@keyframes goldPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(229, 169, 59, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(229, 169, 59, 0);
  }
}

.pulse-badge {
  animation: goldPulse 2s infinite;
}

/* Mobile Usability & Responsiveness Fixes */
@media (max-width: 640px) {
  /* Prevent iOS Safari auto-zoom on input focus */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .modal-container {
    max-height: 94vh;
    margin: 0.5rem;
  }
}

/* Safe area insets for notched phones */
body {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hard CSS Rules for Admin Auth Gate & Zero Overflow */
#admin-app-container.hidden {
  display: none !important;
}

#admin-login-screen.hidden {
  display: none !important;
}

.toast {
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Admin Control Center & Modals UI/UX Design System
   ========================================================================== */
.admin-input,
.admin-select,
.admin-textarea {
  display: block;
  width: 100%;
  background-color: #F8FAFC;
  border: 2px solid #CBD5E1 !important;
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0F172A;
  transition: all 0.15s ease-in-out;
  outline: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

.admin-input:hover,
.admin-select:hover,
.admin-textarea:hover {
  border-color: #94A3B8 !important;
  background-color: #FFFFFF;
}

.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
  border-color: #143E6D !important;
  background-color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(0, 34, 93, 0.14) !important;
}

.admin-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #334155;
  margin-bottom: 0.375rem;
}

.safe-area-bottom {
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
}


/* ==========================================================================
   Staggered (Masonry) Gallery Grid
   ========================================================================== */
.gallery-staggered-grid {
  column-count: 2;
  column-gap: 0.75rem;
}

@media (min-width: 640px) {
  .gallery-staggered-grid {
    column-count: 2;
    column-gap: 1rem;
  }
}

@media (min-width: 768px) {
  .gallery-staggered-grid {
    column-count: 3;
    column-gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .gallery-staggered-grid {
    column-count: 4;
    column-gap: 1.25rem;
  }
}

.gallery-staggered-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  display: block;
}

@media (min-width: 640px) {
  .gallery-staggered-item {
    margin-bottom: 1.25rem;
  }
}
