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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: pan-x pan-y;
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .btn, .btn-search, .close-btn {
        min-height: 44px; /* iOS recommended touch target size */
        min-width: 44px;
    }
    
    .search-box input {
        min-height: 44px;
    }
    
    /* Leaflet controls touch targets */
    .leaflet-control-locate a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Fullscreen Map */
.fullscreen-map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 140px; /* leave room for footer banner + spacing */
    width: 100%;
    height: auto;
    z-index: 0;
}

body.layout-sidebar .fullscreen-map {
    right: 360px;
}

/* Floating Header - Top Center */
.floating-header {
    position: fixed; /* Changed from absolute to fixed */
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10000; /* Much higher z-index */
    width: 90%;
    max-width: 800px;
    pointer-events: none; /* Allow map interaction through header */
}

.floating-header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-shadow: 
        3px 3px 8px rgba(0, 0, 0, 0.6),
        -1px -1px 2px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
    margin: 0 0 6px 0;
    pointer-events: auto; /* Allow text selection */
}

.floating-header .tagline {
    font-size: 1.1rem;
    font-weight: 500;
    color: white;
    text-shadow: 
        2px 2px 6px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(0, 0, 0, 0.4);
    margin: 0;
    letter-spacing: 0.5px;
    pointer-events: auto; /* Allow text selection */
}

.floating-header .tagline #tagline-count {
    font-weight: 700;
    color: #ffd700;
}

/* Floating Controls - Top Left */
.floating-controls {
    position: fixed; /* Changed from absolute to fixed */
    top: 110px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9000;
}

.btn {
    background: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    pointer-events: auto; /* Ensure buttons are clickable */
}


.type-select {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
}

.type-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.type-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.search-box {
    display: flex;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto; /* Ensure search box is interactive */
}

.search-box input {
    flex: 1;
    border: none;
    padding: 8px 12px;
    font-size: 1rem;
    min-width: 180px;
    pointer-events: auto;
}

.search-box input:focus {
    outline: none;
}

.btn-search {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    pointer-events: auto;
}

.btn-search:hover {
    background: #5568d3;
}


/* Banner ad - footer */
.ad-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 110px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    padding: 0 24px 12px;
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.18);
    z-index: 9000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.ad-banner .adsbygoogle {
    display: block;
    width: min(728px, 100%);
    min-height: 90px !important;
    margin-top: 12px;
}

.ad-banner iframe {
    width: 100%;
    max-height: 120px;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    padding: 30px;
    text-align: center;
    border-radius: 6px;
    border: 2px dashed #ccc;
}

.ad-placeholder p {
    color: #999;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Attribution - Bottom Left */
/* Attribution matches Leaflet style */
.floating-attribution {
    position: fixed;
    bottom: 120px;
    left: 20px;
    font-size: 0.7rem;
    color: #333;
    z-index: 8500;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1.3;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.floating-attribution strong {
    color: #667eea;
    font-weight: 600;
}

.floating-attribution a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.floating-attribution a:hover {
    text-decoration: underline;
}

/* Info Panel - Right Side */
.info-panel {
    position: fixed; /* Changed from absolute to fixed */
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    z-index: 11000; /* Higher than header */
}

.osm-attribution-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    line-height: 1.4;
}

.osm-attribution-footer a {
    color: #999;
    text-decoration: none;
}

.osm-attribution-footer a:hover {
    color: #667eea;
    text-decoration: underline;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    pointer-events: auto; /* Ensure button is clickable */
}

.close-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.info-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-right: 40px;
    font-size: 1.5rem;
}

.info-item {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 6px;
}

.info-item strong {
    color: #667eea;
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom Marker Styles */
.fitness-marker {
    background: #667eea;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: transform 0.3s;
}

.fitness-marker:hover {
    transform: scale(1.2);
}

/* Leaflet.Locate Control - Custom Styling */
.leaflet-control-locate {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-control-locate a {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    width: 34px;
    height: 34px;
}

.leaflet-control-locate a:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8a 100%);
}

