/* General Styles */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
  color: #333;
  background-image: url('/images/poster.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgba(0, 0, 0, 0.5); /* Add semi-transparent background to body */
}

header {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: white;
  text-align: center;
  padding: 10px 0; /* Slightly increased padding */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Initial shadow */
  transition: box-shadow 0.3s ease, transform 0.3s ease; /* Smooth transitions */
  position: sticky; /* Make the header sticky */
    top: 0;
    z-index: 100;
}

header.scrolled {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Enhanced shadow on scroll */
  transform: translateY(-2px);
}

header h1 {
  margin: 0;
  font-size: 2rem; /* Larger font size */
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

header:hover h1 {
    transform: scale(1.05);
}

.logo {
    transition: transform 0.3s ease;
}

header:hover .logo {
    transform: scale(1.1); /* Slightly scale up logo on hover */
}

main {
  text-align: center;
  padding: 20px;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.logo {
  width: 100px;
  margin: 5px auto;
  display: block;
}

/* Playground Buttons */
.playground-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.playground-button {
  padding: 15px 20px;
  font-size: 18px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  width: 80%;
  max-width: 400px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
  position: relative;
  overflow: hidden;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.playground-button:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

.playground-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

/* Add a subtle gradient overlay */
.playground-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  transition: opacity 0.3s ease;
}

.playground-button:hover::before {
  opacity: 0.8;
}

/* Playgrounds List Section */
.playgrounds-list {
  margin-top: 30px;
  padding: 10px;
}

.playground-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
  text-align: left;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.playground-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  border-color: #007BFF;
}

.playground-card::after {
  content: 'View Timeslots →';
  position: absolute;
  bottom: 10px;
  right: 20px;
  color: #007BFF;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.playground-card:hover::after {
  opacity: 1;
}

.playground-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.playground-card .facility-tag {
  display: inline-block;
  background: #e9ecef;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin: 5px;
  color: #495057;
}

.playground-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #007BFF;
}

.playground-card p {
  margin: 5px 0;
  font-size: 14px;
}

.playground-card a {
  color: #007BFF;
  text-decoration: none;
}

.playground-card a:hover {
  text-decoration: underline;
}

/* Timeslot Section */
.timeslot-container {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Base table styles */
.timeslot-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    margin: 0;
    background: white;
}

.timeslot-table th,
.timeslot-table td {
    width: calc(100% / var(--column-count));
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeslot-table th {
    background-color: #007BFF;
    color: white;
    font-weight: 600;
}

/* Modal container styles */
#modal-timeslot-container {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Modal content styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: white;
    margin: 5vh auto;
    padding: 20px;
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop specific adjustments */
@media (min-width: 769px) {
    .timeslot-table {
        display: table;
        width: 100%;
    }

    .timeslot-table th,
    .timeslot-table td {
        width: calc(100% / var(--column-count));
    }

    #modal-timeslot-container {
        overflow: hidden;
    }

    .modal-content {
        padding: 30px;
    }

    /* Remove horizontal scroll on desktop */
    .timeslot-container,
    #modal-timeslot-container {
        overflow-x: hidden;
    }
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .timeslot-container,
    #modal-timeslot-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .timeslot-table {
        min-width: max-content;
    }

    .timeslot-table th,
    .timeslot-table td {
        min-width: 120px;
        max-width: 120px;
    }

    .modal-content {
        margin: 10px auto;
        padding: 15px;
        width: 95%;
        height: auto;
        max-height: 90vh;
    }

    #modal-timeslot-container {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }

    .timeslot-table {
        font-size: 14px;
        min-width: max-content;
    }

    .timeslot-table th,
    .timeslot-table td {
        padding: 10px 8px;
        min-width: 120px;
        white-space: nowrap;
    }
}

/* Remove scroll indicator and background artifacts */
.timeslot-container::after,
#modal-timeslot-container::after {
    display: none;
}

.modal,
.modal-content,
.timeslot-container,
#modal-timeslot-container,
.timeslot-table {
    background-color: white;
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
  header h1 {
    font-size: 18px;
  }
  .logo {
    width: 80px;
  }
}

