/* 
 * Geo Trails - Consolidated Stylesheet
 * Theme-aligned with brand colors and fonts
 */

/* =========================================================
   1. CSS Variables
   ========================================================= */
:root {
    /* Color Variables - Using theme colors */
    --gt-primary-color: var(--global-color-8, #756868);
    /* Main brand color */
    --gt-secondary-color: #f7f5f5;
    /* Light complementary color */
    --gt-text-color: #333333;
    /* Main text color */
    --gt-light-text: #ffffff;
    /* Light/contrast text color */
    --gt-border-color: #e1e1e1;
    /* Border color */

    /* Spacing Variables */
    --gt-spacing-sm: 10px;
    --gt-spacing-md: 20px;
    --gt-spacing-lg: 30px;

    /* Border Radius */
    --gt-border-radius: 8px;

    /* Transition Speed */
    --gt-transition: 0.3s ease;


    --primary-exact: #3386c8;
    --primary-darker: #296ba0;
    --primary-40darker: #1f5078;
    --primary-heading: #2f3338;
    --primary-text: #383c41;
    --secondary: #e67e22;
}

/* =========================================================
   2. Base Container Styles
   ========================================================= */
.geo-trails-container {
    /* font-family: 'Open Sans', sans-serif; */
    color: var(--gt-text-color);
    line-height: 1.6;
    margin-bottom: 50px;
}

.geo-trails-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gt-spacing-md);
}

/* =========================================================
   3. Trail Cards Grid (from geo-trails-cards.css)
   ========================================================= */
.geo-trails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

/* Trail Card - Prioritizing geo-trails-cards.css styles */
.trail-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.trail-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Trail Card Image - from geo-trails-cards.css */
.trail-card .trail-image-container {
    position: relative;
    height: 225px;
    overflow: hidden;
}

.trail-card .trail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}

.trail-card:hover .trail-image {
    transform: scale(1.05);
}

/* Trail Card Content - from geo-trails-cards.css */
.trail-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* font-family: 'Open Sans', sans-serif; */
}

/* Title style with brand fonts */
.trail-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    /* color: var(--global-color-8) !important; */
    color: var(--primary-heading);
    /* font-family: 'Tinos', serif !important; */
    text-transform: uppercase;
    letter-spacing: 0.1px;
}

/* Trail Stats - from geo-trails-cards.css */
.trail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    /* font-family: 'Open Sans', sans-serif; */
}

.trail-stat {
    background-color: #f5f7fa;
    border-radius: 5px;
    padding: 5px 5px;
    font-size: 0.9rem;
    color: #555;
}

/* =========================================================
   4. Buttons (from geo-trails-cards.css - with brand colors)
   ========================================================= */
.trail-explore-btn {
    margin-top: auto;
    background-color: var(--global-color-8, #756868);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;

}

.trail-explore-btn:hover {
    background-color: var(--text-20perc-darker, #5e5354);
}


/* Keep the general button class for other buttons */
.geo-trails-button {
    background-color: var(--global-color-8, #756868);
    color: var(--gt-light-text);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color var(--gt-transition);
    display: inline-block;
    text-decoration: none;
    /* font-family: 'Open Sans', sans-serif; */
}

.geo-trails-button:hover {
    background-color: var(--text-20perc-darker, #5e5354);
    color: var(--gt-light-text);
    text-decoration: none;
}

/* =========================================================
   5. Modal Structure - CLEAN CONSOLIDATED VERSION
   ========================================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    /* High z-index to be above sticky header */
    overflow-y: auto;
    padding: 20px;
    justify-content: center;
    align-items: flex-start;
}

.modal-overlay.open {
    display: flex;
}

.modal-container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    /* Space at top to avoid sticky header */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: var(--gt-border-radius);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.4s ease;
    /* font-family: 'Open Sans', sans-serif; */
    overflow: hidden;
    /* Contains scrollable children */
}

@keyframes slideIn {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gt-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Prevent header from shrinking */
}

.modal-title {
    margin: 0;
    color: var(--primary-heading);
    font-size: 1.8rem;
    /* font-family: 'Tinos', serif; */
}


button#geo-trail-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    margin: 0;
    line-height: 1;
    color: var(--primary-darker);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

button#geo-trail-close-btn:hover {
    background-color: rgba(117, 104, 104, 0.1);
    color: var(--primary-exact);
    background-image: none;
    box-shadow: none;
}

button#geo-trail-close-btn:active {
    background-color: rgba(117, 104, 104, 0.2);
    transform: scale(0.95);
}

