/**
 * CHS Destinations Map - Public Styles
 * Version 11.0 - Scoped CSS to prevent Elementor tab conflicts
 */

/* =====================================================
   CONTAINMENT - Prevent CSS from affecting parent elements
   ===================================================== */

/* Isolate the map wrapper completely */
.chs-map-wrapper {
    contain: layout style;
    isolation: isolate;
}

/* Reset ONLY elements inside the map wrapper - NOT parent elements */
.chs-map-wrapper,
.chs-map-wrapper *,
.chs-map-wrapper *::before,
.chs-map-wrapper *::after {
    box-sizing: border-box;
}

/* Prevent any inherited styles from Elementor tabs from being overridden */
/* This ensures we don't touch anything OUTSIDE .chs-map-wrapper */

/* =====================================================
   Brand Colors (scoped to .chs-map-wrapper)
   ===================================================== */

/* Map Container - Contained within parent */
.chs-map-wrapper {
    --chs-dark-navy: #1B365D;
    --chs-royal-blue: #008AD8;
    --chs-sky-blue: #94F0FF;
    --chs-cloud-white: #FFFFFF;
    --chs-yellow: #FFD100;
    --chs-red: #DF4661;
    --chs-pink: #DF4661;
    --chs-grey: #75787B;
    --chs-light-grey: #F6F5F5;
    --chs-border-grey: #E0E0E0;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    contain: layout style;
    isolation: isolate;
}

/* Map Header */
.chs-map-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.chs-map-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

/* Filter Controls */
.chs-filter-airline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.chs-filter-airline label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-weight: 500 !important;
    color: var(--chs-dark-navy) !important;
    font-size: 14px !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

/* Filter Dropdown */
.chs-airline-select {
    padding: 10px 35px 10px 15px !important;
    border: 1px solid var(--chs-border-grey) !important;
    border-radius: 4px !important;
    background-color: var(--chs-light-grey) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%2375787B' d='M6 8L0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 12px 8px !important;
    color: var(--chs-dark-navy) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 14px !important;
    min-width: 200px !important;
    height: 40px !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    outline: none !important;
    transition: all 0.3s ease !important;
}

/* Search Box */
.chs-map-search {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 350px;
}

.chs-search-input {
    width: 100%;
    padding: 10px 40px 10px 35px !important;
    border: 1px solid var(--chs-border-grey) !important;
    border-radius: 4px !important;
    background: var(--chs-cloud-white) !important;
    color: var(--chs-dark-navy) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 14px !important;
    height: 40px !important;
    outline: none !important;
}

/* Search icon */
.chs-map-search::before {
    content: "";
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2375787B' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

.chs-search-clear {
    position: absolute;
    right: 10px;
    background: transparent !important;
    border: none !important;
    font-size: 20px !important;
    color: var(--chs-grey) !important;
    cursor: pointer !important;
    padding: 5px !important;
    opacity: 0 !important;
    transition: opacity 0.3s !important;
}

.chs-search-input:not(:placeholder-shown) + .chs-search-clear {
    opacity: 1 !important;
}

/* Main Map Area */
.chs-map-main {
    position: relative;
    display: flex;
    height: 600px;
}

/* Map Container */
.chs-map-container {
    flex: 1;
    position: relative;
}

#chs-leaflet-map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #F5F5F5 !important; /* Light background */
}

/* No filters - CartoDB Positron tiles are already light and clean */

/* Leaflet container background */
#chs-leaflet-map .leaflet-container {
    background: #F5F5F5 !important;
}

/* Make attribution MUCH smaller and less obtrusive */
#chs-leaflet-map .leaflet-control-attribution {
    font-size: 9px !important;
    padding: 2px 5px !important;
    background: rgba(255, 255, 255, 0.7) !important;
    opacity: 0.6 !important;
    line-height: 1.2 !important;
}

#chs-leaflet-map .leaflet-control-attribution a {
    font-size: 9px !important;
}

/* Scoped attribution styles */
.chs-map-wrapper .leaflet-control-attribution {
    font-size: 9px !important;
    padding: 2px 5px !important;
    background: rgba(255, 255, 255, 0.7) !important;
    opacity: 0.7 !important;
}

.chs-map-wrapper .leaflet-control-attribution a {
    font-size: 9px !important;
}

/* Destination Markers */
.chs-destination-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.destination-marker-circle {
    width: 20px;
    height: 20px;
    background: var(--chs-pink);
    border: 2px solid var(--chs-cloud-white);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0; /* Hide any text content */
    color: transparent; /* Make any text invisible */
}

/* Airplane icon using SVG for consistency across all devices */
.destination-marker-circle::before {
    content: '';
    width: 10px;
    height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M21 16v-2l-8-5V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Selected marker - NOW LARGER */
.destination-marker-circle.selected {
    width: 32px !important;
    height: 32px !important;
    background: var(--chs-red) !important;
    border-width: 3px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
    animation: pulse 1.5s ease-in-out infinite;
}

.destination-marker-circle.selected::before {
    width: 14px !important;
    height: 14px !important;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.9; 
    }
}

