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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.public-banner {
    margin: -8px 0 12px 0;
    background: #fff3cd;
    color: #5c4400;
    border: 1px solid #ffe69c;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.68),
            rgba(255, 255, 255, 0.44));
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 6px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    --progress-width: 0%;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(76, 175, 80, 0.5) 0%,
            rgba(129, 199, 132, 0.6) 50%,
            rgba(76, 175, 80, 0.5) 100%);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    z-index: 0;
    width: var(--progress-width);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08),
        0 0 12px rgba(76, 175, 80, 0.25),
        0 3px 10px rgba(76, 175, 80, 0.20);
    pointer-events: none;
}

h1 {
    color: #2c5530;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
}

.progress-inline {
    display: flex;
    gap: 25px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.progress-item {
    font-size: 0.9rem;
    color: #666;
}

.progress-item strong {
    color: #2c5530;
    font-size: 1.1rem;
    margin-right: 4px;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.map-section,
.list-section {
    background: white;
    border-radius: 12px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 6px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.section-header {
    padding: 20px;
    background: #2c5530;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.map-controls,
.list-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.map-container {
    height: 600px;
    width: 100%;
}

.legend {
    padding: 15px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.completed-marker {
    background: #28a745;
}

.remaining-marker {
    background: #dc3545;
}

.mountain-list {
    max-height: 600px;
    overflow-y: auto;
}

.mountain-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mountain-item:hover {
    background-color: #f8f9fa;
}

.mountain-item.completed {
    background-color: #d4edda;
}

.mountain-info {
    flex-grow: 1;
}

.mountain-name {
    font-weight: 600;
    color: #2c5530;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.mountain-elevation {
    color: #666;
    font-size: 0.8rem;
}

.mountain-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.completion-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.completion-date {
    font-size: 0.8rem;
    color: #666;
    min-width: 110px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.completion-date .date-text {
    cursor: pointer;
}

.completion-date .date-picker-btn {
    background: transparent;
    border: none;
    color: #222;
    padding: 2px;
    width: 24px;
    height: 24px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.completion-date .date-picker-btn:hover {
    opacity: 0.85;
}

.completion-date .date-picker-btn:focus-visible {
    outline: 2px solid #2c5530;
    outline-offset: 2px;
    border-radius: 4px;
}

.completion-date .date-picker-btn .icon {
    width: 16px;
    height: 16px;
}

.date-editor {
    font-size: 0.9rem;
    padding: 4px 6px;
}

/* Share modal */
#share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
}

#share-modal {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: min(560px, 92vw);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 99999;
}

#share-modal h3 { margin-top: 0; color: #2c5530; }
#share-modal input { width: 100%; padding: 10px; margin: 10px 0 16px; }
.share-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Username modal */
#username-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#username-modal {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: min(450px, 92vw);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

#username-modal h3 { margin-top: 0; color: #2c5530; }
#username-modal input { 
    width: 100%; 
    padding: 10px; 
    margin: 10px 0 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}
.username-actions { display: flex; gap: 10px; justify-content: flex-end; }

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #2c5530;
    color: white;
}

.btn-primary:hover {
    background: #1e3a21;
}

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

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

#search-input,
#sort-select,
#filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

#search-input {
    min-width: 130px;
}

.actions {
    text-align: center;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .progress-summary {
        gap: 20px;
    }

    .stat-number {
        font-size: 2rem;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 520px) {
    h1 {
        font-size: 1.3rem;
        line-height: 1.2;
    }

    header {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
    }

    .progress-inline {
        justify-content: center;
        gap: 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .map-controls,
    .list-controls {
        justify-content: center;
    }

    .mountain-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .mountain-status {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    .map-container {
        height: 300px;
    }

    .mountain-list {
        max-height: 400px;
    }
}

/* Ensure Netlify Identity modal appears above Leaflet map */
.netlify-identity-overlay,
.netlify-identity-modal,
#netlify-identity-widget,
.netlify-identity-iframe,
iframe[src*="identity.netlify.com"] {
    z-index: 99999 !important;
    position: fixed;
}

/* Keep map layers below global modals */
.leaflet-container {
    z-index: 0;
}
