/* =========================================================================
   FIFA — Comprehensive Responsive Enhancements
   Ensures all content displays properly on all screen sizes
   ========================================================================= */

/* ─────────────────────────────────────────────────────────────────────────
   1. GLOBAL RESPONSIVE ADJUSTMENTS
   ───────────────────────────────────────────────────────────────────────── */

html, body {
  width: 100%;
  overflow-x: hidden;
}

main {
  width: 100%;
  overflow-x: hidden;
}

/* Prevent overflow on block-level elements only */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
  display: block;
}

section, article, aside, nav, header, footer, div {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.container, .container-fluid, .container-xxl, .container-xl, .container-lg, .container-md, .container-sm {
  max-width: 100%;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 576px) {
  .container, .container-fluid, .container-xxl, .container-xl, .container-lg, .container-md, .container-sm {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

@media (min-width: 768px) {
  .container, .container-fluid, .container-xxl, .container-xl, .container-lg, .container-md, .container-sm {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 992px) {
  .container, .container-fluid, .container-xxl, .container-xl, .container-lg {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   2. NAVBAR RESPONSIVE FIXES
   ───────────────────────────────────────────────────────────────────────── */

.fifa-topbar {
  padding: 0.5rem 0;
  overflow-x: hidden;
}

.fifa-header-inner {
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  overflow-x: hidden;
}

@media (max-width: 576px) {
  .fifa-header-inner {
    padding: 0 0.75rem;
  }

  .fifa-topbar-left,
  .fifa-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .fifa-topbar-nav {
    gap: 0.5rem !important;
  }

  .fifa-topbar a,
  .fifa-topbar button {
    font-size: 0.75rem;
  }

  .fifa-wordmark {
    height: 18px !important;
  }
}

.fifa-main-nav {
  overflow-x: hidden;
}

.fifa-main-nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  overflow: hidden;
}

@media (max-width: 768px) {
  .fifa-main-nav-links {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
  }

  .fifa-nav-link {
    padding: 0.65rem 1rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem !important;
  }

  .fifa-nav-link i {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   3. HERO SECTION RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.lounge-hero {
  min-height: 350px;
  padding: 60px 1rem !important;
}

@media (max-width: 768px) {
  .lounge-hero {
    min-height: 300px;
    padding: 40px 1rem !important;
  }

  .lounge-hero h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    line-height: 1.2 !important;
  }

  .lounge-hero p {
    font-size: clamp(0.9rem, 3vw, 1.1rem) !important;
  }

  .hero-cta-btn {
    padding: 12px 32px !important;
    font-size: 0.95rem !important;
  }
}

@media (max-width: 480px) {
  .lounge-hero {
    min-height: 250px;
    padding: 30px 0.75rem !important;
  }

  .lounge-hero h1 {
    font-size: 1.3rem !important;
    margin-bottom: 1rem !important;
  }

  .lounge-hero p {
    font-size: 0.85rem !important;
    margin-bottom: 1.25rem !important;
  }

  .hero-cta-btn {
    padding: 10px 24px !important;
    font-size: 0.9rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   4. FORMS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.25rem;
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  width: 100%;
}

@media (max-width: 576px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    min-height: 44px;
  }

  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
  }

  .booking-btn {
    padding: 14px 16px !important;
    font-size: 1rem !important;
    min-height: 44px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   5. GRID LAYOUTS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.features-grid,
.gallery-container,
.matches-grid {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  overflow-x: hidden;
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .gallery-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .matches-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .matches-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .gallery-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .matches-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .feature-card,
  .gallery-item,
  .match-card {
    padding: 1.25rem 1rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   6. TICKET CARDS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .fifa-ticket-card {
    min-height: auto;
  }

  .fifa-ticket-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .fifa-ticket-actions button,
  .fifa-ticket-actions a {
    width: 100%;
    padding: 12px 16px !important;
    min-height: 44px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   7. TABLE RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .table-responsive table {
    min-width: 500px;
  }

  table td,
  table th {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.85rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   8. BUTTONS & LINKS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

button,
.btn,
a.btn,
.btn-fifa-primary,
.btn-fifa-outline {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 576px) {
  .btn-block,
  .btn-fifa-primary.btn-block,
  .btn-fifa-outline.btn-block {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  button,
  .btn,
  a.btn {
    font-size: 0.95rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   9. SECTIONS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

section {
  width: 100%;
  overflow-x: hidden;
  padding: 40px 0;
}

@media (max-width: 768px) {
  section {
    padding: 30px 0;
  }
}

@media (max-width: 480px) {
  section {
    padding: 20px 0;
  }
}

.section-title {
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   10. TEXT RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

p {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (max-width: 480px) {
  h1 {
    font-size: clamp(1.25rem, 5vw, 2rem) !important;
    line-height: 1.2 !important;
  }

  h2 {
    font-size: clamp(1.1rem, 4vw, 1.75rem) !important;
    line-height: 1.25 !important;
  }

  h3 {
    font-size: clamp(1rem, 3vw, 1.5rem) !important;
  }

  h4 {
    font-size: clamp(0.95rem, 2.5vw, 1.25rem) !important;
  }

  body {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   11. IMAGES & MEDIA RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

video,
iframe,
embed {
  max-width: 100%;
  height: auto;
}

/* ─────────────────────────────────────────────────────────────────────────
   12. CARD COMPONENTS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.card,
.feature-card,
.match-card,
.gallery-item {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.booking-card {
  width: 100%;
  padding: 2rem;
}

@media (max-width: 768px) {
  .booking-card {
    padding: 1.5rem 1rem !important;
    margin: 0 auto !important;
    max-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .booking-card {
    padding: 1.25rem 1rem !important;
    border-radius: 12px !important;
  }

  .feature-card,
  .match-card {
    padding: 1.25rem 1rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   13. SPACING RESPONSIVE UTILITIES
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 576px) {
  .mt-5, .my-5 {
    margin-top: 1.5rem !important;
  }

  .mb-5, .my-5 {
    margin-bottom: 1.5rem !important;
  }

  .p-4, .p-5 {
    padding: 1rem !important;
  }

  .px-4, .px-5 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .py-4, .py-5 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   14. FLEX RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.flex-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .flex-row {
    flex-direction: column;
  }

  .flex-container > * {
    flex-basis: 100% !important;
    min-width: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   15. FOOTER RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

footer {
  width: 100%;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

@media (max-width: 768px) {
  footer {
    padding: 1.5rem 0.75rem;
  }

  footer nav,
  footer .nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  footer a {
    display: block;
    padding: 0.5rem 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   16. MODAL & DROPDOWN RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.modal-content,
.dropdown-menu {
  max-width: 100%;
  width: 100%;
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem !important;
    max-width: calc(100% - 1rem) !important;
  }

  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }

  .dropdown-menu {
    max-width: 100%;
    left: 0 !important;
    right: 0 !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   17. ALERT & MESSAGE RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.alert {
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 480px) {
  .alert {
    padding: 0.75rem 0.875rem;
    font-size: 0.9rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   18. Z-INDEX & OVERFLOW FIXES
   ───────────────────────────────────────────────────────────────────────── */

body {
  overflow-x: hidden;
  width: 100vw;
  max-width: 100%;
}

html {
  overflow-x: hidden;
  width: 100%;
}

/* Prevent overflow on mobile */
@media (max-width: 576px) {
  * {
    max-width: 100%;
  }

  main,
  section,
  article,
  aside {
    overflow-x: hidden;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   19. DISPLAY RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .d-none-mobile {
    display: none !important;
  }

  .d-block-mobile {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .d-none-desktop {
    display: none !important;
  }

  .d-block-desktop {
    display: block !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   20. ANIMATION PERFORMANCE RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Disable animations on mobile for better performance */
@media (max-width: 576px) {
  .hover\:scale-110:hover {
    transform: none !important;
  }

  .transition-all {
    transition: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   21. ASPECT RATIO FIX
   ───────────────────────────────────────────────────────────────────────── */

.aspect-ratio-16-9 {
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
}

.aspect-ratio-4-3 {
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
}

.aspect-ratio-1-1 {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────
   22. OCCUPANCY BAR RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.occupancy-bar {
  width: 100%;
  height: 30px;
  border-radius: 10px;
  overflow: hidden;
}

.occupancy-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  width: 100%;
}

@media (max-width: 480px) {
  .occupancy-bar {
    height: 24px;
  }

  .occupancy-status {
    padding: 1.5rem 1rem !important;
  }

  .occupancy-info {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .occupancy-stat {
    flex: 1;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   23. PROMO CARDS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */


/* ─────────────────────────────────────────────────────────────────────────
   24. BADGE & PILL RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

.badge,
.pill,
[role="status"] {
  display: inline-flex;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  word-wrap: break-word;
}

/* ─────────────────────────────────────────────────────────────────────────
   25. ACCESSIBILITY & TOUCH TARGETS
   ───────────────────────────────────────────────────────────────────────── */

a,
button,
input[type="checkbox"],
input[type="radio"],
select {
  min-width: 44px;
  min-height: 44px;
}

@media (hover: hover) and (pointer: fine) {
  /* Desktop devices */
  a,
  button {
    min-width: auto;
    min-height: auto;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   26. MOBILE LAYOUT FIXES - TEXT & OVERFLOW
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  /* Fix aggressive min-widths on mobile */
  .fifa-ticket-actions form {
    min-width: auto !important;
    flex: 1 1 100%;
  }

  .fifa-ticket-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Ensure all text elements wrap properly */
  p, span, a, li, h1, h2, h3, h4, h5, h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Fix flex containers that might stack poorly */
  .row {
    flex-wrap: wrap;
  }

  /* Fix card layouts */
  .card {
    width: 100% !important;
  }

  /* Ensure buttons are full width on mobile */
  .btn {
    display: block;
    width: 100% !important;
    margin-bottom: 0.5rem;
  }

  .btn + .btn {
    margin-left: 0 !important;
  }

  /* Fix form group layout */
  .form-group {
    width: 100%;
    margin-bottom: 1rem;
  }

  /* Ensure inputs take full width */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix navigation items from wrapping text */
  .fifa-nav-link {
    min-width: auto !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
    white-space: normal !important;
  }

  /* Fix table overflow */
  table {
    font-size: 0.85rem;
    width: 100%;
    display: block;
    overflow-x: auto;
  }

  /* Fix grid items */
  .col, [class*="col-"] {
    width: 100%;
    min-width: unset;
  }

  /* Ensure content doesn't overflow */
  main, section, article, aside {
    width: 100%;
    overflow: hidden;
  }

  /* Fix long words and URLs */
  a[href], a[href]:link {
    word-break: break-all;
    overflow-wrap: break-word;
  }
}

@media (max-width: 360px) {
  /* Extra small phones - ultra aggressive fixes */
  .fifa-nav-link {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.7rem !important;
  }

  .btn {
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
  }

  h1 {
    font-size: clamp(1.2rem, 5vw, 2rem) !important;
  }

  h2 {
    font-size: clamp(1rem, 4vw, 1.5rem) !important;
  }

  p, span {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
  }
}
