/* Custom styles for Lings Padel Booking */

/* Variables */
:root {
  --primary: #14b8a6;
  --primary-dark: #0d9488;
  --bg-light: #f9fafb;
  --text-dark: #374151;
  --text-light: #6b7280;
  /* Background color for modals (a mint tint) so the dialog isn't stark white */
  --modal-bg: #f0fdf4;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
}

/* Navigation */
nav {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav .brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

/* Hide desktop navigation on small screens and show hamburger */
@media (max-width: 768px) {
  nav ul.desktop-links {
    display: none;
  }
  nav .hamburger {
    display: flex;
  }
  /* Mobile menu container should occupy full width on small screens */
  .mobile-menu {
    width: 100%;
  }
}
@media (min-width: 769px) {
  /* Hide hamburger and mobile menu on larger screens */
  nav .hamburger {
    display: none;
  }
  .mobile-menu {
    display: none !important;
  }
}
nav ul li a {
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 500;
}
nav ul li a:hover,
nav ul li a.active {
  color: var(--primary-dark);
}
/* Mobile menu */
/* Mobile menu container. By default it is visible on small screens but
   hidden via the .hidden utility class. We avoid setting display:none
   here so toggling the hidden class works properly. */
.mobile-menu {
  background: #ffffff;
  padding: 1rem;
}
/* Hide mobile menu when the hidden class is present */
.mobile-menu.hidden {
  display: none;
}
.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-menu ul li {
  border-bottom: 1px solid #e5e7eb;
}
.mobile-menu ul li a {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.9rem;
}
.mobile-menu ul li a.active {
  color: var(--primary);
}
/* Hamburger icon */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hamburger svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-dark);
}

/* Hero section */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  color: #ffffff;
  padding: 4rem 1rem;
}
.hero img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
}
.hero .content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }
}
.hero p {
  font-size: 1rem;
  margin-bottom: 2rem;
  color: #e5e7eb;
}
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s ease;
}
.btn:hover {
  background: var(--primary-dark);
}

/* Disabled button state for proceed actions */
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Grid utilities */
.grid {
  display: grid;
  gap: 2rem;
}
.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 767px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: #ffffff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------
   Modal styles for booking form
   The modal overlay covers the viewport with a translucent
   background and centers the modal dialog. The dialog uses
   a rounded card design consistent with the rest of the site.
*/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Use a mint-tinted background instead of pure white */
  background: var(--modal-bg);
  width: 90%;
  max-width: 500px;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  max-height: 90vh;
  overflow-y: auto;
  /* Smooth fade and slight slide animation when modal appears */
  animation: modalFade 0.3s ease;
}
.modal-content {
  position: relative;
  padding: 1.5rem;
}

/* Add spacing between date, time and add-on sections within booking modals
   Keep spacing compact but allow breathing room. In response to user feedback
   about excessive gaps, reduce the bottom margin slightly for these sections. */
.modal-date,
.modal-time,
.modal-addons {
  margin-bottom: 0.3rem;
}
.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-light);
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  cursor: pointer;
}
.modal-content h2 {
  margin-top: 0;
}

/* Input with icon wrapper */
.input-icon-wrapper {
  position: relative;
}
.input-icon-wrapper input[type="date"] {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  color: var(--text-dark);
  background: #ffffff;
}
.input-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

/* Schedule options in modal */
/* Use a responsive grid so schedule options are evenly spaced and wrap naturally */
.schedule-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  /* Increase gap between schedule cards for better breathing room */
  gap: 0.75rem;
  margin-top: 0.5rem;
}
/* Individual schedule option box */
.schedule-option {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-light);
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-dark);
  /* Animate border color and a subtle lift on hover */
  transition: border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.schedule-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.schedule-option input {
  margin-right: 0.25rem;
}
.schedule-option:hover {
  border-color: var(--primary);
}
/* Icon displayed inside schedule option */
.schedule-option .schedule-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

/* Add-on list in modal */
.modal-addons .addon-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.addon-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  background: var(--bg-light);
  font-size: 0.9rem;
}
.addon-item:hover {
  border-color: var(--primary);
}
.addon-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}
.addon-price {
  margin-left: auto;
  color: var(--text-light);
  font-size: 0.8rem;
}

/* Modal summary section
   Reduce the top margin so the summary sits closer to the add‑on list,
   addressing user feedback about unused space. */
.modal-summary {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  white-space: pre-line;
  color: var(--text-dark);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .modal {
    width: 95%;
    max-width: 95%;
  }
}

/* Calendar styles for date selection */
.calendar {
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
}
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 0.25rem;
}
.calendar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  /* Increase height for better touch targets */
  height: 40px;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
}
.calendar-cell.empty {
  border: none;
  cursor: default;
}
.calendar-cell.full {
  /* Use a light red shade to clearly indicate full-booked dates */
  background: #fee2e2;
  color: #b91c1c;
  cursor: not-allowed;
  position: relative;
}