/* Main Find Playground Button specific styles */
.find-playground-main {
  font-size: 20px;
  padding: 20px 30px;
  background: linear-gradient(45deg, #007BFF, #00a1ff);
  letter-spacing: 0.5px;
  font-weight: 600;
  margin: 20px auto;
  display: block;
}

.find-playground-main:hover {
  background: linear-gradient(45deg, #0056b3, #007BFF);
}

.find-playground-main::after {
  content: ' →';
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateX(-10px);
  display: inline-block;
}

.find-playground-main:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Modal Styles */
.close-modal {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: #000;
}

#modal-title {
  margin: 0 0 20px 0;
  color: #007BFF;
  padding-right: 40px;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Adjust timeslot table styles for modal */
.modal .timeslot-table {
  margin-top: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

/* Make the modal scrollable on mobile */
@media (max-width: 768px) {
  .close-modal {
    /* Make the close button easier to tap on mobile */
    padding: 10px;
    font-size: 32px;
    right: 10px;
    top: 5px;
  }

  /* Adjust table for mobile viewing */
  .timeslot-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    border-radius: 8px;
  }

  .timeslot-table th,
  .timeslot-table td {
    padding: 12px 8px; /* Larger tap targets */
    min-width: 100px; /* Ensure columns aren't too narrow */
  }

  /* Make modal title more readable on mobile */
  #modal-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-right: 50px; /* Space for close button */
  }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
  .modal-content {
    margin: 5px auto;
  }

  .timeslot-table th,
  .timeslot-table td {
    padding: 10px 6px;
    font-size: 14px;
  }
}

/* Update body.modal-open to allow scrolling when needed */
body.modal-open {
    width: 100%;
}

/* Add these styles to your existing CSS */
.loading {
  text-align: center;
  padding: 20px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007BFF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #007BFF;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 999;
}

.back-to-top:hover {
  background: #0056b3;
  transform: translateY(-3px);
}

.back-to-top.visible {
  display: flex;
}

/* Search and Filter Styles */
.search-filter-container {
  margin: 20px auto;
  max-width: 800px;
  padding: 0 20px;
  text-align: center;
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 12px 20px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-size: 16px;
  transition: all 0.3s ease;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  border-color: #0080ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.1);
}

.search-input::placeholder {
  color: #adb5bd;
}

/* Filter button styles */
.filter-button {
  background: linear-gradient(45deg, #007BFF, #00a1ff);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 5px;
  box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
  font-weight: 500;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.filter-button:hover {
  background: linear-gradient(45deg, #0056b3, #007BFF);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

.filter-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.filter-button.active {
  background: linear-gradient(45deg, #004d99, #0066cc);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(1px);
}

.filter-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  transition: opacity 0.3s ease;
}

.filter-button:hover::before {
  opacity: 0.8;
}

/* Mobile responsiveness for filters */
@media (max-width: 768px) {
  .search-filter-container {
    padding: 0 15px;
  }

  .search-input {
    font-size: 14px;
    padding: 10px 15px;
  }

  .filter-button {
    padding: 10px 20px;
    font-size: 14px;
    letter-spacing: 0.2px;
  }
}

/* Responsive Grid System */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* Responsive Typography */
:root {
  --font-size-base: 16px;
  --font-size-h1: 2rem;
  --font-size-h2: 1.5rem;
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 14px;
    --font-size-h1: 1.75rem;
    --font-size-h2: 1.25rem;
  }

  .playground-card {
    padding: 15px;
  }

  .admin-container {
    flex-direction: column;
  }
}

/* Touch-friendly interactions */
@media (hover: none) {
  .playground-button {
    padding: 15px 25px;
  }

  .clickable-element {
    min-height: 44px; /* Apple's recommended minimum */
  }
}

/* Add styles for timeslot container */
#modal-timeslot-container {
  width: 100%;
  overflow: hidden;
  margin: 20px 0;
}

/* Make the table more responsive */
.timeslot-table {
  width: 100%;
  overflow-x: auto;
  display: block;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .modal-content {
    margin: 10% auto;
    width: 90%;
    max-height: 80vh;
  }

  #modal-timeslot-container {
    max-height: calc(80vh - 80px);
  }
}

/* Contact section styles */
.contact-info {
  margin-top: 30px;
  padding: 20px;
  text-align: center;
  color: white; /* Change to white */
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); /* Add text shadow for contrast */
}

.contact-info a {
  color: #007BFF;
  text-decoration: none;
  margin: 0 10px;
  display: inline-block;
  transition: color 0.3s ease;
}

.contact-info a:hover {
  color: #0056b3;
}

.social-links {
  margin-top: 15px;
}

.social-links img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 5px;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
  .timeslot-container,
  #modal-timeslot-container {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    position: relative;
    background: white;
  }

  .timeslot-table {
    font-size: 14px;
    width: auto;
    min-width: max-content; /* Ensure table takes full width of content */
    margin: 0;
    border-spacing: 0;
    border-collapse: separate;
  }

  .timeslot-table th,
  .timeslot-table td {
    padding: 12px 8px;
    min-width: 120px; /* Keep current width */
    white-space: nowrap;
    border: 1px solid #ddd;
  }

  /* Improve modal for mobile */
  .modal-content {
    -webkit-overflow-scrolling: touch;
    max-height: 90vh;
    margin: 5vh auto;
    width: 95%;
    padding: 15px;
    background: white;
  }

  #modal-timeslot-container {
    max-height: calc(90vh - 100px);
    padding: 0;
    margin: 0;
    width: 100%;
    background: white;
  }
}

