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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #fff;
    color: #000;
    font-size: 14px;
    line-height: 1.4;
}

#app {
    display: flex;
    height: 100vh;
}

#map {
    flex: 1;
    position: relative;
}

#sidebar {
    width: 340px;
    background: #fff;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #000;
    z-index: 1000;
}

.header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #000;
}

.header h1 {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.header p {
    font-size: 12px;
    color: #666;
}

.alert {
    background: #000;
    color: #fff;
    padding: 12px 20px;
    font-size: 12px;
    line-height: 1.5;
    display: none;
}

.alert.show {
    display: block;
}

.controls {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sort-buttons {
    display: flex;
    gap: 0;
    border: 1px solid #000;
}

.sort-btn {
    flex: 1;
    padding: 8px;
    background: #fff;
    border: none;
    border-right: 1px solid #000;
    color: #000;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}

.sort-btn:last-child {
    border-right: none;
}

.sort-btn:hover {
    background: #f5f5f5;
}

.sort-btn.active {
    background: #000;
    color: #fff;
}

.beach-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.beach-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.15s;
}

.beach-item:hover {
    background: #f9f9f9;
}

.beach-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 6px;
}

.beach-name {
    font-weight: 400;
    font-size: 13px;
    flex: 1;
}

.fav-btn {
    background: none;
    border: none;
    outline: none;
    color: #000;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    opacity: 0.15;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.fav-btn:hover {
    opacity: 0.5;
    transform: scale(1.1);
}

.fav-btn:focus {
    outline: none;
    border: none;
}

.fav-btn.active {
    opacity: 1;
}

.fav-btn.active:hover {
    opacity: 1;
}

.beach-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #666;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-proper { background: #51cf66; }
.status-warning { background: #ffd43b; }
.status-improper { background: #ff6b6b; }
.status-unknown { background: #868e96; }

.beach-updated {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

.legend {
    padding: 16px 20px;
    border-top: 1px solid #000;
    font-size: 11px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
    padding: 4px 0;
    transition: opacity 0.15s;
    user-select: none;
}

.legend-item:hover {
    opacity: 0.7;
}

.legend-item.hidden {
    opacity: 0.3;
}

.legend-item.hidden .status-indicator {
    opacity: 0.3;
}

.leaflet-popup-content-wrapper {
    background: #fff;
    color: #000;
    border: 1px solid #000;
    border-radius: 0;
    box-shadow: none;
}

.leaflet-popup-content {
    margin: 12px;
    font-size: 12px;
    font-family: inherit;
}

.leaflet-popup-tip {
    background: #fff;
    border: 1px solid #000;
    border-top: none;
    border-right: none;
}

.popup-name {
    font-weight: 400;
    font-size: 13px;
    margin-bottom: 8px;
}

.popup-status {
    margin: 6px 0;
    color: #666;
    font-size: 11px;
}

@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    #map {
        height: 45vh;
    }

    #sidebar {
        width: 100%;
        height: 55vh;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid #000;
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
        transition: none;
    }

    #sidebar.closed {
        display: none;
    }

    .header {
        display: none;
    }

    .controls {
        padding: 8px 12px;
        border-bottom: none;
    }

    .sort-btn {
        padding: 6px;
        font-size: 10px;
    }

    .beach-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        /* grid-auto-rows: minmax(100px, auto); */
        overflow-x: hidden;
        overflow-y: auto;
        padding: 12px;
        gap: 8px;
    }

    .beach-item {
        min-width: auto;
        max-width: none;
        flex-shrink: 0;
        border: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
        padding: 12px;
    }

    .beach-name {
        font-size: 12px;
    }

    .beach-status {
        font-size: 10px;
    }

    .beach-updated {
        font-size: 9px;
    }

    .legend {
        padding: 8px 12px;
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

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

    .toggle-sidebar {
        display: block;
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: #fff;
        border: 1px solid #000;
        color: #000;
        padding: 6px 10px;
        cursor: pointer;
        font-size: 10px;
        font-family: inherit;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .locate-btn {
        top: 10px;
        right: 10px;
        bottom: auto;
    }

    /* Horizontal scrollbar */
    .beach-list::-webkit-scrollbar {
        height: 4px;
        width: 0;
    }
}

.toggle-sidebar {
    display: none;
}

/* Minimal scrollbar */
.beach-list::-webkit-scrollbar {
    width: 0;
    height: 4px;
}

.beach-list::-webkit-scrollbar-track {
    background: transparent;
}

.beach-list::-webkit-scrollbar-thumb {
    background: #ccc;
}

.beach-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Hide scrollbar for Firefox */
.beach-list {
    scrollbar-width: none;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    z-index: 2000;
    color: #000;
}

.locate-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 800;
    background: #fff;
    outline: 2px solid rgba(0,0,0,0.2);
    border: none;
    border-radius: 2px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.locate-btn:hover {
    background: #f4f4f4;
}

.locate-btn:active {
    background: transparent;
}

.locate-btn.loading {
    opacity: 0.5;
}

.user-marker {
    background: #000;
    border: 2px solid #fff;
    border-radius: 50%;
}

/* Leaflet attribution style */
.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #000;
    border-right: 1px solid #000;
}

/* Remove ugly marker borders and outlines */
.leaflet-marker-icon:focus {
    outline: none !important;
}

.leaflet-marker-icon:active {
    outline: none !important;
    border: none !important;
}

.leaflet-div-icon {
    border: none !important;
}

/* Make buttons, labels, and text non-selectable */
button,
label,
.legend-item,
.sort-btn,
.beach-item,
h1, h2, h3, p,
.status-indicator,
.locate-btn,
.toggle-sidebar {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Allow text selection only in specific areas if needed */
.beach-item strong {
    user-select: text;
    -webkit-user-select: text;
}

/* Beach labels on map */
.beach-label {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #fff !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    opacity: 0.8 !important;
}

.beach-label-hidden {
    display: none !important;
}

.beach-label::before {
    display: none !important;
}
