/* ============================================================
   RADROUTEN-TRACKER – Complete Stylesheet
   Dashboard + Route Detail | Mobile-first | Dark + Glassmorphism
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --bg-dark: #0f1117;
    --bg-darker: #0a0c12;
    --bg-card: rgba(22, 27, 45, 0.85);
    --bg-card-solid: #161b2d;
    --bg-glass: rgba(30, 36, 60, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --text-primary: #eef0f6;
    --text-secondary: #8b90a5;
    --text-muted: #555a70;

    /* Stage colors */
    --color-done: #34d399;
    --color-done-glow: rgba(52, 211, 153, 0.35);
    --color-done-bg: rgba(52, 211, 153, 0.12);
    --color-pending: #f97316;
    --color-pending-glow: rgba(249, 115, 22, 0.3);
    --color-pending-bg: rgba(249, 115, 22, 0.1);

    /* Accent */
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.4);

    /* Danger */
    --danger: #ef4444;
    --danger-hover: #f87171;
    --danger-glow: rgba(239, 68, 68, 0.3);

    /* Layout */
    --stats-height: 72px;
    --progress-height: 28px;
    --sheet-peek: 140px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-height: 100px;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   DASHBOARD PAGE
   ============================================================ */

.dashboard-page {
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, #0f1117 0%, #131620 100%);
}

/* ---------- Dashboard Header ---------- */
#dashboard-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 20px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-bottom: 1px solid var(--border-glass);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
}

/* ---------- Route Grid ---------- */
#route-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 16px;
    padding-bottom: calc(90px + var(--safe-bottom));
}

@media (min-width: 500px) {
    #route-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    #route-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1100px;
        margin: 0 auto;
        padding: 24px 24px 100px;
    }
}

@media (min-width: 1200px) {
    #route-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---------- Route Card ---------- */
.route-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.35s var(--ease-out);
    position: relative;
}

.route-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.route-card:active {
    transform: translateY(-1px) scale(0.98);
}

/* Mini Map */
.route-card-map {
    width: 100%;
    height: 160px;
    position: relative;
    overflow: hidden;
    background: var(--bg-darker);
}

.route-card-map .leaflet-container {
    background: var(--bg-darker) !important;
}

/* Gradient overlay on mini map */
.route-card-map::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-card-solid));
    pointer-events: none;
    z-index: 10;
}

/* Card Content */
.route-card-body {
    padding: 14px 16px 16px;
}

.route-card-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-card-subtitle {
    font-size: 0.73rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 12px;
}

/* Card Stats Row */
.route-card-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
}

.route-card-stat {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.route-card-stat strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Card Progress Bar */
.route-card-progress {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.route-card-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--color-done), #6ee7b7);
    transition: width 0.6s var(--ease-out);
}

/* Delete Button on Card */
.route-card-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.25s;
}

.route-card:hover .route-card-delete {
    opacity: 1;
}

.route-card-delete:hover {
    background: var(--danger);
    color: #fff;
}

/* Mobile: always show delete button and make it more prominent */
@media (max-width: 768px) {
    .route-card-delete {
        opacity: 1;
        background: rgba(239, 68, 68, 0.9);
        color: #fff;
        width: 36px;
        height: 36px;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
}

/* ---------- FAB (Floating Action Button) ---------- */
#fab-add {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    right: 20px;
    z-index: 200;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px var(--accent-glow);
    transition: all 0.3s var(--ease-spring);
}

#fab-add:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px var(--accent-glow);
}

#fab-add:active {
    transform: scale(0.95);
}

/* ---------- Empty State ---------- */
#empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 32px;
    min-height: 50vh;
}

#empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

#empty-state h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
}

#empty-state p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 320px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.35s var(--ease-spring);
}

.modal-small {
    max-width: 360px;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.modal-body {
    padding: 16px 20px;
}

.modal-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 20px;
}

/* ---------- Form Elements ---------- */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.25s;
}

.form-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

