/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%; /* Prevent Safari from auto-adjusting text size */
}

html, body {
    height: 100%;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: #0066cc;
}

a:hover {
    text-decoration: underline;
}

header {
    background-color: #4CAF50;
    color: white;
    text-align: center;
    padding: 2rem 1rem; /* Added horizontal padding */
    width: 100%;
    overflow-x: hidden; /* Only prevent horizontal overflow */
    overflow-y: visible; /* Allow vertical overflow */
    min-height: 120px; /* Ensure minimum height for content */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

header h1 {
    margin-bottom: 0.5rem;
    line-height: 1.2; /* Tighter line height for headers */
    max-width: 100%;
    word-break: break-word; /* Help with word breaking on narrow screens */
}

/* Site Title Link */
.site-title {
    color: white;
    text-decoration: none;
    display: block;
    padding: 0 10px; /* Add horizontal padding for small screens */
    width: 100%;
}

.site-title:hover {
    text-decoration: none;
    color: #e8f5e9;
}

main {
    max-width: 1200px; /* Increased from 900px */
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
    flex: 1 0 auto; /* This makes main grow to fill available space */
}

section {
    margin-bottom: 2rem;
}

h2 {
    margin-bottom: 1rem;
    color: #2e7d32;
    border-bottom: 2px solid #2e7d32;
    padding-bottom: 0.5rem;
}

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    flex-shrink: 0; /* Prevents the footer from shrinking */
    width: 100%;
}

/* States Grid */
.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem;
}

.state-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
    display: block;
    color: #333;
    font-size: 1.2rem;
    font-weight: 500;
}

.state-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    text-decoration: none;
    background-color: #e8f5e9;
}

/* Breadcrumbs */
.breadcrumbs {
    background-color: #f1f1f1;
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 5px;
}

.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumbs li {
    display: inline;
    font-size: 0.9rem;
}

.breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin: 0 0.5rem;
    color: #666;
}

.breadcrumbs a {
    color: #0066cc;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs .current {
    color: #666;
    font-weight: 500;
}

/* State Pages */
.cities-list {
    margin: 2.5rem 0 3rem;
}

.cities-list h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
}

.cities-list p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.back-to-home {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.back-to-home a {
    display: inline-block;
    padding: 0.5rem 0;
    font-weight: 500;
}

/* Court Cards Grid Layout */
.courts-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 0;
    grid-auto-rows: min-content; /* Changed from 1fr to min-content */
}

@media (max-width: 1200px) {
    .courts-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .courts-list {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 1.5rem 1rem; /* Added horizontal padding */
        min-height: 100px;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 0.75rem;
        word-wrap: break-word; /* Help with long words */
    }
    
    .site-title p {
        font-size: 0.9rem;
        max-width: 100%;
        padding: 0 5px;
    }
}

@media (max-width: 480px) {
    .states-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .prev, .next {
        padding: 8px;
        font-size: 14px;
    }
    
    main {
        padding: 0 1rem 2rem;
        margin: 1rem auto 3rem;
    }
    
    header {
        padding: 1rem;
        min-height: 80px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        -webkit-hyphens: auto; /* Enable hyphenation in Safari */
        hyphens: auto;
    }
    
    .site-title p {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}

/* Mobile layout overrides - apply to ALL mobile browsers */
@media screen and (max-width: 767px) {
    .states-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    header h1 {
        font-size: 1.3rem !important;
    }
    
    .site-title p {
        font-size: 0.8rem !important;
    }
}

@media screen and (max-width: 480px) {
    .states-grid {
        grid-template-columns: 1fr !important;
    }
    
    .prev, .next {
        padding: 8px;
        font-size: 14px;
    }
    
    main {
        padding: 0 1rem 2rem;
        margin: 1rem auto 3rem;
    }
    
    header {
        padding: 1rem;
        min-height: 80px;
    }
    
    header h1 {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem;
        -webkit-hyphens: auto;
        hyphens: auto;
    }
    
    .site-title p {
        font-size: 0.75rem !important;
        line-height: 1.3;
    }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    header h1 {
        /* Safari-specific header adjustments */
        font-size: 1.1rem !important;
    }
    
    @media (max-width: 480px) {
        header h1 {
            font-size: 1rem !important;
        }
        
        .site-title p {
            font-size: 0.7rem !important;
        }
        
        /* Force single column for state cards on mobile Safari */
        .states-grid {
            display: flex !important;
            flex-direction: column !important;
            gap: 1rem !important;
        }
        
        .state-card {
            padding: 1.2rem;
            width: 100% !important;
        }
    }
    
    /* Ensure single column on all Safari mobile devices */
    @media (max-width: 767px) {
        .states-grid {
            display: flex !important;
            flex-direction: column !important;
            width: 100% !important;
        }
        
        .state-card {
            width: 100% !important;
            max-width: 100% !important;
        }
    }
}

/* Small desktop widths */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.6rem;
        margin-bottom: 0.6rem;
    }
    
    .site-title p {
        font-size: 0.85rem;
    }
}