/* Modal body with vertical tabs */
.modal-body {
    display: flex;
    min-height: 200px;
    /* Not too tall for small content */
    max-height: calc(90vh - 100px);
    /* Account for header */
    overflow: hidden;
    flex: 1;
}

.modal-tabs {
    flex: 0 0 200px;
    background-color: #f5f5f5;
    border-right: 1px solid var(--gt-border-color);
    padding: 20px 0;
    overflow-y: auto;
    /* Allow scrolling for many tabs */
    flex-shrink: 0;
    /* Prevent shrinking */
}

.modal-tab-button {
    display: block;
    width: 100%;
    padding: 15px 25px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all var(--gt-transition);
    font-size: 1.1rem;
    color: #555;
    position: relative;
    /* font-family: 'Open Sans', sans-serif; */
}

.modal-tab-button:hover {
    background-color: #e9e9e9;
    color: var(--global-color-8, #756868);
}

.modal-tab-button.active {
    background-color: var(--primary-darker);
    color: white;
    font-weight: 600;
}

.modal-content {
    flex: 1;
    padding: 30px;
    padding-bottom: 20px;
    /* Extra space at bottom */
    overflow-y: auto;
    /* Enable scrolling for content */
    max-height: 100%;
}

.modal-tab-pane {
    display: none;
    /* Hidden by default */
    padding-bottom: 20px;
}

.modal-tab-pane.active {
    display: block;
}

/* Add space after the last element in each tab */
.modal-tab-pane>*:last-child {
    margin-bottom: 20px;
}

/* Ensure body stays fixed when modal is open */
body.modal-open {
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Responsive adjustments for modals */
@media (max-width: 768px) {
    .modal-container {
        /* margin-top: 60px; 
        max-height: calc(90vh - 60px); */

        width: 95% !important;
        /* Near full width */
        max-width: 95% !important;
        margin: 10px auto !important;
        padding: 15px !important;
        /* Reduced internal padding */
    }

    .modal-title {
        font-size: 1.4rem;
    }

    /* Adjust modal header */
    .modal-header {
        padding: 10px 5px !important;
        margin-top: 1rem;
    }

    .modal-body {
        flex-direction: column;
        /* max-height: calc(90vh - 140px); */
    }

    button#geo-trail-close-btn {
        font-size: 30px;

        padding: 5px;
        
        /* Bigger text */
        width: 2rem;
        /* Larger button */
        height: 2rem;
        /* Larger button */
        background: #f5f5f5;
        /* Light background to stand out */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        /* Subtle shadow */
        position: absolute;
        /* Position it absolutely */
        top: 5px;
        /* Move up above the modal */
        right: 5px;
        /* Move right outside the modal */
        /* border: 2px solid white; */
        border: 2px solid var(--primary-darker);
        /* White border to stand out against any background */
        z-index: 1001;
        /* Ensure it's above other modal elements */
    }

    .modal-tabs {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--gt-border-color);
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
        width: 100%;
        margin-bottom: 10px !important;
    }

    .modal-tab-button {
        padding: 8px 12px !important;
        white-space: nowrap;
        width: auto;
    }

    .modal-tab-pane {
        padding: 10px 5px !important;
    }

    .modal-close {
        padding: 10px !important;
        font-size: 32px !important;
    }

    .modal-content {
        padding: 20px 10px;

    }
}


/* =========================================================
   7. Map and Elevation Styles (from trail-map.css)
   ========================================================= */
.custom-map-container {
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
}

.map-viewport {
    border-radius: 4px;
    overflow: hidden;
    background-color: #f2f2f2;
    height: 400px;
}

.elevation-profile {
    margin-top: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
    height: 200px;
}

.position-info {
    margin-top: 10px;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    /* font-family: 'Open Sans', sans-serif; */
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    /* font-family: 'Open Sans', sans-serif; */
}

.map-error,
.elevation-error {
    padding: 1rem;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 1rem 0;
    /* font-family: 'Open Sans', sans-serif; */
}

.map-description {
    margin-top: 1rem;
    /* font-family: 'Open Sans', sans-serif; */
}

