/* Mine All Mine V2 - Dark Theme with Gold Accent
   Merged from Mineral Mapping + Desktop styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    color: #333;
}

/* ---- Sidebar ---- */
#sidebar {
    width: 320px;
    min-width: 320px;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar h1 {
    font-size: 1.3em;
    color: #f0c040;
    margin-bottom: 2px;
}

#sidebar .subtitle {
    font-size: 0.82em;
    color: #888;
    margin-bottom: 16px;
}

.section {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a4a;
}

.section h2 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 8px;
}

/* ---- Mineral groups ---- */
.mineral-group {
    margin-bottom: 8px;
}

.group-header {
    font-size: 0.85em;
    font-weight: 600;
    color: #bbb;
    cursor: pointer;
    padding: 4px 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.group-header:hover {
    color: #fff;
}

.group-arrow {
    font-size: 0.7em;
    display: inline-block;
    width: 12px;
}

.group-body {
    padding-left: 8px;
}

/* ---- Layer toggles ---- */
.layer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    cursor: pointer;
    font-size: 0.85em;
}

.layer-toggle:hover {
    color: #fff;
}

.layer-toggle input[type="checkbox"],
.layer-toggle input[type="radio"] {
    accent-color: #f0c040;
    flex-shrink: 0;
}

.layer-label {
    flex: 1;
}

/* ---- Region selector dropdown ---- */
.region-select {
    width: 100%;
    padding: 6px 8px;
    background: #1a1a1a;
    color: #f0c040;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 0.9em;
    cursor: pointer;
}
.region-select:hover {
    border-color: #f0c040;
}

