﻿* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

.main-content {
    flex: 1;
    min-height: 0;
}

.trip-page {
    display: flex;
    height: 90vh;
}

#tripMap {
    width: 100%;
    height: 100%;
}

.route-panel {
    width: 420px;
    flex-shrink: 0;
    background: var(--brand);
    color: #fff;
    transition: width 0.25s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.route-collapsed .route-panel {
    width: 64px;
}

.route-panel-inner {
    width: 420px;
    padding: 1.75rem 1.5rem;
}

.route-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.route-title {
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 0 4px;
}

.route-subtitle {
    color: #b9c2d4;
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
}

.accent-amber {
    color: #f5b942;
    font-weight: 700;
}

.collapse-btn {
    background: #152548;
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.route-collapsed .route-form-body,
.route-collapsed .route-panel-header > div:first-child {
    display: none;
}

.route-collapsed .collapse-btn i {
    transform: rotate(180deg);
}

.route-summary-bar {
    display: none;
}

.panel-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 10px;
}

.panel-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 9px;
}

.range-value {
    color: #f5b942;
    font-weight: 700;
    font-size: 0.9rem;
}

.brand-range {
    accent-color: #3ea373;
}

.pill-input {
    background: #fff;
    border-radius: 22px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
}

    .pill-input input {
        border: none;
        outline: none;
        width: 100%;
        font-size: 0.9rem;
        color: var(--brand);
        background: transparent;
    }

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 31, 61, 0.25);
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
}

.autocomplete-wrap.open .autocomplete-list {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

    .autocomplete-item:hover,
    .autocomplete-item.active {
        background: #e6f4ec;
    }

    .autocomplete-item i {
        color: #8fa0c0;
        font-size: 12px;
        width: 14px;
        flex-shrink: 0;
    }

.autocomplete-primary {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand);
}

.autocomplete-secondary {
    font-size: 10.5px;
    color: #8fa0c0;
}

.icon-start {
    color: #3ea373;
    width: 12px;
    font-size: 0.9rem;
}

.icon-end {
    color: #d9534f;
    width: 12px;
    font-size: 0.9rem;
}

.stop-list {
    margin: 9px 0 9px 18px;
    padding-left: 12px;
    padding-right: 4px;
    border-left: 2px dashed #2b3f66;
    max-height: 240px;
    overflow-y: auto;
}

    .stop-list::-webkit-scrollbar {
        width: 5px;
    }

    .stop-list::-webkit-scrollbar-thumb {
        background: #2b3f66;
        border-radius: 3px;
    }

.stop-item {
    background: #1c2f57;
    border-radius: 10px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
}

.icon-stop {
    color: #f5b942;
    font-size: 0.9rem;
}

.stop-info {
    flex-grow: 1;
}

.stop-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.stop-meta {
    font-size: 0.75rem;
    color: #8fa0c0;
}

.stop-remove {
    background: none;
    border: none;
    color: #8fa0c0;
    font-size: 0.8rem;
    cursor: pointer;
}