.leaflet-control-locate.active a {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

/* Marker Clusters - Modern Style */
.marker-cluster-small {
    background-color: rgba(102, 126, 234, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(102, 126, 234, 0.8);
    color: white;
    font-weight: 700;
}

.marker-cluster-medium {
    background-color: rgba(118, 75, 162, 0.5);
}

.marker-cluster-medium div {
    background-color: rgba(118, 75, 162, 0.8);
    color: white;
    font-weight: 700;
}

.marker-cluster-large {
    background-color: rgba(231, 76, 60, 0.5);
}

.marker-cluster-large div {
    background-color: rgba(231, 76, 60, 0.8);
    color: white;
    font-weight: 700;
}

/* ============================================================================
   RESPONSIVE DESIGN - Tablet & Mobile
   ============================================================================ */

/* Tablet (portrait) */
@media (max-width: 1024px) and (min-width: 769px) {
    .floating-header h1 {
        font-size: 2.8rem;
    }
    
    .floating-header .tagline {
        font-size: 1rem;
    }
}

/* Tablet & Mobile */
@media (max-width: 768px) {
    .fullscreen-map {
        bottom: 130px;
    }
    .fullscreen-map {
        bottom: 80px;
    }
    
    .floating-header {
        top: 10px;
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
    }
    
    .floating-header h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    .floating-header .tagline {
        display: none; /* Hide tagline on mobile */
    }
    
    .floating-controls {
        top: 75px; /* Closer to header without tagline */
        left: 10px;
        right: 10px;
        width: auto;
        gap: 0;
        flex-direction: column;
    }
    
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        min-width: auto;
        font-size: 0.95rem;
    }
    
    .ad-banner {
        width: 100%;
        left: 0;
        right: 0;
        transform: none;
        bottom: 0;
        border-radius: 0;
        padding: 10px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        justify-content: center;
    }
    
    .ad-banner .adsbygoogle,
    .ad-banner iframe {
        min-height: 80px !important;
        max-height: 120px !important;
    }
    
    .ad-placeholder {
        padding: 6px;
        border-radius: 3px;
        border-width: 1px;
    }
    
    .ad-placeholder p {
        font-size: 0.7rem;
    }
    
    .info-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 10px;
        transform: none;
        max-width: none;
        max-height: 65vh;
        padding: 20px;
    }
    
    .info-panel h2 {
        font-size: 1.3rem;
    }
    
    .floating-attribution {
        bottom: 120px;
        left: 12px;
        right: auto;
        font-size: 0.6rem;
        padding: 4px 6px;
        max-width: 80%;
    }
    
    .floating-attribution strong {
        display: inline;
    }
}

/* Mobile (small screens) */
@media (max-width: 480px) {
    .fullscreen-map {
        bottom: 115px;
    }
    .fullscreen-map {
        bottom: 70px;
    }
    
    .floating-header h1 {
        font-size: 1.6rem;
        letter-spacing: 0.5px;
    }
    
    .floating-header .tagline {
        display: none; /* Hide tagline on mobile */
    }
    
    .floating-controls {
        top: 70px;
        gap: 0;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    
    .search-box {
        padding: 6px;
    }
    
    .search-box input {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .btn-search {
        padding: 6px 12px;
        font-size: 1rem;
    }
    
    
    .info-panel {
        max-height: 70vh;
        padding: 15px;
    }
    
    .info-panel h2 {
        font-size: 1.1rem;
        padding-right: 35px;
    }
    
    .info-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .info-item strong {
        font-size: 0.75rem;
    }
    
    .close-btn {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
    
    .ad-banner {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 8px;
        justify-content: center;
    }
    
    .ad-banner .adsbygoogle,
    .ad-banner iframe {
        min-height: 75px !important;
        max-height: 110px !important;
    }
    
    .ad-placeholder {
        padding: 5px;
    }
    
    .floating-attribution {
        font-size: 0.5rem;
        padding: 4px 6px;
        bottom: 110px;
        left: 10px;
        right: auto;
    }
    
    .osm-attribution-footer {
        font-size: 0.65rem;
        margin-top: 15px;
        padding-top: 12px;
    }
}

/* Landscape mode - maximize map */
@media (max-height: 600px) and (orientation: landscape) {
    .fullscreen-map {
        bottom: 0;
    }
    
    .floating-header {
        display: none; /* Hide header in landscape to maximize map */
    }
    
    .floating-controls {
        top: 80px; /* Below Leaflet zoom controls */
        left: 10px;
        max-width: 250px;
    }
    
    .info-panel {
        max-height: 85vh;
        max-width: 350px;
        right: 10px;
        bottom: 10px;
        top: auto;
        transform: none;
    }
    
    .ad-banner {
        display: none; /* Hide ads in landscape */
    }
    
    .floating-attribution {
        font-size: 0.55rem;
        padding: 4px 6px;
        bottom: 10px;
        left: 8px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .fullscreen-map {
        bottom: 100px;
    }
    .fullscreen-map {
        bottom: 60px;
    }
    
    .floating-header h1 {
        font-size: 1.4rem;
    }
    
    .floating-header .tagline {
        display: none; /* Hide tagline on mobile */
    }
    
    .floating-controls {
        top: 65px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .ad-banner {
        padding: 6px;
        justify-content: center;
    }
    
    .ad-banner .adsbygoogle,
    .ad-banner iframe {
        min-height: 70px !important;
        max-height: 100px !important;
    }
    
    .ad-placeholder {
        padding: 4px;
    }
    
    .floating-attribution {
        bottom: 100px;
        font-size: 0.45rem;
        left: 8px;
        right: auto;
    }
}

/* Large screens - optimize layout */
@media (min-width: 1400px) {
    .floating-header h1 {
        font-size: 3.5rem;
    }
    
    .floating-controls {
        left: 30px;
    }
    
    .ad-banner {
        width: min(600px, calc(100vw - 80px));
        bottom: 18px;
        padding: 12px 18px;
    }
    
    .info-panel {
        max-width: 450px;
        right: 30px;
    }
}