/* ---- Waypoints ---- */
.wp-controls {
    display: flex;
    gap: 6px;
    margin: 6px 0;
}
.wp-btn, .wp-btn-sm {
    flex: 1;
    padding: 5px 8px;
    background: #2a2a2a;
    color: #f0c040;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    text-align: center;
}
.wp-btn-sm { font-size: 0.75em; padding: 4px 6px; }
.wp-btn:hover, .wp-btn-sm:hover { border-color: #f0c040; background: #333; }
.wp-btn.active { background: #f0c040; color: #1a1a1a; }
.wp-import-label { display: inline-block; }

.wp-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid #333;
}
.wp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    cursor: pointer;
    font-size: 0.82em;
    border-bottom: 1px solid #2a2a2a;
}
.wp-item:hover { background: #2a2a2a; }
.wp-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid #fff3;
}
.wp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-row-del {
    background: none; border: none; color: #888;
    cursor: pointer; font-size: 1.1em; padding: 0 4px;
}
.wp-row-del:hover { color: #e74c3c; }
.wp-empty { padding: 8px 4px; color: #666; font-size: 0.8em; font-style: italic; }

/* Waypoint marker pin */
.waypoint-icon { background: transparent; border: none; }
.waypoint-pin {
    width: 14px; height: 14px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.wp-popup .popup-title { color: #f0c040; font-weight: bold; margin: 0 0 6px; }
.wp-delete-btn {
    margin-top: 6px;
    padding: 4px 10px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
}
.wp-delete-btn:hover { background: #c0392b; }

/* ---- Color swatches ---- */
.swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

/* ---- Points toggle button ---- */
.pts-toggle {
    font-size: 1.1em;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

.pts-toggle:hover {
    opacity: 0.8;
}

.pts-toggle.active {
    opacity: 1.0;
}

/* ---- Opacity slider ---- */
#opacity-slider {
    width: 100%;
    accent-color: #f0c040;
}

/* ---- Mode tabs ---- */
.mode-tabs {
    display: flex;
    gap: 4px;
}

.mode-tab {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    font-size: 0.82em;
    transition: all 0.2s;
}

.mode-tab:hover {
    color: #fff;
    border-color: #f0c040;
}

.mode-tab.active {
    background: #f0c040;
    color: #1a1a2e;
    border-color: #f0c040;
    font-weight: 600;
}

/* ---- Mode panels ---- */
.mode-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mode-panel.active {
    display: block;
}

.mode-panel h2 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 6px;
}

.hint {
    font-size: 0.78em;
    color: #777;
    margin-bottom: 10px;
    line-height: 1.3;
}

/* ---- Slider controls ---- */
.slider-group {
    margin-bottom: 10px;
}

.slider-group label {
    display: block;
    font-size: 0.82em;
    color: #bbb;
    margin-bottom: 4px;
}

.slider-group label span {
    color: #f0c040;
    font-weight: 600;
}

.slider-group input[type="range"] {
    width: 100%;
    accent-color: #f0c040;
}

.action-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 4px;
    background: #f0c040;
    color: #1a1a2e;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85em;
    margin-bottom: 10px;
}

.action-btn:hover {
    background: #d9a020;
}

.action-btn:disabled {
    background: #3a3a5a;
    color: #666;
    cursor: not-allowed;
}

/* ---- Results lists ---- */
.result-group-header {
    font-size: 0.8em;
    font-weight: 600;
    color: #f0c040;
    padding: 4px 0;
    border-bottom: 1px solid #2a2a4a;
    margin-bottom: 4px;
}

.result-item {
    padding: 5px 8px;
    font-size: 0.8em;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    line-height: 1.3;
}

.result-item:hover {
    background: rgba(240, 192, 64, 0.1);
    border-left-color: #f0c040;
    color: #fff;
}

.result-item .result-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-item .result-meta {
    color: #888;
    font-size: 0.9em;
}

/* ---- Score badge (inline) ---- */
.score-badge-sm {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 700;
    color: #1a1a2e;
}

.score-high { background: #2ecc71; }
.score-mid { background: #f0c040; }
.score-low { background: #e74c3c; color: #fff; }

/* ---- Collapsible overlay groups ---- */
.overlay-group {
    margin-bottom: 6px;
}

.overlay-group-header {
    font-size: 0.82em;
    font-weight: 600;
    color: #bbb;
    cursor: pointer;
    padding: 4px 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.overlay-group-header:hover {
    color: #fff;
}

.overlay-group-body {
    padding-left: 8px;
}

/* ---- Sub-toggles (claim filters) ---- */
.sub-toggles {
    margin-left: 20px;
    padding-top: 2px;
}

.sub-toggles .layer-toggle {
    font-size: 0.8em;
    padding: 2px 0;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    margin-bottom: 2px;
}

.filter-label {
    font-size: 0.72em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 100%;
    margin-top: 4px;
}

.filter-row .layer-toggle {
    font-size: 0.78em;
    padding: 1px 0;
}

.color-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
}

/* ---- Legend ---- */
#legend {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legend-gradient {
    width: 100%;
    height: 16px;
    border-radius: 3px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #888;
}

/* ---- Info panel ---- */
#info-panel {
    font-size: 0.85em;
    line-height: 1.4;
}

#info-panel p {
    margin-bottom: 4px;
}

#info-panel .info-label {
    color: #888;
    font-size: 0.8em;
}

#info-panel .info-value {
    color: #f0c040;
    font-weight: 600;
}

/* ---- Map ---- */
#map {
    flex: 1;
    height: 100vh;
}

/* ---- Assessment panel (right side) ---- */
#assess-panel {
    width: 380px;
    min-width: 380px;
    background: #1a1a2e;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: margin-right 0.3s;
}

#assess-panel.hidden {
    display: none;
}

.assess-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a4a;
}

.assess-header h2 {
    font-size: 1em;
    color: #f0c040;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#assess-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 4px;
}

#assess-close:hover {
    color: #fff;
}

/* ---- Score display ---- */
.score-display {
    padding: 16px;
    border-bottom: 1px solid #2a2a4a;
    text-align: center;
}