.add-stop-btn {
    background: transparent;
    border: 1px solid #3ea373;
    color: #3ea373;
    border-radius: 20px;
    font-size: 0.9rem;
    padding: 5px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

    .add-stop-btn:hover {
        background: #3ea373;
        color: #fff;
        transform: translateY(-1px);
    }

    .add-stop-btn:active {
        transform: translateY(0);
    }

.rv-detail-row {
    display: flex;
    gap: 7px;
}

.rv-detail-input {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .rv-detail-input i {
        color: #8fa0c0;
        font-size: 0.9rem;
    }

    .rv-detail-input input {
        border: none;
        outline: none;
        width: 100%;
        font-size: 0.9rem;
        background: transparent;
        min-width: 0;
    }

.build-route-btn {
    width: 100%;
    background: #3ea373;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 11px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .build-route-btn:hover {
        background: #359065;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(62, 163, 115, 0.35);
    }

    .build-route-btn:active {
        transform: translateY(0);
        box-shadow: none;
    }

    .build-route-btn.is-loading {
        color: transparent;
        pointer-events: none;
        position: relative;
    }

        .build-route-btn.is-loading::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 18px;
            height: 18px;
            margin: -9px 0 0 -9px;
            border: 2px solid rgba(255, 255, 255, 0.4);
            border-top-color: #fff;
            border-radius: 50%;
            animation: buildRouteSpin 0.7s linear infinite;
        }

@keyframes buildRouteSpin {
    to {
        transform: rotate(360deg);
    }
}

.results-panel {
    flex-grow: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.map-container {
    flex-shrink: 0;
    height: 50vh;
    min-height: 220px;
    position: relative;
    background: #eef1f6;
}

.tabs-bar {
    flex-shrink: 0;
    display: flex;
    border-bottom: 1px solid #eef1f6;
    padding: 0 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 1rem;
    color: #8fa0c0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .tab-btn.active {
        color: var(--brand);
        border-bottom-color: #3ea373;
    }

.tab-count {
    background: #e6f4ec;
    color: #2c7a54;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.tab-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8fa0c0;
}

.tab-panels {
    flex: 1 1 0;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

.tab-panel {
    display: none;
}

    .tab-panel.active {
        display: block;
    }

.result-item {
    display: flex;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #eef1f6;
}

.result-icon {
    width: 40px;
    height: 40px;
    background: #e6f4ec;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    color: #3ea373;
}

.result-info {
    flex-grow: 1;
    min-width: 0;
}

.result-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--brand);
}

.result-meta {
    font-size: 11px;
    color: #8fa0c0;
}

.badge-discount {
    background: #fff4de;
    color: #b5820a;
    font-size: 10.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    flex-shrink: 0;
}

.direction-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f6;
}

.dir-icon {
    font-size: 0.7rem;
    margin-top: 3px;
    flex-shrink: 0;
}

    .dir-icon.start {
        color: #3ea373;
    }

    .dir-icon.turn {
        color: #8fa0c0;
        transform: rotate(90deg);
    }

    .dir-icon.stop {
        color: #f5b942;
    }

    .dir-icon.turn-alt {
        color: #8fa0c0;
        transform: rotate(90deg) scaleX(-1);
    }

    .dir-icon.end {
        color: #d9534f;
    }

.dir-text {
    font-size: 1rem;
    color: #334155;
    line-height: 1.4;
}

.dir-distance {
    color: #8fa0c0;
    font-size: 0.8rem;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 31, 61, 0.55);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

    .modal-overlay.open {
        display: flex;
    }

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 440px;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 31, 61, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0.75rem;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand);
    margin: 0;
}

.modal-close {
    background: #f2f4f8;
    border: none;
    color: var(--brand);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}

.modal-tabs {
    display: flex;
    gap: 6px;
    padding: 0 1.25rem 1rem;
}

.modal-tab-btn {
    flex: 1;
    background: #f2f4f8;
    border: none;
    border-radius: 10px;
    padding: 9px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #8fa0c0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

    .modal-tab-btn.active {
        background: #e6f4ec;
        color: #2c7a54;
    }

.modal-body {
    padding: 0 1.25rem 1.25rem;
    overflow-y: auto;
}

#stopAutocompleteWrap .autocomplete-list {
    position: static;
    box-shadow: none;
    border: 1px solid #eef1f6;
    margin-top: 8px;
    display: block;
    max-height: 260px;
}

#stopAutocompleteWrap.open .autocomplete-list {
    display: block;
}

#stopAutocompleteWrap:not(.open) .autocomplete-list {
    display: none;
}

.pill-input-modal {
    background: #f2f4f8;
}

    .pill-input-modal input {
        color: var(--brand);
    }

    .pill-input-modal i {
        color: #8fa0c0;
    }