/* Destination popup labels */
.destination-label {
    background: var(--chs-cloud-white) !important;
    border: 1px solid var(--chs-dark-navy) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--chs-dark-navy) !important;
    white-space: nowrap !important;
}

/* Charleston Home Marker */
.chs-home-custom-marker {
    background: transparent !important;
    border: none !important;
}

.chs-home-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chs-home-circle {
    width: 36px;
    height: 36px;
    background: var(--chs-dark-navy);
    border: 3px solid var(--chs-cloud-white);
    border-radius: 50%;
    color: var(--chs-cloud-white);
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Marker Clustering Styles */
.marker-cluster-custom {
    background: var(--chs-pink) !important;
    border: 2px solid var(--chs-cloud-white) !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--chs-cloud-white) !important;
    font-weight: bold !important;
    font-size: 14px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.marker-cluster-small {
    background-color: rgba(233, 30, 99, 0.6) !important;
}

.marker-cluster-small div {
    background-color: rgba(233, 30, 99, 0.8) !important;
}

.marker-cluster-medium {
    background-color: rgba(223, 70, 97, 0.6) !important;
}

.marker-cluster-medium div {
    background-color: rgba(223, 70, 97, 0.8) !important;
}

.marker-cluster-large {
    background-color: rgba(223, 70, 97, 0.6) !important;
}

.marker-cluster-large div {
    background-color: rgba(223, 70, 97, 0.8) !important;
}

/* Animated dashed route line */
.animated-route-line {
    animation: dashMove 2s linear infinite;
}

@keyframes dashMove {
    from {
        stroke-dashoffset: 0;
    }
    to {
        stroke-dashoffset: 20;
    }
}

/* Side Panel */
.chs-side-panel {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: var(--chs-cloud-white);
    box-shadow: -4px 0 20px rgba(27, 54, 93, 0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.chs-side-panel.open {
    right: 0;
}

/* Close Button - SQUARE not circle */
.chs-panel-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid var(--chs-dark-navy) !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 4px !important; /* Square with slight rounding */
    font-size: 16px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    color: var(--chs-dark-navy) !important;
    cursor: pointer !important;
    z-index: 1001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
}

.chs-panel-close:hover {
    background: var(--chs-dark-navy) !important;
    color: var(--chs-cloud-white) !important;
}

.chs-panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

/* Destination Header */
.destination-header {
    position: relative;
}

.destination-image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.destination-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Title Bar */
.destination-title-bar {
    background: #1B365D;
    padding: 12px 20px;
}

.title-content h2 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    color: var(--chs-cloud-white) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    line-height: 1.2 !important;
    display: inline !important;
}

.destination-state {
    font-size: 14px !important;
    opacity: 0.9 !important;
    color: var(--chs-cloud-white) !important;
    display: inline !important;
    margin-left: 0 !important;
    font-weight: 400 !important;
}

/* Content Area */
.destination-content {
    padding: 15px 20px;
}

/* ====================
   FLIGHT INFO BANNER (In white content area, not blue bar)
==================== */
.flight-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--chs-cloud-white);
    margin: -15px -20px 15px -20px; /* Extend to edges */
    border-bottom: 1px solid var(--chs-border-grey);
    color: var(--chs-dark-navy);
}

.flight-icon {
    width: 18px;
    height: 18px;
    line-height: 1;
    color: var(--chs-royal-blue);
    flex-shrink: 0;
}

.flight-text {
    font-size: 0.8125rem; /* 13px */
    font-weight: 500;
    line-height: 1.2;
    color: var(--chs-dark-navy);
}

/* ====================
   SECTION TITLES - Brandon Grotesque Typography
==================== */
.airlines-section h3,
.destination-highlights h3 {
    font-family: "Brandon Grotesque", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 1.125rem !important; /* 18px */
    font-weight: 390 !important;
    line-height: 1.6875rem !important; /* 27px */
    color: #000 !important;
    margin-bottom: 0.625rem !important; /* 10px */
    margin-top: 0 !important;
}

/* Airlines Section (Second in sidebar, after flight info) */
.airlines-section {
    margin: 15px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--chs-border-grey);
}

/* ====================
   DESTINATION HIGHLIGHTS / TAGS (Third in sidebar, after airlines)
==================== */
.destination-highlights {
    margin: 15px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--chs-border-grey);
}

.highlights-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Individual Tag Styling - SQUARE tags, no hover effects */
.highlight-tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--chs-pink);
    color: var(--chs-cloud-white);
    font-size: 0.6875rem; /* 11px */
    font-weight: 500;
    border-radius: 2px; /* Squared, minimal rounding */
    white-space: nowrap;
    cursor: default;
}

/* Destination name on hover - white box with shadow */
.chs-map-wrapper .leaflet-tooltip.destination-name-tooltip {
    background: var(--chs-cloud-white) !important;
    border: 1px solid var(--chs-border-grey) !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #000 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    white-space: nowrap !important;
}

