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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
    font-size: 16px;
}

/* Ensure touch targets are at least 44x44px on mobile */
button, select, input[type="checkbox"], input[type="radio"] {
    min-height: 44px;
}

/* Full Screen Map */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(102, 126, 234, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: white;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Floating Top Bar */
.top-bar {
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 8px 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.app-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    margin: 0;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.fog-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.fog-status.has-fog {
    background: #fee2e2;
    color: #991b1b;
}

.fog-status.no-fog {
    background: #d1fae5;
    color: #065f46;
}

.top-bar-center {
    display: none;
    order: 2;
    width: 100%;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.top-bar-center.open {
    display: flex;
}

.advanced-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.filter-select {
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    min-height: 44px;
    flex: 1;
    min-width: 120px;
}

.filter-select:hover {
    border-color: #667eea;
}

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

.filter-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    order: 1;
}

.control-btn {
    padding: 6px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    min-width: 44px;
}

.control-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.control-btn span {
    font-size: 1rem;
}

.control-btn:active {
    transform: scale(0.95);
}

/* Map Controls (Floating below top bar) */
.map-controls {
    position: fixed;
    top: auto;
    bottom: 80px;
    right: 8px;
    left: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 10px;
    z-index: 900;
    max-width: 90vw;
}

/* Mobile: hide map controls by default, show toggle button */
@media (max-width: 1023px) {
    .map-controls {
        display: none !important;
        bottom: 120px;
        right: 8px;
    }

    .map-controls.open {
        display: block !important;
    }

    /* Map controls toggle button - only visible on mobile */
    .map-controls-toggle {
        display: flex;
        position: fixed;
        bottom: 70px;
        right: 8px;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border: 2px solid #e2e8f0;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 901;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        transition: all 0.2s;
    }

    .map-controls-toggle:hover {
        border-color: #667eea;
    }

    .map-controls-toggle.active {
        background: #667eea;
        border-color: #667eea;
        color: white;
    }
}

/* Desktop: always show map controls, hide toggle button */
@media (min-width: 1024px) {
    .map-controls-toggle {
        display: none;
    }
}

.control-group {
    margin-bottom: 8px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.toggle-buttons {
    display: flex;
    gap: 3px;
}

.toggle-btn {
    flex: 1;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.toggle-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.toggle-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.fog-stats {
    margin-top: 6px;
    font-size: 0.7rem;
    color: #64748b;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
    line-height: 1.4;
}

/* Legend Panel (Floating) */
.legend-panel {
    position: fixed;
    bottom: 70px;
    left: 8px;
    right: 8px;
    max-width: calc(100vw - 16px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 12px;
    z-index: 900;
    max-height: 40vh;
    overflow-y: auto;
}

.legend-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #334155;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    line-height: 1.3;
}

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

.marker-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Right Peaks Panel (Slide-out) */
.peaks-panel {
    position: fixed;
    top: auto;
    bottom: -100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    background: white;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    border-radius: 20px 20px 0 0;
    z-index: 1100;
    transition: bottom 0.3s ease;
    display: flex;
    flex-direction: column;
}

.peaks-panel.open {
    bottom: 0;
}

.peaks-panel-header {
    padding: 14px 16px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-radius: 20px 20px 0 0;
}

.peaks-panel-header h2 {
    font-size: 1.1rem;
    color: #334155;
    margin: 0;
    font-weight: 600;
}

.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
}

.close-btn:hover {
    background: #667eea;
    color: white;
    transform: rotate(90deg);
}

.close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.peaks-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

/* Peak Card */
.peak-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.peak-card:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.peak-card:active {
    transform: translateY(0);
}

.peak-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.peak-name {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
}

.peak-score {
    background: #fef3c7;
    color: #92400e;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.peak-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.peak-detail {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #64748b;
}

.peak-road-access {
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 8px;
}

.road-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 4px;
    margin-right: 4px;
}

.road-badge.very-high {
    background: #d1fae5;
    color: #065f46;
}

.road-badge.high {
    background: #fef3c7;
    color: #92400e;
}

.road-badge.medium {
    background: #fed7aa;
    color: #9a3412;
}

.peak-amenities {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.peak-amenities-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.amenity-badge {
    display: inline-block;
    padding: 3px 6px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 4px;
    margin-bottom: 4px;
}

.peak-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.peak-action-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #667eea;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.peak-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.peak-action-btn:active {
    transform: scale(0.95);
}

/* Floating Footer */
.floating-footer {
    position: fixed;
    bottom: 8px;
    left: 8px;
    right: 8px;
    transform: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 850;
    display: flex;
    gap: 8px;
    font-size: 0.65rem;
    color: #64748b;
    flex-wrap: wrap;
    justify-content: center;
}

.floating-footer span {
    white-space: nowrap;
}

/* Responsive - Tablet and below */
@media (max-width: 768px) {
    .app-title h1 {
        font-size: 1rem;
    }

    .top-bar-center {
        display: none;
    }

    .top-bar-center.open {
        display: flex;
    }

    .filter-select {
        font-size: 0.8rem;
        padding: 8px 8px;
        min-width: 100%;
    }

    .advanced-filters {
        display: flex;
        flex-direction: column;
    }

    .control-btn {
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .control-btn span {
        font-size: 0.95rem;
    }
}

/* Responsive - Small phones (375px) */
@media (max-width: 375px) {
    .app-title h1 {
        font-size: 0.95rem;
        letter-spacing: -0.7px;
    }

    .fog-status {
        display: none;
    }

    .control-btn {
        padding: 6px 6px;
        font-size: 0.65rem;
    }

    .control-btn span {
        font-size: 0.9rem;
    }

    .peak-name {
        font-size: 0.95rem;
    }

    .peak-score {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* Responsive - Medium phones (428px and up) */
@media (min-width: 428px) and (max-width: 768px) {
    .app-title h1 {
        font-size: 1.05rem;
    }

    .top-bar {
        padding: 10px 12px;
    }

    .control-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .peaks-panel {
        max-height: 65vh;
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .app-title h1 {
        font-size: 1.3rem;
        letter-spacing: 0;
    }

    .fog-status {
        display: flex;
    }

    .top-bar {
        top: 20px;
        left: 20px;
        right: 20px;
        padding: 12px 20px;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 16px;
        align-items: center;
    }

    .top-bar-left {
        flex-shrink: 0;
    }

    .top-bar-center {
        display: flex;
        flex: 1;
        order: auto;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: auto;
        margin-top: 0;
    }

    /* Main filter dropdown - always visible */
    .top-bar-center > .filter-select {
        flex: 0 0 auto;
        min-width: 180px;
    }

    /* Advanced filters - hidden by default on desktop too */
    .top-bar-center .advanced-filters {
        display: none;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 10px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        padding: 12px;
        margin-top: 8px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        z-index: 1001;
        min-width: 400px;
    }

    .top-bar-center .advanced-filters.open {
        display: flex;
    }

    .top-bar-right {
        order: auto;
        gap: 8px;
        flex-shrink: 0;
    }

    .control-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .filter-select {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: auto;
        flex: 0 0 auto;
    }

    .map-controls {
        top: 100px;
        bottom: auto;
        right: 20px;
        left: auto;
        max-width: 200px;
    }

    .control-group label {
        font-size: 0.85rem;
    }

    .toggle-btn {
        font-size: 0.85rem;
        padding: 6px 10px;
        min-height: initial;
    }

    .fog-stats {
        font-size: 0.8rem;
    }

    .legend-panel {
        bottom: 80px;
        left: 20px;
        right: auto;
        max-width: 300px;
        max-height: initial;
    }

    .peaks-panel {
        top: 0;
        bottom: auto;
        left: auto;
        right: -450px;
        width: 450px;
        max-height: initial;
        border-radius: 0;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
    }

    .peaks-panel.open {
        right: 0;
        bottom: auto;
    }

    .peaks-panel-header {
        border-radius: 0;
        padding: 20px 24px;
    }

    .peaks-list {
        padding: 16px;
    }

    .peak-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .peak-name {
        font-size: 1.1rem;
    }

    .peak-details {
        gap: 12px;
    }

    .peak-detail {
        font-size: 0.9rem;
    }

    .floating-footer {
        bottom: 20px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        padding: 8px 20px;
        gap: 16px;
        font-size: 0.75rem;
        border-radius: 20px;
        flex-wrap: nowrap;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) {
    .top-bar {
        top: 5px;
        padding: 6px 10px;
    }

    .peaks-panel {
        max-height: 80vh;
    }

    .legend-panel {
        bottom: 65px;
        max-height: 35vh;
    }
}