.modal-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #8fa0c0;
}

    .modal-empty-state i {
        font-size: 22px;
        margin-bottom: 10px;
        display: inline-block;
    }

    .modal-empty-state p {
        font-size: 12.5px;
        margin: 0;
    }

    .modal-empty-state.hidden {
        display: none;
    }

.selected-stop-preview {
    display: none;
    align-items: center;
    gap: 12px;
    background: #e6f4ec;
    border: 1px solid #bfe3d1;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 12px;
}

    .selected-stop-preview.visible {
        display: flex;
    }

    .selected-stop-preview i:first-child {
        font-size: 16px;
        color: #3ea373;
        flex-shrink: 0;
    }

.selected-stop-info {
    flex-grow: 1;
    min-width: 0;
}

.selected-stop-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--brand);
}

.selected-stop-meta {
    font-size: 11px;
    color: #2c7a54;
}

.selected-stop-clear {
    background: none;
    border: none;
    color: #8fa0c0;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 1rem 1.25rem;
    border-top: 1px solid #eef1f6;
}

.btn-modal-cancel {
    background: none;
    border: 1px solid #d7dce6;
    color: var(--brand);
    border-radius: 20px;
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-confirm {
    background: #3ea373;
    border: none;
    color: #fff;
    border-radius: 20px;
    padding: 9px 20px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

    .btn-modal-confirm:disabled {
        background: #cbd3e0;
        cursor: not-allowed;
    }

    .btn-modal-confirm:not(:disabled):hover {
        background: #359065;
    }

/* stop-item icon color varies by type once added to the route panel list */
.stop-item[data-stop-type="location"] .icon-stop {
    color: #8fa0c0;
}

.route-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.route-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #b9c2d4;
    cursor: pointer;
    user-select: none;
    margin-top: 10px;
}

    .route-option input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .route-option .checkmark {
        width: 18px;
        height: 18px;
        border: 1.5px solid #3ea373;
        border-radius: 5px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: background 0.15s ease, border-color 0.15s ease;
    }

    .route-option input:checked + .checkmark {
        background: #3ea373;
    }

        .route-option input:checked + .checkmark::after {
            content: "\f00c";
            font-family: "Font Awesome 7 Pro";
            font-weight: 900;
            font-size: 10px;
            color: #fff;
        }

    .route-option input:focus-visible + .checkmark {
        outline: 2px solid #3ea373;
        outline-offset: 2px;
    }

.campground-route-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.route-list-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #8fa0c0;
}

    .route-list-empty i {
        font-size: 28px;
        margin-bottom: 10px;
        display: block;
    }

    .route-list-empty p {
        font-size: 13px;
        margin: 0;
    }

.trip-fab-group {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.save-trip-fab {
    /* remove position/bottom/right if they were set directly on this class before --
       .trip-fab-group now handles fixed positioning for both buttons */
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(15, 31, 61, 0.35);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .save-trip-fab:hover:not(:disabled) {
        background: var(--brand-dark, #0a1a30);
        transform: translateY(-2px);
        box-shadow: 0 8px 22px rgba(15, 31, 61, 0.45);
    }

    .save-trip-fab:disabled {
        background: #cbd3e0;
        cursor: not-allowed;
        box-shadow: none;
    }

.print-trip-fab {
    background: #fff;
    color: var(--brand);
    border: 1px solid #d7dce6;
    border-radius: 999px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 31, 61, 0.15);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .print-trip-fab:hover:not(:disabled) {
        background: #f2f4f8;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(15, 31, 61, 0.22);
    }

    .print-trip-fab:disabled {
        color: #cbd3e0;
        cursor: not-allowed;
        box-shadow: none;
    }

@media (max-width: 576px) {
    .trip-fab-group {
        bottom: 16px;
        right: 16px;
    }

    .save-trip-fab {
        padding: 12px;
        border-radius: 50%;
    }

        .save-trip-fab span {
            display: none;
        }
}

.save-trip-summary {
    background: #e6f4ec;
    border: 1px solid #bfe3d1;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 1rem;
}

.save-trip-summary-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: var(--brand);
}

    .save-trip-summary-row i {
        color: #3ea373;
    }

.save-trip-summary-meta {
    font-size: 11px;
    color: #2c7a54;
    margin-top: 4px;
    margin-left: 24px;
}

.save-trip-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    margin: 0 0 6px;
}

.save-trip-optional {
    font-weight: 400;
    color: #8fa0c0;
}

#saveTripModal .pill-input-modal {
    margin-bottom: 1rem;
}