/* Desktop-specific styles */
@media (min-width: 769px) {
  .timeslot-table {
    width: 100%;
    table-layout: fixed; /* Equal column widths */
  }

  .timeslot-table th,
  .timeslot-table td {
    width: auto; /* Let columns distribute evenly */
    padding: 15px 10px;
  }

  #modal-timeslot-container {
    padding: 20px;
    overflow: visible;
  }

  .modal-content {
    width: 95%;
    max-width: 1400px; /* Increased for better use of space */
    padding: 30px;
  }

  /* Remove horizontal scroll on desktop when not needed */
  .timeslot-container,
  #modal-timeslot-container {
    overflow-x: visible;
  }
}

/* Smooth scrolling for both views */
.timeslot-container,
#modal-timeslot-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Remove any background artifacts */
.modal,
.modal-content,
.timeslot-container,
#modal-timeslot-container,
.timeslot-table {
  background-color: white;
}

/* Remove the scroll indicator shadow */
.timeslot-container::after,
#modal-timeslot-container::after {
  display: none;
}

/* Add horizontal scroll indicator */
.timeslot-container::after,
#modal-timeslot-container::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.1));
  pointer-events: none;
}

/* Price Range Select and Clear Filters Button */
select {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 25px;
    border: 2px solid #e9ecef;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 8px;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

select:hover {
    border-color: #007BFF;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}

select:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Clear Filters Button - Redesigned */
.clear-filters {
  background-color: #f8f9fa;
  color: #495057;
  border: 2px solid #dee2e6;
  padding: 12px 24px; /* Match filter button padding */
  font-size: 16px; /* Match filter button font size */
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 8px;
  position: relative;
  overflow: hidden;
  min-width: 120px;
}

.clear-filters span {
    position: relative;
    z-index: 2; /* This is no longer strictly necessary, but doesn't hurt */
}

/* Remove the ::before pseudo-element */
/* .clear-filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #007BFF;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s ease-in-out;
    z-index: 1;
} */

.clear-filters::after {
    content: '↺';
    font-size: 16px;
    transition: all 0.25s ease-in-out;
    display: inline-block;
    position: relative;
    z-index: 2;
}

.clear-filters:hover {
    color: white;
    background-color: #0056b3; /* Directly change background color */
    border-color: #007BFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
}

/* Remove the hover effect for the pseudo-element */
/* .clear-filters:hover::before {
    transform: scaleX(1);
    transform-origin: left;
} */

.clear-filters:hover::after {
    transform: rotate(180deg);
}

.clear-filters:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .clear-filters {
        font-size: 14px;
        padding: 8px 16px;
        min-width: 100px;
    }

    .clear-filters::after {
        font-size: 14px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
  .clear-filters {
      background-color: #f8f9fa;
      color: #495057;
      border: 2px solid #dee2e6;
  }
  
  .clear-filters:active {
      background-color: #007BFF;
      color: white;
      transform: scale(0.98);
  }
}

/* Container for filters */
.filter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
    padding: 0 15px;
}
