* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 30px;
    background-color: #4a8f29; /* Base golf green color */
    background-image: 
    /* Keep only the grid pattern and base gradient */
    linear-gradient(
        rgba(255, 255, 255, 0.05) 1px, 
        transparent 1px
    ),
    linear-gradient(
        90deg, 
        rgba(255, 255, 255, 0.05) 1px, 
        transparent 1px
    ),
    /* Base gradient */
    linear-gradient(
        rgba(74, 143, 41, 0.8), 
        rgba(85, 160, 50, 0.9)
    );
    background-size: 
    20px 20px, 
    20px 20px, 
    100% 100%;
    min-height: 100vh;
    perspective: 800px;
}

#username-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 1200px;
    margin: 0 auto 30px auto;
}

/* New styling for #courses to create a responsive grid */
#courses {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    width: 250px;
    height: 280px; /* Default height when not expanded */
    display: flex;
    flex-direction: column;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Darker, more prominent shadow */
    position: relative;
    overflow: visible; /* Change from hidden to visible */
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, height 0.3s ease; /* Add transitions for hover effects */
    z-index: 1; /* Keep at 1 (above balls and hole) */
}

/* Update hover effect shadow as well */
.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4); /* Darker, more pronounced shadow on hover */
}

.card h3 {
    margin: 0 0 5px 0; /* Consistent minimal margin */
    height: 55px; /* Increased from 40px to 55px */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    font-size: clamp(12px, 16px, 18px); /* Base size that can adjust */
    line-height: 1.2;
    padding: 0 5px;
    width: 100%;
}

/* Add this to handle longer titles better */
.card h3.long-title {
  font-size: 14px; /* Smaller font for long titles */
}

/* Very long titles get even smaller text */
.card h3.very-long-title {
  font-size: 12px; /* Even smaller font */
  line-height: 1.1;
}

.card img.cover-image {
    width: 100%;
    height: 100%; /* Fixed height for cover image */
    object-fit: cover; /* Maintain aspect ratio while covering area */
    border-radius: 8px; /* Add rounded corners to cover images */
    display: block; /* Ensure block display */
    margin: 0; /* Remove any margin */
}
.expanded {
    display: none;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background-color: white;
    padding: 25px;
    border: none;
    z-index: 1000 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    width: 95vw !important;
    max-width: 800px !important;
    max-height: 90vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    animation: cardExpand 0.3s ease-out;
}

/* Remove backdrop overlay styles since we're not using it */

/* Close button for expanded cards */
.expanded-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background-color: #d32f2f;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

.photo-gallery img {
    margin: 5px;
    max-width: 100px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 6px; /* Add rounded corners to gallery images */
}
.photo-gallery img:hover {
    transform: scale(1.1);
}
#username-container {
    margin-bottom: 20px;
}

@keyframes cardExpand {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Add these styles to your existing CSS */
.golf-hole {
    position: fixed;
    bottom: 50px;
    right: 100px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #000;
    box-shadow: 0 0 0 5px white;
    z-index: -2; /* Changed from 1 to -2 */
}

.golf-hole::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5px;
    height: 5px;
    background-color: #333;
    border-radius: 50%;
}

/* Updated golf ball styling */
.golf-ball {
    position: fixed;
    width: 15px;
    height: 15px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 
    inset -3px -3px 5px rgba(0,0,0,0.3),
    0 2px 4px rgba(0,0,0,0.4),
    0 0 1px 1px rgba(255,255,255,0.6);
    z-index: -1;
    overflow: hidden;
}

/* Simplify golf ball styling - remove animation-related properties */
.golf-ball::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
    radial-gradient(circle at 30% 30%, rgba(0,0,0,0.1) 2px, transparent 2px),
    radial-gradient(circle at 70% 30%, rgba(0,0,0,0.1) 2px, transparent 2px),
    radial-gradient(circle at 30% 70%, rgba(0,0,0,0.1) 2px, transparent 2px),
    radial-gradient(circle at 70% 70%, rgba(0,0,0,0.1) 2px, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0.1) 2px, transparent 2px);
    background-size: 8px 8px;
    border-radius: 50%;
}

@keyframes dropIn {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

/* Add Star Rating Styles to bottom of your style.css file */
.star-rating {
  display: inline-flex;
  flex-direction: row-reverse; /* Makes hover logic work */
  font-size: 0; /* Removes space between stars */
}

.star-rating input {
  display: none; /* Hide radio buttons */
}

.star-rating label {
  cursor: pointer;
  font-size: 28px;
  padding: 0 2px;
  color: #ccc; /* Empty star color */
  transition: all 0.2s ease;
}

/* Show proper color when hovering */
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: #fbc02d; /* Default star color (yellow) */
}

.star-rating label:hover {
  transform: scale(1.2);
}

/* Star colors based on rating */
.star-rating input[value="5"]:checked ~ label {
  color: #2e7d32; /* Dark green */
}

.star-rating input[value="4"]:checked ~ label {
  color: #689f38; /* Light green */
}

.star-rating input[value="3"]:checked ~ label {
  color: #fbc02d; /* Yellow */
}

.star-rating input[value="2"]:checked ~ label {
  color: #f57c00; /* Orange */
}

.star-rating input[value="1"]:checked ~ label {
  color: #d32f2f; /* Red */
}

.rating-display {
  margin-top: 5px;
  font-size: 14px;
  color: #555;
}

/* Add these media queries at the end of your style.css file */