.save-trip-textarea {
    width: 100%;
    background: #f2f4f8;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--brand);
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

    .save-trip-textarea:focus {
        outline: 2px solid #3ea373;
        outline-offset: 1px;
    }

@media (max-width: 900px) {

    .trip-page {
        flex-direction: column;
        height:auto;
        min-height: 100vh;
    }

    .route-panel {
        width: 100%;
        flex-shrink: 0;
    }

    .route-panel-inner {
        width: 100%;
        padding: 1rem 1.1rem;
    }

    .route-panel-header {
        display: none;
    }

    .collapse-btn {
        display: none !important;
    }

    .route-summary-bar {
        display: flex;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        background: #152548;
        border: none;
        color: #fff;
        padding: 12px 14px;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
    }

        .route-summary-bar i:first-child {
            color: #3ea373;
            margin-right: 8px;
        }

    .route-form-body {
        display: none;
        margin-top: 1rem;
    }

    .drawer-open .route-form-body {
        display: block;
    }

    .drawer-open .route-summary-bar i.fa-chevron-down {
        transform: rotate(180deg);
    }

    .map-container {
        height: 30vh;
        min-height: 180px;
    }

    .tabs-bar {
        padding: 0 1rem;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        font-size: 12.5px;
        padding: 12px 8px;
    }

    .tab-meta {
        display: none;
    }

    .results-panel {
        flex-grow: 0; 
        min-height: 0;
    }

    .tab-panels {
        flex: none; 
        padding: 1rem;
        overflow-y: visible;
    }

    .rv-detail-row {
        flex-wrap: wrap;
    }

    .rv-detail-input {
        min-width: 100px;
    }

    .campground-route-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .save-trip-fab {
        bottom: 16px;
        right: 16px;
        padding: 12px;
        border-radius: 50%;
    }

        .save-trip-fab span {
            display: none;
        }
}

.print-only {
    display: none;
}

.print-header {
    border-bottom: 2px solid #0f1f3d;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

    .print-header h1 {
        font-size: 20px;
        color: #0f1f3d;
        margin: 0 0 4px;
    }

    .print-header p {
        font-size: 13px;
        color: #334155;
        margin: 2px 0;
    }

.print-generated-date {
    font-size: 11px;
    color: #8fa0c0;
    margin-top: 6px;
}

@media print {
    .route-panel,
    .map-container,
    .tabs-bar,
    .trip-fab-group,
    .modal-overlay,
    #toast_container,
    .visited-btn,
    .favorite-btn,
    .top-bar,
    .pa-navbar,
    .pa-footer,
    .card-chevron {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .trip-page,
    .results-panel,
    .tab-panels {
        display: block;
        height: auto;
        overflow: visible;
        padding: 0;
    }

    .tab-panel {
        display: block !important; /* show campgrounds AND directions, not just whichever tab was active on screen */
    }

    #panel-directions {
        page-break-before: always;
        margin-top: 20px;
    }

    .campground-route-grid {
        display: block;
    }

    .campground-card-wrapper {
        page-break-inside: avoid;
        margin-bottom: 14px;
    }

    .direction-item {
        page-break-inside: avoid;
    }

    .trip-card-image {
        display: none;
    }
}