/**
 * Tour Map Component Styles
 * 
 * Structure:
 * 1. CSS Variables & Base
 * 2. Map Container & Loading
 * 3. Route Summary
 * 4. Map Controls (Recenter, Legend)
 * 5. InfoWindow (Google Maps popup)
 * 6. Tooltip
 * 7. Day Tabs (Multi-day tours)
 * 8. Itinerary Timeline
 * 9. Responsive Adjustments
 */

/* ====================
   1. CSS VARIABLES & BASE
   ==================== */
.tour-map-component {
    --tour-brand: #6342a6;
    --tour-brand-soft: #8475a2;
    --tour-ink: #2c3e50;
    --tour-muted: #6c757d;
}

/* ====================
   2. MAP CONTAINER & LOADING
   ==================== */
.tour-map-component .tab-content {
    padding: 12px 0 0;
}

.tour-map-layout {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.tour-map-layout > [class*="col-"] {
    padding: 0 10px;
}

.tour-map-panel {
    position: relative;
}

.tour-map-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(44, 30, 80, 0.12);
    background: #eef1f4;
}

.tour-map-component .tour-map {
    height: 520px;
    width: 100%;
    border-radius: 16px;
}

.tour-map-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--tour-brand);
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.tour-map-loading.is-hidden {
    opacity: 0;
}

.tour-map-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(99, 66, 166, 0.2);
    border-top-color: var(--tour-brand);
    border-radius: 50%;
    animation: tour-map-spin 0.7s linear infinite;
}

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

/* ====================
   3. ROUTE SUMMARY
   ==================== */
.route-summary {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 14px 12px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #8475a2 0%, #6342a6 100%);
    box-shadow: 0 6px 18px rgba(99, 66, 166, 0.28);
}

.route-summary.is-empty {
    display: none;
}

.route-summary-item {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.route-summary-item i {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
    opacity: 0.92;
}

.route-summary-label {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.route-summary-value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

/* ====================
   4. MAP CONTROLS
   ==================== */
.tour-map-recenter {
    margin: 10px;
    padding: 0 12px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: #fff;
    color: var(--tour-ink);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
}

.tour-map-recenter.is-visible {
    display: inline-flex;
}

.tour-map-recenter i {
    color: var(--tour-brand);
}

.map-legend {
    margin: 10px;
    padding: 12px 14px;
    max-width: 210px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    font-size: 12px;
    color: var(--tour-ink);
}

.map-legend-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.map-legend-item:last-child {
    margin-bottom: 0;
}

.map-legend-item img {
    width: 20px;
    height: 20px;
}

.map-legend-line {
    width: 22px;
    height: 4px;
    border-radius: 999px;
    background: var(--tour-brand);
}

/* ====================
   5. INFOWINDOW (Google Maps Popup)
   ==================== */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2) !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    max-height: none !important;
}

.gm-style .gm-style-iw-tc,
.gm-style .gm-style-iw-t::after {
    display: none;
}

.gm-style .gm-style-iw-chr {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
}

.gm-style .gm-ui-hover-effect {
    background: rgba(255, 255, 255, 0.92) !important;
    border-radius: 50%;
}

.tour-map-infowindow {
    width: 280px;
    max-width: 80vw;
    background: #fff;
}

.infowindow-image {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #e9ecef;
}

.infowindow-image.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tour-brand-soft);
    font-size: 28px;
}

.infowindow-content {
    padding: 12px 14px 14px;
}

.infowindow-category {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--tour-brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.infowindow-title {
    margin: 4px 0 6px;
    color: var(--tour-ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.infowindow-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #f4b400;
    font-size: 12px;
}

.infowindow-rating .rating-number {
    color: var(--tour-muted);
    font-weight: 600;
}

.infowindow-address {
    margin: 0 0 6px;
    color: var(--tour-muted);
    font-size: 12px;
}

.infowindow-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 10px;
    color: #495057;
    font-size: 13px;
    line-height: 1.45;
}

.infowindow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--tour-brand);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

.infowindow-btn:hover {
    background: #55358f;
    color: #fff !important;
}

/* ====================
   6. TOOLTIP
   ==================== */
.custom-tooltip {
    z-index: 10000;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(32, 24, 48, 0.92);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.custom-tooltip i {
    margin-right: 5px;
    opacity: 0.85;
}

/* ====================
   7. DAY TABS (Multi-day tours)
   ==================== */
.tour-map-component .tabs-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8475a2 0%, #6342a6 100%);
}