.score-big {
    display: inline-block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    font-size: 1.8em;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.score-label {
    font-size: 0.78em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- Score breakdown ---- */
.score-breakdown {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a4a;
}

.score-component {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.8em;
}

.score-component .sc-label {
    width: 80px;
    color: #888;
    flex-shrink: 0;
}

.score-component .sc-bar {
    flex: 1;
    height: 8px;
    background: #2a2a4a;
    border-radius: 4px;
    overflow: hidden;
}

.score-component .sc-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.score-component .sc-value {
    width: 36px;
    text-align: right;
    color: #e0e0e0;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- Interactive score breakdown ---- */
.sc-expandable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: 0 -4px;
    transition: background 0.15s;
}

.sc-expandable:hover {
    background: rgba(240, 192, 64, 0.08);
}

.sc-expandable.expanded {
    background: rgba(240, 192, 64, 0.12);
}

.sc-detail {
    padding: 4px 8px 8px 8px;
    font-size: 0.75em;
    color: #aaa;
    line-height: 1.5;
    border-left: 2px solid #2a2a4a;
    margin: 0 0 4px 4px;
}

.sc-detail.hidden {
    display: none;
}

.sc-detail .sc-explain {
    color: #ccc;
}

/* ---- Assessment tabs ---- */
.assess-tabs {
    display: flex;
    border-bottom: 1px solid #2a2a4a;
    padding: 0 8px;
}

.assess-tab {
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 0.78em;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.assess-tab:hover {
    color: #ccc;
}

.assess-tab.active {
    color: #f0c040;
    border-bottom-color: #f0c040;
}

.badge {
    font-size: 0.85em;
    background: #3a3a5a;
    color: #aaa;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 2px;
}

/* ---- Assessment body ---- */
.assess-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.82em;
    border-bottom: 1px solid #1e1e38;
}

.detail-row .dl {
    color: #888;
}

.detail-row .dv {
    color: #e0e0e0;
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.detail-row .dv.highlight {
    color: #f0c040;
}

.detail-list-item {
    padding: 6px 0;
    border-bottom: 1px solid #1e1e38;
    font-size: 0.82em;
    cursor: pointer;
}

.detail-list-item:hover {
    background: rgba(240, 192, 64, 0.08);
}

.detail-list-item .item-name {
    font-weight: 600;
    color: #e0e0e0;
}

.detail-list-item .item-meta {
    color: #888;
    font-size: 0.9em;
}

.detail-list-item .item-distance {
    color: #f0c040;
    font-size: 0.85em;
}

/* ---- Claim highlight selection ---- */
.claim-list-item {
    transition: background 0.15s, border-left-color 0.15s;
    border-left: 3px solid transparent;
}

.claim-list-item:hover {
    background: rgba(240, 192, 64, 0.1);
    border-left-color: #f0c040;
}

.claim-list-item.claim-selected {
    background: rgba(240, 192, 64, 0.18);
    border-left-color: #f0c040;
}

.claim-list-item.claim-selected .item-name {
    color: #f0c040;
}

/* ---- Claim/Mine section headers ---- */
.claim-section-header {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #aaa;
    padding: 8px 0 4px 0;
    border-bottom: 1px solid #2a2a4a;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.claim-section-header:first-child {
    margin-top: 0;
}

.section-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- SMA Legend ---- */
.sma-legend {
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 0.78em;
}

.sma-legend-title {
    font-weight: 600;
    color: #aaa;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.sma-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
    color: #ccc;
}

.sma-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* ---- Hillshade blend mode ---- */
.hillshade-blend {
    mix-blend-mode: multiply;
}

/* ---- PLSS section label tooltip ---- */
.plss-label {
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid #f0c040;
    color: #f0c040;
    font-size: 0.8em;
    font-weight: 600;
    padding: 2px 6px;
}

/* ---- Search ---- */
.search-section {
    position: relative;
    border-bottom: none;
    margin-bottom: 6px;
    padding-bottom: 0;
}

.search-wrapper {
    position: relative;
}

#search-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
    font-size: 0.9em;
    font-family: inherit;
}

#search-input:focus {
    outline: none;
    border-color: #f0c040;
}

#search-input::placeholder {
    color: #666;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #16213e;
    border: 1px solid #3a3a5a;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1001;
}