/* Card styles with adaptive height */
.court-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: auto; /* Changed from 100% to auto */
    position: relative;
    max-height: none;
}

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

/* Slideshow Container with fixed height */
.slideshow-container {
    position: relative;
    width: 100%;
    height: 200px; /* Fixed height */
    overflow: hidden;
    background-color: #f5f5f5;
    flex-shrink: 0; /* Prevent slideshow from shrinking */
}

.slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Court Info with more compact spacing */
.court-info {
    padding: 1rem 1.25rem; /* Reduced padding */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto; /* Allow growing to fill space */
    text-align: center;
}

.court-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 0.5rem; /* Reduced margin */
}

.court-address {
    margin: 0 auto;
    width: 100%;
    margin-bottom: 0.5rem; /* Reduced margin */
}

.court-address a {
    color: #666;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 100%;
    justify-content: center;
}

.court-address a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.court-address a::before {
    content: "📍";
    font-size: 1rem;
}

.court-address a:hover {
    color: #0066cc;
}

/* Rating and Reviews */
.rating-reviews {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    flex-wrap: wrap;
    margin-bottom: 0.5rem; /* Reduced margin */
}

.stars {
    color: #ffb400;
    letter-spacing: -1px;
    line-height: 1;
    font-size: 0.95rem;
}

.reviews-count {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Court Description */
.court-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
    overflow: visible;
    max-height: none;
    margin-bottom: 0; /* Remove bottom margin */
}

.court-description.has-more::after {
    content: "read more";
    position: absolute;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, white 40%);
    padding: 0 0 0 2rem;
    color: #0066cc;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Court Tags with horizontal layout */
.court-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding-top: 0.6rem;
    border-top: 1px solid #f0f0f0;
    position: relative;
    background-color: white;
    height: auto;
    margin-top: 1rem;
    margin-bottom: 0;
    min-height: 50px;
    overflow-x: auto;
    flex-shrink: 0;
}

.tag {
    background-color: #f5f7fa;
    color: #4a5568;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #edf2f7;
    flex-shrink: 0; /* Prevent tags from shrinking */
}

/* Hide scrollbar for aesthetics while maintaining functionality */
.court-tags::-webkit-scrollbar {
    display: none;
}

.court-tags {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

@supports (-webkit-touch-callout: none) {
    /* Safari tag fixes */
    .court-tags {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: center !important; /* Center tags on Safari */
        padding: 0.6rem 0.5rem 0.4rem !important;
        gap: 0.35rem !important;
        scrollbar-width: none !important;
        position: relative !important;
        height: auto !important;
        min-height: 50px !important; /* Ensure minimum height on Safari */
    }
    
    /* Other Safari-specific styles remain the same */
}

/* Remove old rating styles */
.rating-review {
    display: none;
}

/* Rating filter tags */
.rating-filter-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.rating-filter-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.rating-filter-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.rating-filter-tag.active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 2px rgba(0,0,0,0.05);
}