.tour-map-component .scroller-btn {
    width: 30px;
    height: 30px;
    margin: 8px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tour-map-component .scroller-btn.inactive {
    opacity: 0;
    pointer-events: none;
}

.tour-map-component .nav-tabs {
    display: flex;
    overflow: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    scrollbar-width: none;
}

.tour-map-component .nav-tabs::-webkit-scrollbar {
    display: none;
}

.tour-map-component .nav-tabs .tab-item {
    flex: 0 0 96px;
    padding: 14px 0;
    border-bottom: 3px solid transparent;
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}

.tour-map-component .nav-tabs .tab-item.active {
    color: #fff;
    border-bottom-color: #fff;
}

.tour-map-component .tab-pane {
    display: none;
}

.tour-map-component .tab-pane.active {
    display: block;
}

/* ====================
   8. ITINERARY TIMELINE
   ==================== */
.map-details {
    max-height: 640px;
    overflow: auto;
    padding-right: 4px;
}

.tour-map-component .schedule {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0 0 0 1.1rem;
    padding: 0;
}

/* Linha vertical dinâmica calculada via JS */
.tour-map-component .schedule::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: var(--timeline-height, 100%);
    background: #d8d0e8;
    z-index: 0;
}

.tour-map-component .schedule-item {
    position: relative;
    margin-bottom: 0.5rem;
    padding: 6px 8px 6px 2rem;
    border-radius: 10px;
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.tour-map-component .schedule-item.is-active {
    background: rgba(132, 117, 162, 0.06);
    box-shadow: 0 3px 12px rgba(99, 66, 166, 0.08);
}

.tour-map-component .schedule-item.is-final {
    margin-bottom: 0;
}

.tour-map-component .schedule-header {
    position: relative;
}

.tour-map-component .schedule-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: var(--tour-ink);
    cursor: pointer;
    padding: 2px 0;
    flex: 1;
}

.tour-map-component .dot {
    position: absolute;
    left: -3.1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.2rem;
    width: 2.2rem;
    height: 2.2rem;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, #8475a2, #6342a6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 66, 166, 0.26);
}

.tour-map-component .dot.restaurant {
    background: linear-gradient(135deg, #c56b8e, #a14a6b);
}

.tour-map-component .schedule-title h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    flex: 1;
}

.tour-map-component .schedule-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: auto;
    border-radius: 50%;
    background: rgba(99, 66, 166, 0.08);
    color: var(--tour-brand);
    font-size: 11px;
    transition: all 0.2s ease;
}

.tour-map-component .schedule-item.is-active .schedule-expand-btn {
    background: var(--tour-brand);
    color: #fff;
    transform: rotate(180deg);
}

.tour-map-component .schedule-title:hover .schedule-expand-btn {
    background: var(--tour-brand);
    color: #fff;
}

.tour-map-component .schedule-title .icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.tour-map-component .schedule-content {
    margin: 0.25rem 0 0 0;
    padding-left: 0;
}

.tour-map-component .schedule-duration {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0.15rem 0 0.25rem;
    color: var(--tour-muted);
    font-size: 12px;
}

.tour-map-component .schedule-duration .duration {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tour-map-component .schedule-eta {
    color: var(--tour-brand);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.tour-map-component .schedule-leg {
    margin: 0.25rem 0;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(132, 117, 162, 0.06);
    color: var(--tour-muted);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tour-map-component .schedule-leg.is-empty {
    display: none;
}

.tour-map-component .schedule-leg i {
    opacity: 0.7;
}

.tour-map-component .schedule-details {
    display: none;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0.5rem;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.tour-map-component .schedule-details.is-open {
    display: block;
    opacity: 1;
}

.tour-map-component .schedule-details .media-body {
    margin: 0;
}

.tour-map-component .schedule-image {
    width: 100%;
    height: 7rem;
    margin: 0.5rem 0;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: #eef1f4;
}

.tour-map-component .schedule-details p {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.tour-map-component .schedule-details .btn {
    margin-top: 0.5rem;
}

.tour-map-component .schedule-trip-info {
    position: absolute;
    left: -1.1rem;
    z-index: 1;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-map-component .schedule-trip-info:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.tour-map-component .schedule-trip-info i {
    color: var(--tour-brand);
    font-size: 12px;
}

.tour-map-component .schedule-trip-info.is-end i {
    color: #28a745;
}


.tour-description {
    font-size: 15px;
    line-height: 1.75;
    color: #3d4651;
}

/* Responsive adjustments for timeline */
@media (max-width: 767.98px) {
    .tour-map-component .schedule {
        margin-left: 1rem;
    }
    
    .tour-map-component .schedule-item {
        padding-left: 1.75rem;
    }
    
    .tour-map-component .dot {
        left: -2.75rem;
        width: 2rem;
        height: 2rem;
        font-size: 12px;
    }
    
    .tour-map-component .schedule-title h2 {
        font-size: 13px;
    }
    
    .tour-map-component .schedule-image {
        height: 6rem;
    }
    
    .tour-map-component .schedule-trip-info {
        left: -1rem;
        width: 24px;
        height: 24px;
    }
}

/* ====================
   9. RESPONSIVE ADJUSTMENTS
   ==================== */
@media (max-width: 991.98px) {
    .tour-map-component .tour-map {
        height: 360px;
        border-radius: 12px;
    }

    .map-details {
        max-height: none;
        margin-top: 16px;
    }

    .route-summary {
        padding: 12px 8px;
    }

    .route-summary-value {
        font-size: 14px;
    }

    .map-legend {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .tour-map-component .tour-map {
        height: 300px;
    }

    .route-summary-label {
        font-size: 10px;
    }
}