.search-results.hidden {
    display: none;
}

.search-result-item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #1e1e38;
    font-size: 0.82em;
}

.search-result-item:hover {
    background: rgba(240, 192, 64, 0.12);
}

.search-result-item .sr-name {
    font-weight: 600;
    color: #e0e0e0;
}

.search-result-item .sr-meta {
    color: #888;
    font-size: 0.9em;
}

.sr-type {
    display: inline-block;
    font-size: 0.75em;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    margin-right: 4px;
}

.sr-type-claim {
    background: #e74c3c;
    color: #fff;
}

.sr-type-mine {
    background: #f0c040;
    color: #1a1a2e;
}

.search-no-results {
    padding: 10px;
    color: #666;
    font-size: 0.82em;
    text-align: center;
}

.assess-footer {
    padding: 8px 16px;
    border-top: 1px solid #2a2a4a;
    font-size: 0.82em;
}

.assess-footer select {
    padding: 4px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #16213e;
    color: #e0e0e0;
}

/* ---- Loading overlay ---- */
#loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #2a2a4a;
    border-top-color: #f0c040;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@-webkit-keyframes spin {
    to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Credits ---- */
.credits {
    font-size: 0.72em;
    color: #555;
    margin-top: auto;
    padding-top: 10px;
    border-bottom: none;
}

/* ---- Leaflet overrides ---- */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
    font-size: 0.9em;
}

.leaflet-popup-content {
    margin: 10px 14px;
}

.popup-title {
    font-weight: 600;
    margin-bottom: 4px;
}

/* ---- Dark-themed feature popups ---- */
.dark-popup .leaflet-popup-content-wrapper {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #f0c040;
    border-radius: 6px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}

.dark-popup .leaflet-popup-tip {
    background: #1a1a2e;
    border-right: 1px solid #f0c040;
    border-bottom: 1px solid #f0c040;
}

.dark-popup .leaflet-popup-close-button {
    color: #888;
}

.dark-popup .leaflet-popup-close-button:hover {
    color: #f0c040;
}

.dark-popup .popup-title {
    color: #f0c040;
    font-weight: 600;
    font-size: 1.05em;
    margin-bottom: 6px;
    border-bottom: 1px solid #2a2a4a;
    padding-bottom: 4px;
}

.dark-popup .popup-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
    font-size: 0.88em;
}

.dark-popup .popup-label {
    color: #888;
    flex-shrink: 0;
}

.dark-popup .popup-val {
    color: #f0c040;
    font-weight: 600;
}

/* Source badge — small muted pill next to popup titles, used by the
   Historical Claims layer to tag each feature with its provider
   (BLM / USMIN / IGS / DOGAMI / WADGER) and by Mining Districts. */