/* Mobile responsiveness */
@media (max-width: 768px) {
  #courses {
    gap: 15px; /* Smaller gap for mobile */
  }
  
  .card {
    width: calc(50% - 15px); /* Two cards per row with gap consideration */
    height: 230px; /* Increased from 200px */
    margin: 0; /* Remove any default margins */
    display: flex;
    flex-direction: column;
  }
  
  .card h3 {
    font-size: 14px; /* Smaller font for mobile */
    margin-top: 0;
    margin-bottom: 5px; /* Reduce margin to give more space to image */
    height: 45px; /* Increased from 35px */
    overflow: hidden; /* Prevent long titles from breaking layout */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .card img.cover-image {
    width: 100%;
    height: 160px; /* Ensure image doesn't take full card height */
    object-fit: cover;
    flex: 1; /* Fill remaining space */
  }
  
  /* Mobile specific adjustments for expanded cards */
  .expanded {
    width: 95vw !important;
    max-width: none !important;
    padding: 15px !important;
    max-height: 90vh !important;
    font-size: 16px;
    position: absolute !important;
    z-index: 1000 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

.expanded h3 {
    font-size: 24px !important;
    margin-bottom: 15px !important;
    text-align: center;
}

.expanded p {
    font-size: 16px !important;
    margin-bottom: 12px !important;
    line-height: 1.4;
}

.expanded img {
    max-width: 100% !important;
    height: auto !important;
    margin: 10px 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

.expanded .photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 15px 0;
    width: 100%;
    box-sizing: border-box;
}

.expanded .photo-gallery img {
    width: 70px !important;
    height: 70px !important;
    object-fit: cover !important;
    margin: 0 !important;
    border-radius: 4px;
    box-sizing: border-box !important;
}

.expanded .star-rating {
    justify-content: center;
    margin: 15px 0;
}

.expanded .star-rating label {
    font-size: 32px !important;
    padding: 0 4px;
}
}

/* Adjust for very small screens */
@media (max-width: 480px) {
  .card {
    width: calc(50% - 10px); /* Keep two per row but adjust spacing */
    height: 210px; /* Increased from 180px */
    padding: 8px; /* Less padding */
  }
  
  .card h3 {
    font-size: 12px; /* Even smaller font */
    height: 40px; /* Increased from 30px */
  }
  
  .card img.cover-image {
    height: 150px; /* Adjust image height for smaller cards */
  }
  
  #courses {
    gap: 10px; /* Even smaller gap for very small screens */
  }
}

/* Update these styles for star rating overlay */

.rating-overlay {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7); /* Darker background for better visibility */
  border-radius: 15px;
  padding: 3px 8px;
  color: white;
  font-size: 16px;
  z-index: 10; /* Ensure it's on top */
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Add subtle shadow */
}

/* Make sure the image container has proper positioning */
.card .image-container {
  position: relative;
  width: 100%;
  height: 200px; /* Fixed height */
  overflow: hidden;
  border-radius: 8px;
  margin-top: 0; /* Remove any margin that could push it down */
  flex: 1; /* Take remaining space */
}

/* Apply flex-column to cards to ensure consistent layout */
.card {
  display: flex;
  flex-direction: column;
  height: 280px; /* Increased from 250px to 280px */
  overflow: hidden;
  border-radius: 12px;
  padding: 10px;
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease, height 0.3s ease;
  z-index: 1;
}

/* Ensure title is consistent height */
.card h3 {
  height: 55px; /* Increased from 40px to 55px */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 5px 0; /* Reduce margin */
  overflow: hidden;
  text-align: center;
}

/* Fix desktop image alignment */
.card img.cover-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  display: block; /* Ensure block display */
  margin: 0; /* Remove any margin */
}

/* Edit Course Page Styles */
.edit-container {
    background-color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.edit-container h1 {
    color: #305f1a;
    margin-bottom: 20px;
    border-bottom: 2px solid #305f1a;
    padding-bottom: 10px;
}

.image-preview {
    max-width: 200px;
    margin: 10px 0;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 5px;
}

.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.photo-gallery img {
    max-width: 150px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 5px;
}

.remove-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px 0;
}

.image-container {
    margin-bottom: 20px;
}

.edit-container label {
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
    color: #305f1a;
    font-weight: bold;
}

.edit-container input[type="text"], 
.edit-container input[type="url"], 
.edit-container input[type="number"], 
.edit-container select {
    width: 100%;
    max-width: 500px;
    padding: 8px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.edit-container input[type="submit"], 
.edit-container button {
    padding: 8px 15px;
    background-color: #305f1a;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 10px;
    margin-top: 20px;
}

.edit-container input[type="submit"]:hover, 
.edit-container button:hover {
    background-color: #3e7b23;
}

.edit-container a button {
    background-color: #555;
}

/* Styling for images within expanded cards */
.expanded img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border-radius: 8px;
    cursor: pointer;
}

.expanded h3 {
    font-size: 28px;
    margin-bottom: 20px;
    text-align: center;
    color: #305f1a;
}

.expanded p {
    font-size: 18px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.expanded .photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.expanded .photo-gallery img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    transition: transform 0.2s;
}

.expanded .photo-gallery img:hover {
    transform: scale(1.1);
}

.expanded .star-rating {
    justify-content: center;
    margin: 20px 0;
}

.expanded .star-rating label {
    font-size: 36px;
    padding: 0 5px;
}

.expanded .rating-display {
    text-align: center;
    font-size: 16px;
    margin-top: 10px;
}