/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 15px;
    color: white;
}

header img {
    width: 70%;
    height: auto;
    margin-bottom: 0.5rem;
    border-radius: 1rem;
}

header h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.emoji-banner {
    width: 70%;
    margin: 0 auto;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content */
main {
    flex: 1;
    background: white;
    border-radius: 1.5rem;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Search section */
.search-section {
    margin-bottom: 1rem;
}

/* Filters container */
.filters {
    margin-bottom: 1rem;
}

.filters h3 {
    text-align: center;
    color: blue;
    font-size: 1.5rem;
    padding: 0;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Event Type Toggle */
.event-type-toggle {
    margin-bottom: 1rem;
    text-align: center;
}

.event-type-toggle label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.toggle-buttons {
    display: inline-flex;
    gap: 0;
    margin-top: 5px;
}

.toggle-buttons input[type="radio"] {
    display: none;
}

.toggle-btn {
    padding: 8px 20px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.toggle-btn:first-of-type {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    border-right: none;
}

.toggle-btn:last-of-type {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-left: none;
}

.toggle-btn:hover {
    background-color: #e6f3ff;
}

.toggle-btn.active,
.toggle-buttons input[type="radio"]:checked + .toggle-btn {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Unified filter section styling */
.filters > div {
    text-align: center;
    margin-bottom: 5px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

/* Unified filter label styling - main labels */
.filters > div > label {
    color: blueviolet !important;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    text-align: center;
}

/* Distance input section */
.search-distance {
    text-align: center;
    margin-bottom: 5px;
    padding: 0.1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.search-distance label {
    color: blueviolet;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.search-distance input {
    padding: 10px 15px;
    margin: 0;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: 120px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-distance input:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Sport filter section */
.search-sport {
    text-align: center;
    margin-bottom: 5px;
    padding: 0.1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.search-sport label {
    color: blueviolet;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.search-sport select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: auto;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.search-sport select:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* University filter section */
.search-university {
    text-align: center;
    margin-bottom: 5px;
    padding: 0.1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.search-university label {
    color: blueviolet;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.search-university select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: auto;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.search-university select:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* NFL Team Selection - Match University Style */
.search-nfl-team {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.search-nfl-team label {
    color: blueviolet;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.search-nfl-team select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: auto;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.search-nfl-team select:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Special date range layout */
.date-inputs {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.date-input-group label {
    color: #666 !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    margin-bottom: 2px !important;
}

.date-input-group input {
    width: 150px !important;
    padding: 8px 12px !important;
    font-size: 0.95rem !important;
    border-radius: 15px !important;
}

.search-form {
    text-align: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.input-group label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
}

.input-group input {
    padding: 12px 20px; 
    margin: 0;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    width: 250px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.input-group button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

.input-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.input-group button:active {
    transform: translateY(0);
}

/* Error message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    border: 1px solid #ffcdd2;
}

/* Loading message */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2rem;
}

/* Results section */
.results-section h2 {
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    font-size: 2rem;
}

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.event-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.event-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.event-sport {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.event-details {
    color: #666;
    line-height: 1.6;
}

.event-details strong {
    color: #333;
}

.distance {
    color: #28a745;
    font-weight: 600;
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results h2 {
    margin-bottom: 15px;
    color: #333;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    opacity: 0.8;
    margin-top: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2.5rem;
    }

    main {
        padding: 20px;
    }

    .input-group {
        width: 100%;
    }

    .input-group input {
        width: 100%;
        max-width: 300px;
    }

    .events-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 15px;
    }
}

/* Settings Button Styling */
#settingsBtn {
    background: rgba(255,255,255,0.2) !important;
    border: none !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    backdrop-filter: blur(10px) !important;
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 100 !important;
    transition: all 0.3s ease !important;
}

#settingsBtn:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: translateY(-2px) !important;
}

/* Mobile responsive settings button */
@media (max-width: 768px) {
    #settingsBtn {
        position: static !important;
        display: block !important;
        margin: 0 auto 15px auto !important;
        top: auto !important;
        right: auto !important;
    }
    
    header div[style*="position: relative"] {
        position: static !important;
    }
}

@media (max-width: 480px) {
    #settingsBtn {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
}

/* Search Mode Toggle - Match Event Type Toggle Style */
.search-mode-toggle {
    margin-bottom: 1rem;
    text-align: center;
}

.search-mode-toggle label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.search-toggle-buttons {
    display: inline-flex;
    gap: 0;
    margin-top: 5px;
}

.search-toggle-buttons input[type="radio"] {
    display: none;
}

.search-toggle-btn {
    padding: 8px 20px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.search-toggle-btn:first-of-type {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    border-right: none;
}

.search-toggle-btn:last-of-type {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-left: none;
}

.search-toggle-btn:hover {
    background-color: #e6f3ff;
}

.search-toggle-btn.active,
.search-toggle-buttons input[type="radio"]:checked + .search-toggle-btn {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Remove old radio button styles */
.radio-option {
    display: none;
}

/* Map Section Styles */
#mapSection {
    margin-top: 30px;
    border-radius: 15px;
    overflow: hidden;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.map-controls {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.map-toggle-btn, .map-control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.map-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.map-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.map-control-btn {
    background: #6c757d;
    color: white;
}

.map-control-btn:hover {
    background: #545b62;
}

/* Tooltip Container */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Info icon styling */
.tooltip-icon {
    font-size: 16px;
    cursor: pointer;
    color: #007bff;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s, transform 0.2s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
}

.tooltip-icon:hover {
    background-color: rgba(0, 123, 255, 0.1);
    transform: scale(1.1);
}

.tooltip-icon:active {
    transform: scale(0.95);
}

/* Tooltip Styling */
.tooltip {
    visibility: hidden;
    width: 180px;
    max-width: calc(100vw - 40px); /* More conservative margin to prevent overflow */
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    text-align: center;
    border-radius: 8px;
    padding: 8px 10px;
    position: absolute;
    z-index: 1000;
    top: 110%; /* Position below the button instead of above */
    left: 0; /* Align to left edge of button container */
    margin-right: 20px; /* Ensure space from right edge */
    font-size: 0.85rem;
    line-height: 1.3;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

/* Tooltip arrow */
.tooltip::after {
    content: "";
    position: absolute;
    bottom: 100%; /* Arrow at top of tooltip (pointing up to button) */
    left: 50px; /* Position arrow to point toward button */
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent rgba(0, 0, 0, 0.9) transparent;
}

/* Show tooltip on hover or when has .show class */
.tooltip-container:hover .tooltip,
.tooltip.show {
    visibility: visible;
    opacity: 1;
}

#eventsMap {
    height: 500px;
    width: 100%;
    position: relative;
}

/* Flash effect overlay for offline preparation */
.map-flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.1s ease-in;
}

.map-flash-overlay.flash {
    opacity: 0.8;
}

/* Custom Leaflet Popup Styles */
.leaflet-popup-content {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
}

.event-popup {
    max-width: 250px;
}

.event-popup h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.1rem;
}

.event-popup .event-details {
    font-size: 0.9rem;
    color: #666;
    margin: 4px 0;
}

.event-popup .event-sport {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 1rem;
    display: inline-block;
    margin: 4px 0;
}

.event-popup .event-distance {
    font-weight: bold;
    color: #28a745;
}

.event-popup .event-link {
    display: inline-block;
    background: #007bff;
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-top: 8px;
    transition: background 0.3s ease;
}

.event-popup .event-link:hover {
    background: #0056b3;
}

/* Map integration styles */
.view-toggle {
    text-align: center;
    margin: 20px 0;
}

.view-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.view-toggle-btn:hover {
    transform: translateY(-2px);
}

/* Event marker styles */
.event-marker {
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    text-align: center;
    line-height: 21px;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.user-location-marker {
    background: white;
    border: 2px solid #28a745;
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    font-size: 16px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

/* Responsive Map Controls */
@media (max-width: 768px) {
    .map-controls {
        flex-direction: column;
        text-align: center;
    }
    
    #eventsMap {
        height: 400px;
    }
}