.source-badge {
    display: inline-block;
    font-size: 0.72em;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #d8d8e8;
    background: #2a2a3e;
    border: 1px solid #3d3d5a;
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ---- Toast notifications ---- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(26, 26, 46, 0.95);
    border-left: 4px solid #3498db;
    padding: 12px 16px;
    border-radius: 6px;
    max-width: 360px;
    font-size: 13px;
    color: #e0e0e0;
    pointer-events: auto;
    cursor: pointer;
    transform: translateX(0);
    opacity: 1;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast-error {
    border-color: #e74c3c;
}

.toast-warning {
    border-color: #f0c040;
}

.toast-info {
    border-color: #3498db;
}

.toast.toast-exit {
    opacity: 0;
    transform: translateX(100%);
}

/* ---- Skeleton loading placeholders ---- */
.skeleton {
    background: linear-gradient(90deg, #2a2a4a 25%, #3a3a5a 50%, #2a2a4a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

@-webkit-keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Sidebar toggle (mobile only) ---- */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #f0c040;
    color: #1a1a2e;
    font-size: 1.4em;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle:active {
    background: #d9a020;
}

/* ---- Feature gating (free vs Pro) ---- */
.feature-locked {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.feature-locked::after {
    content: 'PRO';
    position: absolute;
    top: 4px;
    right: 4px;
    background: #f0c040;
    color: #1a1a2e;
    font-size: 0.65em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    pointer-events: auto;
}

/* Upgrade prompt modal */
.upgrade-prompt {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upgrade-prompt.hidden {
    display: none;
}

.upgrade-prompt-inner {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 420px;
    width: 90%;
    color: #e0e0e0;
}

.upgrade-prompt-inner h3 {
    color: #f0c040;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.upgrade-prompt-inner ul {
    margin: 12px 0 18px 18px;
    font-size: 0.9em;
    line-height: 1.7;
}

.upgrade-actions {
    display: flex;
    gap: 10px;
}

.btn-gold {
    background: #f0c040;
    color: #1a1a2e;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-gold:hover {
    background: #d9a020;
}

.btn-secondary {
    background: transparent;
    color: #888;
    border: 1px solid #2a2a4a;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-secondary:hover {
    color: #e0e0e0;
    border-color: #444;
}

/* ---- Auth modal ---- */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal.hidden {
    display: none;
}

.auth-modal-inner {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 380px;
    width: 90%;
}

.auth-modal-inner h3 {
    color: #f0c040;
    margin-bottom: 16px;
}

.auth-field {
    margin-bottom: 12px;
}

.auth-field label {
    display: block;
    font-size: 0.82em;
    color: #aaa;
    margin-bottom: 4px;
}

.auth-field input {
    width: 100%;
    padding: 10px 12px;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.92em;
}

.auth-field input:focus {
    outline: none;
    border-color: #f0c040;
}

.auth-error {
    color: #e74c3c;
    font-size: 0.82em;
    min-height: 1.2em;
    margin-bottom: 8px;
}

.auth-link {
    color: #f0c040;
    cursor: pointer;
    font-size: 0.85em;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-email {
    font-size: 0.82em;
    color: #aaa;
}

.auth-google-btn {
    width: 100%;
    padding: 10px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    font-size: 0.9em;
}

.auth-google-btn:hover {
    background: #f5f5f5;
}

.auth-divider {
    text-align: center;
    color: #666;
    margin: 12px 0;
    font-size: 0.82em;
}

.auth-footer {
    text-align: center;
    margin-top: 12px;
}

/* ---- Mobile responsive layout (<=768px) ---- */
@media (max-width: 768px) {
    /* Stack sidebar above map instead of side-by-side */
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 55vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 14px;
        transition: max-height 0.3s ease;
    }

    /* Collapsed sidebar: only mode tabs visible */
    #sidebar.sidebar-collapsed {
        max-height: 60px;
        overflow: hidden;
        padding-bottom: 6px;
    }

    #sidebar.sidebar-collapsed .section,
    #sidebar.sidebar-collapsed .mode-panel,
    #sidebar.sidebar-collapsed .search-section,
    #sidebar.sidebar-collapsed .credits,
    #sidebar.sidebar-collapsed h1,
    #sidebar.sidebar-collapsed .subtitle {
        display: none;
    }

    /* Keep mode tabs visible and tappable when collapsed */
    #sidebar.sidebar-collapsed .mode-tabs {
        display: flex;
    }

    /* Map fills remaining space */
    #map {
        flex: 1;
        height: auto;
        min-height: 0;
    }

    /* Mode tabs: ensure min tap target size */
    .mode-tab {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85em;
    }

    /* Touch-friendly checkboxes and layer toggles */
    .layer-toggle {
        padding: 6px 0;
        min-height: 44px;
        gap: 10px;
    }

    .layer-toggle input[type="checkbox"],
    .layer-toggle input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    .filter-row .layer-toggle {
        padding: 4px 0;
        min-height: 40px;
    }

    .sub-toggles .layer-toggle {
        padding: 4px 0;
        min-height: 40px;
    }

    /* Prevent horizontal overflow */
    .wp-controls {
        flex-wrap: wrap;
    }

    .detail-row {
        flex-wrap: wrap;
    }

    .detail-row .dv {
        max-width: 100%;
    }

    /* Assessment panel: full width on mobile */
    #assess-panel {
        width: 100%;
        min-width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
    }

    /* Show the sidebar toggle button */
    .sidebar-toggle {
        display: block;
    }

    /* Search results: constrain height */
    .search-results {
        max-height: 200px;
    }

    /* Waypoint list: shorter on mobile */
    .wp-list {
        max-height: 120px;
    }

    /* Toast notifications: reposition for mobile */
    #toast-container {
        right: 12px;
        bottom: 70px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
    }
}