.form-group input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ---------- Buttons ---------- */
.btn {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 16px var(--danger-glow);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* ============================================================
   ROUTE DETAIL PAGE
   ============================================================ */

.route-page {
    overflow: hidden;
}

/* ---------- Map ---------- */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.leaflet-tile-pane {
    filter: saturate(0.85) brightness(0.92);
}

.leaflet-container:focus {
    outline: none;
}

/* ---------- Back Button ---------- */
#back-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#back-btn:hover {
    background: rgba(40, 46, 72, 0.9);
    transform: scale(1.05);
}

/* ---------- Stats Bar ---------- */
#stats-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--stats-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 60px 0 60px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.stat-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: color 0.4s var(--ease-out);
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border-glass);
}

/* ---------- Progress Bar ---------- */
#progress-container {
    position: fixed;
    top: var(--stats-height);
    left: 0;
    right: 0;
    height: var(--progress-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
}

#progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--color-done), #6ee7b7);
    box-shadow: 0 0 12px var(--color-done-glow);
    transition: width 0.6s var(--ease-out);
}

#progress-text {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 75px;
    text-align: right;
}

/* ---------- Bottom Sheet ---------- */
#bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-top: 1px solid var(--border-glass);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(calc(100% - var(--sheet-peek)));
    transition: transform 0.45s var(--ease-out);
    max-height: calc(100vh - var(--stats-height) - var(--progress-height) - 10px);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--safe-bottom);
}

#bottom-sheet.expanded {
    transform: translateY(0);
}

#sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    touch-action: none;
}

.handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s;
}

#sheet-handle:hover .handle-bar,
#bottom-sheet.expanded .handle-bar {
    background: rgba(255, 255, 255, 0.4);
}

#sheet-header {
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--border-glass);
}

#route-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

#route-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
}

/* ---------- GPX Upload Zone ---------- */
#gpx-upload-zone {
    padding: 10px 12px 4px;
}

.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    background: rgba(255, 255, 255, 0.02);
}

.dropzone:hover, .dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.dropzone.drag-over {
    transform: scale(1.01);
    box-shadow: 0 0 24px var(--accent-glow);
}

.dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 6px;
    transition: color 0.3s;
}

.dropzone:hover .dropzone-icon,
.dropzone.drag-over .dropzone-icon {
    color: var(--accent);
}

.dropzone-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.dropzone-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Upload success flash */
.dropzone.upload-success {
    border-color: var(--color-done);
    background: var(--color-done-bg);
}

/* ---------- Stage List ---------- */
#stage-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
}

.stage-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.35s var(--ease-out);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.stage-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.stage-card:active {
    transform: scale(0.98);
}

.stage-card.completed {
    background: var(--color-done-bg);
    border-color: rgba(52, 211, 153, 0.2);
}

/* Custom Checkbox */
.stage-checkbox {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.stage-checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

.stage-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.3s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-checkbox .checkmark::after {
    content: '';
    display: block;
    width: 6px;
    height: 11px;
    border: solid transparent;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: all 0.25s var(--ease-out);
    margin-top: -2px;
}

.stage-checkbox input:checked ~ .checkmark {
    background: var(--color-done);
    border-color: var(--color-done);
    box-shadow: 0 0 14px var(--color-done-glow);
}

.stage-checkbox input:checked ~ .checkmark::after {
    border-color: #fff;
    transform: rotate(45deg) scale(1);
}

/* Stage Info */
.stage-info {
    flex: 1;
    min-width: 0;
}

.stage-name {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-card.completed .stage-name {
    color: var(--color-done);
}

.stage-meta {
    display: flex;
    gap: 12px;
    margin-top: 3px;
}

.stage-meta span {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Stage Actions (edit button) */
.stage-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.stage-edit-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.stage-edit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Stage Number Badge */
.stage-number {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 4px 8px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.stage-card.completed .stage-number {
    background: var(--color-done-bg);
    color: var(--color-done);
}

/* Empty Stages */
#empty-stages {
    padding: 24px 20px;
    text-align: center;
}

#empty-stages.hidden {
    display: none;
}

.empty-stages-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------- Remaining Stats ---------- */
#remaining-stats {
    padding: 12px 20px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 20px;
}

.remaining-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.remaining-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.remaining-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-pending);
}

