/* === Route Map Feature Styles === */

/* Generate Route button */
.btn-generate-route {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-generate-route:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--primary-color-rgb), 0.4);
}

.btn-generate-route:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Preview container for the two pages */
.route-map-preview {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    width: 100%;
    padding: 32px 16px 0;
    margin-top: 0;
}

.route-map-preview.hidden {
    display: none;
}

.route-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 390px;
}

.route-page-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b0b0b0;
}

/* Each phone-screenshot-like page */
.route-page {
    width: 360px;
    min-height: 780px;
    background:
        radial-gradient(circle at top, rgba(var(--primary-color-rgb), 0.14), rgba(var(--primary-color-rgb), 0) 38%),
        linear-gradient(180deg, #0b0c10 0%, #07080b 100%);
    border-radius: 30px;
    overflow: hidden;
    box-shadow:
        0 28px 64px rgba(0, 0, 0, 0.55),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
}

.route-page-empty {
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #b0b0b0;
}

.empty-page-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-page-text {
    font-size: 1rem;
    font-weight: 500;
}

.route-page-app {
    padding: 0 14px 18px;
}

.route-page-stats {
    background:
        radial-gradient(circle at top, rgba(var(--primary-color-rgb), 0.12), rgba(var(--primary-color-rgb), 0) 34%),
        linear-gradient(180deg, #0b0c10 0%, #090b11 100%);
    display: flex;
    flex-direction: column;
}

.route-device-top {
    padding: 10px 2px 12px;
}

.route-statusbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    height: 34px;
    margin-bottom: 14px;
}

.route-status-time {
    color: #f5f7fa;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.route-dynamic-island {
    position: absolute;
    left: 50%;
    top: 0;
    width: 116px;
    height: 30px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: #000000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.route-status-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f5f7fa;
}

.route-status-svg {
    display: block;
    color: inherit;
}

.route-status-signal {
    width: 18px;
    height: 12px;
    fill: currentColor;
}

.route-status-wifi {
    width: 18px;
    height: 12px;
}

.route-battery-icon {
    position: relative;
    width: 24px;
    height: 12px;
    border: 1.6px solid currentColor;
    border-radius: 4px;
    box-sizing: border-box;
}

.route-battery-icon::after {
    content: '';
    position: absolute;
    right: -3.5px;
    top: 2.8px;
    width: 2px;
    height: 4px;
    border-radius: 1px;
    background: currentColor;
}

.route-battery-fill {
    position: absolute;
    left: 1.6px;
    top: 1.4px;
    width: 15px;
    height: 6px;
    border-radius: 2px;
    background: currentColor;
}

.route-app-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.route-app-eyebrow {
    color: #8a909f;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.route-app-title {
    color: #f7fafc;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.route-top-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: #dbe3ee;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.route-action-svg {
    width: 18px;
    height: 18px;
}

.route-route-meta {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.route-route-meta-chip {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.route-route-meta-label {
    color: #7f8797;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.route-route-meta-value {
    color: #f5f7fa;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-route-meta-separator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.12);
    box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.2);
}

.route-route-meta-separator svg {
    width: 16px;
    height: 16px;
}

/* Leaflet map container */
.route-map-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin: 0 2px 14px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.36);
}

#leaflet-map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #1a1a2e;
}

/* Leaflet tooltip for Start/End labels */
.route-tooltip {
    background: rgba(0, 0, 0, 0.75);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.route-tooltip::before {
    display: none;
}

/* Speed Ranges Card */
.speed-ranges-card {
    margin: 0 2px 12px;
    background: rgba(19, 22, 29, 0.94);
    border-radius: 22px;
    padding: 18px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.sr-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.route-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.12);
    box-shadow: inset 0 0 0 1px rgba(var(--primary-color-rgb), 0.16);
}

.route-card-icon svg {
    width: 16px;
    height: 16px;
}

.sr-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.sr-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sr-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sr-line {
    display: block;
    width: 34px;
    height: 4px;
    border-radius: 2px;
}

.sr-red { background: #ef4444; }
.sr-orange { background: #f59e0b; }
.sr-green { background: #22c55e; }
.sr-blue { background: #4DB8B8; }

.sr-text {
    font-size: 0.82rem;
    color: #d4d7de;
}

/* Travel Time Comparison Card */
.travel-time-card {
    margin: 0 2px 14px;
    background: rgba(19, 22, 29, 0.94);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.tt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.tt-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.tt-comparison {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tt-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tt-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.tt-label {
    font-size: 0.75rem;
    color: #8e8e93;
    font-weight: 500;
}

.tt-col-diff {
    align-items: center;
}

.tt-diff-value {
    font-size: 0.94rem;
    font-weight: 700;
    color: #22c55e;
}

.tt-diff-label {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
}

.route-page2-context {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.route-page2-logo {
    height: 24px;
    width: auto;
    max-width: 156px;
    object-fit: contain;
    opacity: 0.96;
    flex-shrink: 0;
    margin-top: 0;
}

.route-page2-summary {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.route-page2-trip {
    color: #f5f7fa;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.route-page2-meta {
    color: #8f95a2;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
}

.route-stats-card,
.route-chart-card {
    margin: 0 2px 12px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(19, 22, 29, 0.94);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.route-stats-card {
    flex: 0 0 auto;
}

.route-chart-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.route-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.route-stat-tile {
    min-width: 0;
    padding: 14px 14px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.route-stat-label {
    color: #8f95a2;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.route-stat-value {
    color: #ffffff;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.route-stat-caption {
    color: #7f8797;
    font-size: 0.66rem;
    margin-top: 6px;
    line-height: 1.35;
}

.route-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.route-card-title {
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.route-chart-subtitle {
    color: #7f8797;
    font-size: 0.7rem;
    margin-top: 4px;
}

.route-chart-shell {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
}

#p2-chart-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 148px;
    border-radius: 14px;
    background: rgba(8, 10, 14, 0.8);
}

.route-chart-labels {
    display: none;
}

.route-home-indicator {
    width: 124px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    margin: 14px auto 0;
}

/* Per-page download button */
.btn-download-page {
    width: 100%;
    max-width: 360px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download-page:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--primary-color-rgb), 0.4);
}

/* Override Leaflet styles for dark theme */
#leaflet-map .leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.5) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 8px !important;
}

#leaflet-map .leaflet-top {
    top: 14px;
}

#leaflet-map .leaflet-right {
    right: 14px;
}

#leaflet-map .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28) !important;
}

#leaflet-map .leaflet-control-zoom a {
    width: 30px;
    height: 30px;
    line-height: 30px;
    background: rgba(10, 12, 17, 0.84) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#leaflet-map .leaflet-control-attribution a {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Autocomplete dropdown */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1c1c1e;
    border-radius: 10px;
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    margin-top: 4px;
}

.autocomplete-list.hidden {
    display: none;
}

.autocomplete-item {
    padding: 10px 14px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #2a2a2e;
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #2a2a2e;
}

.autocomplete-item .ac-main {
    font-weight: 600;
    color: #ffffff;
}

.autocomplete-item .ac-sub {
    font-size: 0.75rem;
    color: #8e8e93;
    margin-top: 2px;
}

/* Responsive */
@media (max-width: 1024px) {
    .route-map-preview {
        padding: 0 8px;
    }

    .route-page {
        width: 100%;
        max-width: 360px;
    }
}