/* ---- Measure tool (Leaflet ruler) ----
   Floating pill-style tooltip rendered via L.divIcon at the last
   vertex. Uses the same gold accent (#f0c040) as the rest of the
   app so it reads as part of the interface, not a leaflet plugin. */
.measure-tooltip {
    pointer-events: none;
}
.measure-tooltip-inner {
    display: inline-block;
    background: rgba(26, 26, 26, 0.92);
    color: #f0c040;
    border: 1px solid #f0c040;
    border-radius: 10px;
    padding: 3px 9px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
/* Crosshair cursor over the map while measure mode is on — tells the
   user their clicks will add ruler vertices, not open the assessment
   panel. Applied to the Leaflet container by MeasureTool.enable(). */
.measure-active,
.measure-active .leaflet-grab,
.measure-active .leaflet-interactive {
    cursor: crosshair !important;
}

/* ---- Compliance Tracker ---- */
.compliance-select,
.compliance-date-input {
    background: #2a2a4a;
    color: #e0e0e0;
    border: 1px solid #3a3a6a;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.82em;
    width: 100%;
    margin-top: 2px;
}
.compliance-select:focus,
.compliance-date-input:focus {
    outline: none;
    border-color: #f0c040;
}
.compliance-deadline {
    margin: 4px 0;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.82em;
    line-height: 1.4;
}
.compliance-deadline.urgent   { background: #4a1010; border-left: 3px solid #e74c3c; }
.compliance-deadline.upcoming { background: #3a3a10; border-left: 3px solid #f0c040; }
.compliance-deadline.ok       { background: #1a3a1a; border-left: 3px solid #2ecc71; }
.compliance-deadline .dl-label { font-weight: 600; color: #e0e0e0; }
.compliance-deadline .dl-date  { color: #aaa; font-size: 0.9em; }
.compliance-deadline .dl-days  { float: right; font-weight: 700; }
.compliance-deadline .dl-days.urgent   { color: #e74c3c; }
.compliance-deadline .dl-days.upcoming { color: #f0c040; }
.compliance-deadline .dl-days.ok       { color: #2ecc71; }
.compliance-checklist-title {
    font-size: 0.80em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
    margin-bottom: 2px;
}
.compliance-checklist-item {
    font-size: 0.80em;
    padding: 3px 0 3px 18px;
    position: relative;
    color: #ccc;
    line-height: 1.4;
}
.compliance-checklist-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #555;
    border: 1px solid #888;
}

/* ---- Progress bar (offline download) ---- */
.progress-bar-track {
    background: #2a2a4a;
    border-radius: 4px;
    height: 6px;
    margin: 4px 0;
}
.progress-bar-fill {
    background: #f0c040;
    height: 6px;
    border-radius: 4px;
    width: 0%;
    transition: width 0.2s;
}

/* ---- Offline badge ---- */
.offline-badge {
    position: fixed;
    top: 8px;
    right: 8px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    z-index: 2000;
    pointer-events: none;
}

/* ---- Basemap "More" details element ---- */
.basemap-more {
    margin-top: 4px;
}
.basemap-more summary {
    color: #888;
    font-size: 0.82em;
    padding: 2px 0;
    list-style: none;
}
.basemap-more summary::-webkit-details-marker { display: none; }
.basemap-more[open] summary { color: #f0c040; }

/* ---- Pro feature dot ---- */
.pro-dot {
    color: #f0c040;
    font-size: 0.75em;
    margin-left: 2px;
    vertical-align: super;
}