/* Rating colors with modern gradients */
.rating-high {
    background: linear-gradient(135deg, #e8f5e9 0%, #d7eeda 100%);
    color: #1e8a3e;
}

.rating-high.active {
    background: linear-gradient(135deg, #d4ecd8 0%, #c1e3c5 100%);
}

.rating-medium {
    background: linear-gradient(135deg, #fff8e1 0%, #ffefc8 100%);
    color: #e67700;
}

.rating-medium.active {
    background: linear-gradient(135deg, #ffeecc 0%, #ffe4b3 100%);
}

.rating-low {
    background: linear-gradient(135deg, #ffebee 0%, #ffdce0 100%);
    color: #c62828;
}

.rating-low.active {
    background: linear-gradient(135deg, #ffdbdf 0%, #ffc8cf 100%);
}

/* Layout with sidebar (sidebar currently commented out) */
.layout-container {
    display: block; /* Changed from flex to block since sidebar is removed */
    margin-bottom: 2rem;
}

/* Main content area - now full width */
.main-content {
    width: 100%;
}

/* Nearby cities section - back to original layout */
.nearby-cities {
    margin-bottom: 2rem;
}

.nearby-cities h3 {
    margin-bottom: 1rem;
    color: #2e7d32;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2e7d32;
}

/* No results message */
.no-results-message {
    text-align: center;
    color: #777;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    margin: 2rem auto;
    font-size: 0.95rem;
    display: none;
    max-width: 100%;
    width: 100%;
    grid-column: 1 / -1;
    border: 1px dashed #ddd;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .layout-container {
        flex-direction: column;
    }
    
    .filters-sidebar {
        flex: none;
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }
    
    .tag-filters {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.tag-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Sort container styles */
.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.sort-container select {
    padding: 6px 12px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
    min-width: 150px;
    line-height: 1;
}

.reviews-count {
    display: inline-flex;
    align-items: center;
    color: #666;
    font-size: 0.85rem;
    font-weight: normal;
}

/* Filter tag styles */
.tag-filter {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    background-color: white;
    border: 1px solid #ddd;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-filter:hover {
    background-color: #f8f8f8;
    border-color: #ccc;
}

.tag-filter.active {
    background-color: var(--tag-bg);
    color: var(--tag-color);
    border-color: var(--tag-border);
}

/* Rating container */
.rating-review {
    display: inline-flex;
    margin-right: 10px;
    position: relative;
    height: 33px;  /* Match the height of tags */
}

.rating-review .rating {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;  /* Place on top */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    /* Colors will be applied via class */
}

.rating-review .rating.rating-high {
    background: linear-gradient(135deg, #e8f5e9 0%, #d7eeda 100%);
    color: #1e8a3e;
}

.rating-review .rating.rating-medium {
    background: linear-gradient(135deg, #fff8e1 0%, #ffefc8 100%);
    color: #e67700;
}

.rating-review .rating.rating-low {
    background: linear-gradient(135deg, #ffebee 0%, #ffdce0 100%);
    color: #c62828;
}

.rating-review .reviews {
    background: linear-gradient(135deg, #f9f9f9 0%, #f2f2f2 100%);
    color: #555;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    margin-left: -30px;  /* Increase overlap to hide left border radius */
    padding-left: 38px;  /* Increase internal padding to compensate */
    display: flex;
    align-items: center;
    z-index: 1;  /* Place underneath */
}

.court-image {
    display: block;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.court-image:hover {
    opacity: 0.9;
}

.court-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.court-title a:hover {
    color: #0066cc;
    text-decoration: none;
}

/* Sort container and filters row styles */
.filters-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    background-color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

/* Common label style for both Area and Sort By */
.filter-group label,
.sort-container label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #444;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    height: 32px; /* Match height of tags and select */
}

.tag-filters.horizontal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.neighborhood-filter.tag {
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f5f7fa;
    color: #4a5568;
    padding: 8px 12px;
    border: 1px solid #edf2f7;
    font-size: 0.9rem;
    line-height: 1;
    height: 32px;
    display: inline-flex;
    align-items: center;
}

.neighborhood-filter.tag:hover {
    background-color: #e8f5e9;
    border-color: #4CAF50;
    color: #2e7d32;
}

.neighborhood-filter.tag.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Responsive styles for narrow screens */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .filter-group, 
    .sort-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    .filter-group label,
    .sort-container label {
        height: auto; /* Reset height on mobile */
    }

    .tag-filters.horizontal {
        width: 100%;
    }

    .sort-container select {
        width: 100%;
        min-width: unset;
    }
}

/* Relevance score */
.relevance-score {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.2rem 0;
}

.relevance-score::before {
    content: "•";
    margin: 0 0.5rem 0 0.3rem;
    color: #bbb;
}

.relevance-highest {
    color: #0066cc;
}

.relevance-high {
    color: #2e7d32;
}

.relevance-medium {
    color: #996c00;
}

.relevance-low {
    color: #d46b08;
}

.relevance-lowest {
    color: #cf1322;
}

/* Content Wrapper with modified structure */
.content-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1 1 auto;
    overflow: visible;
    justify-content: flex-start; /* Changed from space-between to flex-start */
}

/* Fix for filtered layout - ensure heights are consistent within rows */
.court-card[style*="display: block"] {
    display: flex !important;
    height: auto !important; /* Changed from 100% to auto */
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Safari tag fixes */
    .court-tags {
        display: flex !important;
        flex-wrap: nowrap !important; /* Prevent wrapping */
        overflow-x: auto !important; /* Allow horizontal scrolling if needed */
        justify-content: flex-start !important; /* Start from left */
        padding: 0.6rem 0.5rem 0.4rem !important;
        gap: 0.35rem !important;
        scrollbar-width: none !important; /* Firefox */
        position: relative !important; /* Ensure relative positioning in Safari */
        height: auto !important; /* Ensure auto height in Safari */
    }
    
    .court-tags::-webkit-scrollbar {
        display: none !important; /* Hide scrollbar */
    }
    
    .tag {
        padding: 0.2rem 0.5rem !important;
        font-size: 0.75rem !important;
        flex-shrink: 0 !important; /* Prevent tags from shrinking */
        border-radius: 12px !important;
    }
} 