/* ---------- Map Popups ---------- */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass) !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    color: var(--text-primary) !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-glass) !important;
}

.leaflet-popup-content {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.82rem !important;
    line-height: 1.5 !important;
    margin: 10px 14px !important;
}

.popup-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.popup-meta {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
    font-size: 18px !important;
}

/* ---------- Leaflet Zoom Controls ---------- */
.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-glass) !important;
    backdrop-filter: blur(12px);
}

.leaflet-control-zoom a:hover {
    background: rgba(40, 46, 72, 0.9) !important;
}

/* ---------- Animations ---------- */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px var(--color-done-glow); }
    50% { box-shadow: 0 0 20px var(--color-done-glow); }
}

.stat-value.animate {
    animation: stat-bump 0.4s var(--ease-out);
}

@keyframes stat-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.route-card {
    animation: cardAppear 0.4s var(--ease-out) both;
}

/* Stagger cards */
.route-card:nth-child(1) { animation-delay: 0s; }
.route-card:nth-child(2) { animation-delay: 0.06s; }
.route-card:nth-child(3) { animation-delay: 0.12s; }
.route-card:nth-child(4) { animation-delay: 0.18s; }
.route-card:nth-child(5) { animation-delay: 0.24s; }
.route-card:nth-child(6) { animation-delay: 0.30s; }

/* ---------- Desktop / Wide (Route Page) ---------- */
@media (min-width: 768px) {
    :root {
        --sheet-peek: 160px;
    }

    #stats-bar {
        height: 64px;
        padding: 0 70px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    #bottom-sheet {
        left: auto;
        right: 16px;
        bottom: 16px;
        width: 400px;
        border-radius: 20px;
        max-height: calc(100vh - 120px);
        transform: translateY(0);
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    }

    #bottom-sheet.expanded {
        transform: translateY(0);
    }

    #sheet-handle {
        display: none;
    }

    .stage-card {
        padding: 14px 16px;
    }
}

/* ---------- Very Small Screens ---------- */
@media (max-width: 359px) {
    .stat-icon {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 0.9rem;
    }

    #route-title {
        font-size: 1rem;
    }

    .header-title {
        font-size: 1.2rem;
    }
}

/* ---------- Scrollbar Styling ---------- */
#stage-list::-webkit-scrollbar,
.dashboard-page::-webkit-scrollbar {
    width: 4px;
}

#stage-list::-webkit-scrollbar-track,
.dashboard-page::-webkit-scrollbar-track {
    background: transparent;
}

#stage-list::-webkit-scrollbar-thumb,
.dashboard-page::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

#stage-list::-webkit-scrollbar-thumb:hover,
.dashboard-page::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---------- Mini map in cards: disable interactions ---------- */
.route-card-map .leaflet-control-zoom,
.route-card-map .leaflet-control-attribution {
    display: none !important;
}
/* ---------- Mood Selector ---------- */
.mood-selector {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
}

.mood-btn {
    background: none;
    border: none;
    font-size: 2.2rem;
    cursor: pointer;
    transition: all 0.25s var(--ease-spring);
    padding: 8px;
    border-radius: 12px;
    opacity: 0.4;
    filter: grayscale(1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
    filter: grayscale(0.5);
}

.mood-btn.active {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

/* ---------- Map Labels (Permanent) ---------- */
.stage-label {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 4px 10px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.leaflet-tooltip-pane .stage-label {
    border: 1px solid var(--color-done);
}

.stage-label mark {
    background: none;
    color: var(--color-done);
    font-weight: 800;
}

.stage-label-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stage-label-mood {
    font-size: 1.1rem;
}

.form-group.required label::after {
    content: " *";
    color: var(--danger);
}

.form-group.invalid input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-glow);
}
