/*
Story Time Locator - Stylesheet

This CSS uses a mobile-first approach:
- Base styles work on small screens
- Media queries add enhancements for larger screens
*/

/* ===== RESET & BASE STYLES ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ===== CONTAINER ===== */

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

/* ===== HEADER ===== */

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 16px;
    color: #666;
}

/* ===== FORM STYLES ===== */

.search-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

small {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #888;
}

/* ===== SUBMIT AND CLEAR BUTTONS ===== */

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.submit-btn {
    flex: 2;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.clear-btn {
    flex: 1;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.clear-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.clear-btn:active {
    transform: translateY(0);
}

/* ===== LOADING SPINNER ===== */

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #667eea;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== HIDDEN CLASS ===== */

.hidden {
    display: none !important;
}

/* ===== ERROR MESSAGES ===== */

.error {
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    color: #c00;
}

.error p {
    margin: 0;
}

/* ===== RESULTS SECTION ===== */

.results {
    margin-top: 30px;
}

.results-header {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Share Section Styles */
.share-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid #d0d7e8;
}

.share-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.share-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.share-url-container {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.share-url-container.hidden {
    display: none;
}

#shareURLInput {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    font-size: 14px;
    border: 2px solid #d0d7e8;
    border-radius: 6px;
    background: white;
    font-family: 'Courier New', monospace;
    color: #333;
}

#shareURLInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.copy-button {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-button:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

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

@media (max-width: 600px) {
    .share-url-container {
        flex-direction: column;
        align-items: stretch;
    }

    #shareURLInput {
        width: 100%;
        min-width: unset;
    }

    .copy-button {
        width: 100%;
    }
}

.result-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: static;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.result-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.result-distance {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.result-address {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.5;
}

.result-contact {
    font-size: 15px;
    color: #888;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.result-contact a {
    color: #667eea;
    text-decoration: none;
}

.result-contact a:hover {
    text-decoration: underline;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.no-results p {
    font-size: 18px;
    margin-bottom: 10px;
}

/* ===== CLAUDE AI RESULTS ===== */

.claude-results {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #667eea;
    margin-top: 20px;
}

.claude-content {
    font-size: 16px;
    color: #333;
    line-height: 1.8;
}

.claude-content strong {
    color: #667eea;
    font-size: 19px;
    font-weight: 700;
}

/* Make Claude results look nice on mobile */
@media (max-width: 768px) {
    .claude-results {
        padding: 20px 15px;
    }

    .claude-content {
        font-size: 15px;
    }
}

/* ===== FOOTER ===== */

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.disclaimer {
    margin-top: 10px;
    font-size: 13px;
    color: #aaa;
    font-style: italic;
}

.contact {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

.contact a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact a:hover {
    color: #357abd;
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet and up */
@media (min-width: 768px) {
    .container {
        padding: 40px;
    }

    h1 {
        font-size: 40px;
    }

    .subtitle {
        font-size: 18px;
    }
}

/* Desktop and up */
@media (min-width: 1024px) {
    body {
        padding: 40px;
    }

    .container {
        max-width: 700px;
    }
}

/* ===== ACCESSIBILITY ===== */

/* Focus styles for keyboard navigation */
*:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Ensure good contrast */
::selection {
    background: #667eea;
    color: white;
}

/* ===== CHECKBOX GROUP (for day selection) ===== */

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
    font-size: 15px;
    color: #555;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* ===== EVENT CARD STYLES ===== */

/* Badge container */
.event-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.city-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.free-badge {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.event-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.event-datetime {
    font-size: 16px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
}

.event-location {
    font-size: 15px;
    color: #666;
    margin-bottom: 8px;
}

.event-audience {
    font-size: 14px;
    color: #888;
    margin-bottom: 12px;
    font-style: italic;
}

.event-description {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.event-actions {
    margin-top: 15px;
}

.event-link {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.event-link:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* All-day event badge */
.all-day-badge {
    display: inline-block;
    background: #f59e0b;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 5px;
}

/* Mobile adjustments for event cards */
@media (max-width: 768px) {
    .city-badge {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }

    .event-title {
        padding-right: 0;
    }

    .button-group {
        flex-direction: column;
    }

    .submit-btn,
    .clear-btn {
        width: 100%;
    }
}

/* ===== CUSTOM MULTI-SELECT DROPDOWN ===== */

.custom-multiselect {
    position: relative;
    width: 100%;
}

.multiselect-header {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.multiselect-header:hover {
    border-color: #667eea;
}

.multiselect-header.active {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    color: #667eea;
    font-size: 12px;
}

.multiselect-header.active .dropdown-arrow {
    transform: rotate(180deg);
}

.multiselect-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.multiselect-group-label {
    padding: 8px 15px;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 12px;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.multiselect-option {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.multiselect-option:hover {
    background-color: #f0f4ff;
}

.multiselect-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.multiselect-option label {
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
}

/* ===== VIEW TOGGLE BUTTONS ===== */

.view-toggle {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    padding: 10px 0;
}

.toggle-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ===== MAP CONTAINER ===== */

.map-container {
    margin-top: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#map {
    height: 600px;
    width: 100%;
    position: relative;
    touch-action: pan-x pan-y; /* Allow panning/scrolling on touch devices */
}

/* Subtle blur for CartoDB tiles (they're already clean and minimal) */
.leaflet-tile-pane {
    filter: blur(0.5px) grayscale(20%) brightness(1.05);
    opacity: 0.9;
}

/* Keep labels and controls crisp */
.leaflet-control,
.leaflet-marker-pane,
.leaflet-popup-pane,
.leaflet-shadow-pane {
    filter: none !important;
}

/* Professional pin marker styling */
.map-pin-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.map-pin-marker:hover {
    transform: translateY(-3px) scale(1.05);
    z-index: 1000 !important;
}

/* Pin circle */
.pin-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 3px rgba(255, 255, 255, 0.9),
        0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.map-pin-marker:hover .pin-circle {
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 0 4px rgba(255, 255, 255, 1),
        0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Pin pointer (teardrop shape) */
.pin-pointer {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid currentColor;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Color variations */
.pin-library {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pin-library .pin-pointer {
    color: #667eea;
}

.pin-bookstore {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.pin-bookstore .pin-pointer {
    color: #06b6d4;
}

/* Size variations based on event count */
.pin-size-small {
    width: 40px;
    height: 40px;
}

.pin-size-small .pin-circle {
    font-size: 14px;
}

.pin-size-medium {
    width: 50px;
    height: 50px;
}

.pin-size-medium .pin-circle {
    font-size: 16px;
}

.pin-size-large {
    width: 60px;
    height: 60px;
}

.pin-size-large .pin-circle {
    font-size: 18px;
    font-weight: 800;
}

/* Custom tooltip styling */
.custom-tooltip {
    background: rgba(0, 0, 0, 0.85) !important;
    border: none !important;
    border-radius: 6px !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.custom-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 0;
    overflow: visible; /* Changed from hidden to allow scrolling */
    touch-action: auto; /* Allow scrolling within popup on mobile */
}

.leaflet-popup-content {
    margin: 0;
    font-family: inherit;
    min-width: 250px;
    overflow: visible; /* Allow inner content to scroll */
}

.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0,0,0,0.2);
}

/* Popup header with color coding */
.popup-header {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0; /* Don't let header shrink */
}

.popup-header.bookstore {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.popup-header-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.popup-header-subtitle {
    font-size: 13px;
    opacity: 0.95;
}

/* Make header smaller on mobile to give more room for content */
@media (max-width: 768px) {
    .popup-header {
        padding: 12px;
    }

    .popup-header-title {
        font-size: 15px;
        margin-bottom: 2px;
    }

    .popup-header-subtitle {
        font-size: 12px;
    }
}

/* Popup body */
.popup-body {
    padding: 16px;
    padding-bottom: 24px; /* Extra padding at bottom for last button */
    background: white;
    max-height: 450px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior-y: contain; /* Prevent scroll from bouncing to parent */
}

/* Mobile: smaller max-height to fit screen */
@media (max-width: 768px) {
    .popup-body {
        max-height: calc(70vh - 100px); /* 70vh minus header height and margins for proper fit */
        overflow-y: scroll !important; /* Force scrollbar to always show */
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 80px !important; /* CRITICAL: Large padding so button is always accessible */
        overscroll-behavior: contain; /* Prevent scroll from affecting map */
        overscroll-behavior-y: contain; /* Specifically for vertical scroll */
        position: relative; /* Create positioning context */
        scroll-behavior: smooth; /* Smooth scrolling */
    }
}

.popup-event-count {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

/* Event items in popup */
.popup-event-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.popup-event-item.bookstore {
    border-left-color: #06b6d4;
}

.popup-event-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.popup-event-time {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 6px;
}

.popup-event-link {
    display: inline-flex;
    align-items: center;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: color 0.2s ease;
}

.popup-event-link:hover {
    color: #5568d3;
}

.popup-more-events {
    text-align: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.popup-show-all-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    margin-bottom: 8px; /* Space below button so it's clearly visible when scrolled to */
    display: block; /* Ensure it takes full space */
}

.popup-show-all-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.popup-show-all-btn.bookstore {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.popup-show-all-btn.bookstore:hover {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.popup-hidden-events {
    display: none;
}

.popup-hidden-events.expanded {
    display: block;
}

/* Floating Map Legend */
.map-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s ease;
    max-width: 220px;
}

.legend-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.legend-toggle {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.legend-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.legend-body {
    padding: 14px;
    max-height: 400px;
    overflow-y: auto;
}

.legend-body.collapsed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.legend-section {
    margin-bottom: 16px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color-box {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-color-box.library {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.legend-color-box.bookstore {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.legend-size-demo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.legend-pin-small,
.legend-pin-medium,
.legend-pin-large {
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
}

.legend-pin-small {
    width: 16px;
    height: 16px;
}

.legend-pin-medium {
    width: 20px;
    height: 20px;
}

.legend-pin-large {
    width: 24px;
    height: 24px;
    font-size: 11px;
}

/* Mobile adjustments for map */
@media (max-width: 768px) {
    #map {
        height: 400px;
    }

    .view-toggle {
        flex-direction: column;
        padding: 10px;
    }

    .toggle-btn {
        max-width: 100%;
    }

    .map-legend {
        max-width: 180px;
        font-size: 12px;
    }

    .legend-header {
        font-size: 12px;
        padding: 10px 12px;
    }

    .legend-body {
        padding: 10px;
    }

    /* Make pins larger and easier to tap on mobile */
    .pin-size-small {
        width: 48px !important;
        height: 48px !important;
    }

    .pin-size-medium {
        width: 56px !important;
        height: 56px !important;
    }

    .pin-size-large {
        width: 64px !important;
        height: 64px !important;
    }

    /* Make clusters easier to tap */
    .marker-cluster-small {
        width: 50px !important;
        height: 50px !important;
    }

    .marker-cluster-medium {
        width: 60px !important;
        height: 60px !important;
    }

    .marker-cluster-large {
        width: 70px !important;
        height: 70px !important;
    }

    /* Adjust popup for mobile */
    .leaflet-popup-content-wrapper {
        max-width: 90vw !important;
        max-height: 80vh !important; /* Increased to 80vh for even more room */
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .leaflet-popup-content {
        max-height: 80vh !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Make sure button is visible on mobile */
    .popup-show-all-btn {
        font-size: 13px;
        padding: 14px 12px; /* Slightly more padding for easier tapping */
        margin-top: 12px;
        margin-bottom: 12px;
    }

    /* Force proper scrolling container */
    .popup-body {
        flex: 1 1 auto !important;
        min-height: 0 !important; /* Critical for flexbox scrolling */
    }

    /* Ensure map remains scrollable on mobile */
    #map {
        height: 400px;
        touch-action: pan-x pan-y !important;
        -webkit-overflow-scrolling: touch;
    }

    .leaflet-container {
        touch-action: pan-x pan-y !important;
    }

    .popup-header-title {
        font-size: 15px;
    }

    .popup-event-item {
        padding: 10px;
    }

    .popup-event-title {
        font-size: 13px;
    }

    /* Make links easier to tap */
    .popup-event-link {
        padding: 8px 0;
        display: block;
    }
}

/* Custom cluster styling */
.marker-cluster {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 4px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    touch-action: manipulation; /* Prevent double-tap zoom on mobile */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.marker-cluster div {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to parent */
}

.marker-cluster-small {
    width: 45px;
    height: 45px;
}

.marker-cluster-small div {
    font-size: 13px;
}

.marker-cluster-medium {
    width: 55px;
    height: 55px;
}

.marker-cluster-medium div {
    font-size: 15px;
}

.marker-cluster-large {
    width: 65px;
    height: 65px;
}

.marker-cluster-large div {
    font-size: 17px;
}

/* Hover effect for clusters */
.marker-cluster:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Active/tap state for mobile */
.marker-cluster:active {
    transform: scale(0.95);
}

/* ===== EMAIL SUBSCRIPTION MODAL ===== */

.email-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.email-modal-content {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.email-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.email-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.email-modal-content h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.modal-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
}

.modal-benefits li {
    padding: 8px 0 8px 30px;
    position: relative;
    color: #555;
    font-size: 16px;
}

.modal-benefits li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
    font-size: 18px;
}

.email-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.email-form input[type="email"] {
    flex: 1;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.email-form input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.subscribe-btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.subscribe-btn:active {
    transform: translateY(0);
}

.unsubscribe-note {
    font-size: 13px;
    color: #888;
    text-align: center;
    margin: 0;
}

.modal-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.modal-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .email-modal-content {
        padding: 30px 20px;
    }

    .email-modal-content h2 {
        font-size: 20px;
    }

    .email-form {
        flex-direction: column;
    }

    .subscribe-btn {
        width: 100%;
    }
}

/* ===== FOOTER EMAIL SIGNUP ===== */

footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.footer-signup {
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    border: 2px solid #e0e8ff;
}

.footer-signup-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.footer-email-form {
    margin: 0;
}

.footer-email-group {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.footer-email-group input[type="email"] {
    flex: 1;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #d0d7e8;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.footer-email-group input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.footer-subscribe-btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.footer-subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.footer-subscribe-btn:active {
    transform: translateY(0);
}

.footer-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
}

.footer-message.success {
    background: #d4edda;
    color: #155724;
}

.footer-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* Mobile responsive for footer */
@media (max-width: 600px) {
    .footer-email-group {
        flex-direction: column;
    }

    .footer-subscribe-btn {
        width: 100%;
    }

    .footer-signup-label {
        font-size: 16px;
    }
}