/* Custom tooltip styles for the elevation profile */
.custom-tooltip {
    background-color: rgba(255, 255, 255, 0.9) !important;
    padding: 8px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 0.9rem !important;
    /* font-family: 'Open Sans', sans-serif !important; */
}

/* =========================================================
   8. Video Styles (enhanced for iframe visibility)
   ========================================================= */
.video-container {
    position: relative;
    background-color: #000;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border-radius: var(--gt-border-radius);
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* =========================================================
   9. POI Grid (from geo-trails.css - kept as needed)
   ========================================================= */
.poi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    /* font-family: 'Open Sans', sans-serif; */
}

.poi-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: var(--gt-border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.poi-card h4 {
    /* font-family: 'Tinos', serif; */
    color: var(--global-color-8, #756868);
}

/* =========================================================
   10. Loading States (from trail-map.css)
   ========================================================= */
body.loading-modal:after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.loading-modal:before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--global-color-8, #756868);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10000;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* =========================================================
   11. Responsive Adjustments (adapted for vertical tabs)
   ========================================================= */
@media (max-width: 768px) {

    /* Card grid - from geo-trails-cards.css */
    .geo-trails-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .trail-title {
        font-size: 1.1rem;
    }

    .trail-stats {
        gap: 8px;
    }

    .trail-stat {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    /*
    .modal-body {
        flex-direction: column;
        max-height: calc(90vh - 120px);
    }
    
    .modal-tabs {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--gt-border-color);
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
    }
    
    .modal-tab-button {
        padding: 15px;
        white-space: nowrap;
        width: auto;
    }
    */

    /* Map - from trail-map.css */
    .map-viewport {
        height: 300px !important;
    }

    .elevation-profile {
        height: 150px !important;
    }

    /* Video - from both files */
    .video-container {
        height: 300px;
    }
}

@media (max-width: 480px) {

    /* From geo-trails-cards.css */
    .geo-trails-grid {
        grid-template-columns: 1fr;
    }

    .trail-card .trail-image-container {
        height: 200px;
    }

    /* From trail-map.css */
    .map-viewport {
        height: 250px !important;
    }

    .elevation-profile {
        height: 120px !important;
    }

    /*
    .modal-container {
        width: 100%;
        margin: 10px;
    }
    */
}



@media (max-width: 1024px) {
    .recharts-tooltip-wrapper {
        display: none !important;
    }
}


h1,
h2,
h3,
h4,
.trail-card h1,
.trail-card h2,
.trail-card h3,
.trail-card h4 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary-heading);
}

/*
.modal-overlay {
    z-index: 99999; 
}


.modal-container {
    margin-top: 40px; 
    max-height: calc(90vh - 40px); 
}


@media (max-width: 768px) {
    
    
    
    .modal-overlay {
        align-items: flex-start;
        padding-top: 10px;
    }
}


body.modal-open {
    position: fixed;
    width: 100%;
    height: 100%;
}
*/

/* Enhanced Gallery Grid Styles */
.trail-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Larger thumbnails */
    gap: 15px;
    margin: 20px 0;
}

/* Gallery Item Wrapper */
.gallery-item-wrapper {
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #f8f8f8;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.gallery-item-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Thumbnail Container */
.glightbox-item {
    position: relative;
    overflow: hidden;
    display: block;
    height: 0;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

/* Thumbnail Image */
.gallery-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Hover effect for thumbnails */
.glightbox-item:hover .gallery-thumbnail {
    transform: scale(1.08); /* Slightly larger zoom effect */
}

/* Caption Styling */
.gallery-caption {
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    color: #444;
    background-color: #f8f8f8;
    border-top: 1px solid #eaeaea;
    /* font-weight: 500; */
}

/* GLightbox custom styling */
.glightbox-container {
    z-index: 99999;
}

/* GLightbox caption styling */
.gslide-description {
    background: rgba(0,0,0,0.7) !important;
}

.gslide-title {
    color: #fff !important;
    font-weight: 500 !important;
}

.gslide-desc {
    color: #eee !important;
}



/* Gallery Description Styling */
.gallery-description {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
}

.gallery-description h3,
.gallery-description h4 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.gallery-description p {
    font-size: 15px;
    line-height: 1.5;
    color: #666;
    margin-bottom: 10px;
}

.gallery-description p:last-child {
    margin-bottom: 0;
}