/* Add a small cross icon to indicate fully booked days */
.calendar-cell.full::after {
  content: '✖';
  color: #b91c1c;
  font-size: 0.85rem;
  position: absolute;
  top: 2px;
  right: 4px;
}
.calendar-cell.available:hover {
  border-color: var(--primary);
  background: var(--bg-light);
}
.calendar-cell.selected {
  background: var(--primary);
  color: #ffffff;
}

/* Grid wrapper for calendar cells */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}
.card img {
  width: 100%;
  height: 10rem;
  object-fit: cover;
}
.card .card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card .card-body h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
}
.card .card-body p {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-light);
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}
.badge-success {
  background: #f0fdfa;
  color: #047857;
}
.badge-warning {
  background: #fefce8;
  color: #92400e;
}
.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}
table thead {
  background: var(--primary);
  color: #ffffff;
}
table th,
table td {
  padding: 0.75rem;
  text-align: left;
}
table tbody tr:nth-child(even) {
  background: #f3f4f6;
}
table tbody tr:hover {
  background: #e5e7eb;
}

/* Forms */
form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
form input,
form select,
form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  box-sizing: border-box;
}
form button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
form button:hover {
  background: var(--primary-dark);
}

/* Footer */
footer {
  background: var(--primary);
  color: #ffffff;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 3rem;
}
footer p {
  margin: 0;
  font-size: 0.875rem;
}

/* Section container utility */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

/* Utility: hide elements */
.hidden {
  display: none;
}

/* History page custom styling */
.history-section {
  margin-top: 2rem;
}
.history-section h2 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  color: var(--text-dark);
}
/* Card for each history entry */
.history-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.history-card:hover {
  border-color: var(--primary);
}
.history-card img.history-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* Medal icons used in league tables */
.medal-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.history-info {
  flex: 1;
}
.history-info h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-dark);
}
.history-info p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--text-light);
  white-space: pre-line;
}
.history-info small {
  color: var(--text-light);
  font-size: 0.75rem;
}

/*
 * Fade-in up animation for cards and history entries. This subtle animation
 * gives the interface a modern, polished feel when elements first appear on
 * the page. It uses a small vertical offset and fades from transparent to
 * opaque. To stagger animations naturally, delays can be applied inline via
 * the style attribute.
 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*
 * Player statistics styling.
 * Presents rank, wins and matches with small icons in a row below the player name.
 */
.player-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dark);
}
.player-stats img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Apply the fadeInUp animation to cards and history entries */
.card,
.history-card {
  animation: fadeInUp 0.6s ease both;
}

/* Modal for history details */
#historyModal .modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#historyModal .modal-content h2 {
  margin-bottom: 1rem;
}
#historyModal .modal-content p {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  white-space: pre-line;
}
#historyModal .modal-content img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  margin-bottom: 1rem;
}

/* Ensure event booking modal schedule options take full width for clarity */
#eventBookingModal .schedule-options {
  /* Display each schedule on its own row with extra vertical spacing */
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/*
 * QR code container styling.
 * Provides a subtle background and padding so the QR code stands out and
 * aligns with the overall color palette. It also constrains the size of the
 * QR image for consistency across pages (payment success and history).
 */
.qr-container {
  display: inline-block;
  padding: 1rem;
  border-radius: 0.5rem;
  background: #ecfeff; /* very light blue to frame the QR code */
  border: 1px solid #bae6fd; /* soft border */
}
.qr-container img {
  width: 220px;
  height: 220px;
  object-fit: contain;
}

/* Animation for modal fade-in */
@keyframes modalFade {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* --------------------------------------------------------------------
 * Tournament schedule modal styling
 * These classes format the decorative header image and the list of match
 * schedules within the tournament modal. Each match row includes a
 * scoreboard icon, player names with rank medal icons, and time/location
 * details. The design follows the card style of the rest of the site.
 */
.schedule-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

.match-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.match-row .match-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.match-row .match-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.match-row .players {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.match-row .players img {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
/* Remove right margin on generic spans. Player spacing now defined by specific classes */
.match-row .players span {
  margin-right: 0;
}

/* Styling for player entries and rank labels in the tournament schedule modal */
.player-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin-right: 0.25rem;
}
.player-rank {
  font-weight: normal;
  font-size: 0.7rem;
  color: var(--text-light);
  margin-left: 0.1rem;
}
.vs-label {
  font-weight: normal;
  color: var(--text-light);
  margin: 0 0.4rem;
}
.match-row .time-location {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* --------------------------------------------------------------------
 * Loader overlay styling
 * Shows a semi-transparent full-screen overlay with a spinning padel ball.
 * Used when the user triggers an action that takes a moment, like
 * proceeding to payment. The loader uses an existing ball icon
 * and rotates it continuously. A short message appears below the icon.
 */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.loader-overlay.hidden {
  display: none;
}
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.loader img {
  width: 60px;
  height: 60px;
  margin-bottom: 0.5rem;
  animation: spinBall 1s linear infinite;
}
.loader p {
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}
@keyframes spinBall {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}