.chs-map-wrapper .leaflet-tooltip.destination-name-tooltip:before {
    display: none !important;
}

.airlines-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Airline Row */
.airline-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.airline-logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.airline-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
}

.airline-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--chs-dark-navy);
    line-height: 1.2;
}

.airline-schedule {
    font-size: 11px;
    color: var(--chs-grey);
    line-height: 1.2;
}

/* Description */
.destination-description {
    margin: 15px 0;
    padding: 10px 0;
}

.destination-description p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--chs-grey);
    margin: 0;
}

/* Action Buttons */
.destination-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.chs-btn {
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 2px solid transparent !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    width: 100% !important;
    text-align: center !important;
}

.chs-btn-primary {
    background: var(--chs-royal-blue) !important;
    color: var(--chs-cloud-white) !important;
    border-color: var(--chs-royal-blue) !important;
}

.chs-btn-primary:hover {
    background: var(--chs-dark-navy) !important;
    border-color: var(--chs-dark-navy) !important;
}

.chs-btn-outline {
    background: var(--chs-cloud-white) !important;
    color: var(--chs-royal-blue) !important;
    border-color: var(--chs-royal-blue) !important;
}

.chs-btn-outline:hover {
    background: var(--chs-royal-blue) !important;
    color: var(--chs-cloud-white) !important;
}

/* Loading State */
.chs-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
}

.chs-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--chs-sky-blue);
    border-top-color: var(--chs-royal-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-details {
    padding: 40px;
    text-align: center;
    color: var(--chs-grey);
}

.error-message {
    padding: 40px;
    text-align: center;
    color: var(--chs-red);
}

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

/* Hide Leaflet default popups */
.chs-map-wrapper .leaflet-popup {
    display: none !important;
}

/* Fix zoom controls - PREVENT DUPLICATES AND ENSURE CORRECT SYMBOLS */
.chs-map-wrapper .leaflet-control-zoom {
    border: 1px solid var(--chs-border-grey) !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Zoom button styling */
.chs-map-wrapper .leaflet-control-zoom-in,
.chs-map-wrapper .leaflet-control-zoom-out {
    background: var(--chs-cloud-white) !important;
    color: var(--chs-dark-navy) !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-weight: bold !important;
    font-size: 0 !important; /* Hide any text content */
    text-align: center !important;
    position: relative !important;
}

.chs-map-wrapper .leaflet-control-zoom-in:hover,
.chs-map-wrapper .leaflet-control-zoom-out:hover {
    background: var(--chs-light-grey) !important;
}

.chs-map-wrapper .leaflet-control-zoom-in {
    border-bottom: 1px solid var(--chs-border-grey) !important;
}

/* Add symbols with :before instead of :after for better control */
.chs-map-wrapper .leaflet-control-zoom-in:before {
    content: '+' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: bold !important;
    color: var(--chs-dark-navy) !important;
}

.chs-map-wrapper .leaflet-control-zoom-out:before {
    content: '−' !important; /* Proper minus sign Unicode */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: bold !important;
    color: var(--chs-dark-navy) !important;
}

/* Hide any default content completely */
.chs-map-wrapper .leaflet-control-zoom-in *,
.chs-map-wrapper .leaflet-control-zoom-out * {
    display: none !important;
}

/* Hide any duplicate controls */
.chs-map-wrapper .leaflet-control-container .leaflet-top.leaflet-left .leaflet-control-zoom:not(:first-child) {
    display: none !important;
}

.chs-map-wrapper .leaflet-control-container .leaflet-control-zoom ~ .leaflet-control-zoom {
    display: none !important;
}

/* State highlighting */
.chs-map-wrapper .leaflet-interactive {
    stroke: var(--chs-dark-navy) !important;
    stroke-width: 2 !important;
    fill: var(--chs-dark-navy) !important;
    fill-opacity: 0.3 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chs-map-header {
        padding: 15px;
    }
    
    .chs-map-controls {
        flex-direction: column;
        width: 100%;
        gap: 12px; /* Slightly more space between elements on mobile */
    }
    
    /* Make airline filter full width on mobile - stack label above select */
    .chs-filter-airline {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .chs-filter-airline label {
        width: 100%;
    }
    
    .chs-airline-select {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Make search box full width on mobile */
    .chs-map-search {
        max-width: 100%;
        width: 100%;
    }
    
    .chs-side-panel {
        width: 100%;
        right: -100%;
    }
    
    .chs-side-panel.open {
        right: 0;
    }
    
    .chs-map-main {
        height: 500px;
    }
}

/* Scrollbar Styling */
.chs-panel-content::-webkit-scrollbar {
    width: 6px;
}

.chs-panel-content::-webkit-scrollbar-track {
    background: var(--chs-light-grey);
}

.chs-panel-content::-webkit-scrollbar-thumb {
    background: var(--chs-royal-blue);
    border-radius: 3px;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Force proper button display */
button.chs-panel-close {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
