/* Base styles for all elements */
*, *:before, *:after {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

:root {
    --tgs-primary: #7FBFB6;
    --tgs-primary-dark: #7FBFB6;
    --tgs-text: #666666;
    --tgs-heading: #333333;
    --tgs-border: #ffffff;
}

/* Accordion Container */
.tgs-services-container {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

/* Accordion List */
.tgs-services-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px;
    width: 100%;
}

/* Accordion Item */
.tgs-service-accordion-item {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
    transition: box-shadow 0.3s ease;
    will-change: transform, box-shadow;
    overflow: hidden;
}

.tgs-service-accordion-item.active {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Accordion Header */
.tgs-service-header {
    background-color: rgba(127, 191, 182, 0.1);
    transition: all 0.3s ease;
    border-left: 3px solid #7FBFB6;
    padding: 10px 15px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    will-change: background-color;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
}

.tgs-service-accordion-item.active .tgs-service-header {
    background-color: rgba(127, 191, 182, 0.2);
    border-left: 3px solid #7FBFB6;
}

.tgs-service-accordion-item:hover .tgs-service-header {
    background-color: rgba(127, 191, 182, 0.15);
    border-left: 3px solid #7FBFB6;
}

.tgs-service-header .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #7FBFB6;
}

.tgs-service-accordion-item .tgs-service-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #e7bd69 !important;
    text-transform: uppercase;
    flex: 1;
    padding-right: 24px;
    text-align: center;
    font-family: Arial, sans-serif;
}

/* Accordion Toggle Icon */
.tgs-accordion-icon {
    font-size: 20px;
    position: absolute;
    right: 15px;
    transition: transform 0.3s ease;
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7FBFB6;
}

.tgs-service-accordion-item.active .tgs-accordion-icon {
    transform: rotate(180deg);
}

/* Accordion Content */
.tgs-service-accordion-content {
    display: none;
    background-color: #fff;
    will-change: height, opacity;
    transform-origin: top center;
    opacity: 0;
    height: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.tgs-service-accordion-item.active .tgs-service-accordion-content {
    display: flex;
    flex-wrap: wrap;
    opacity: 1;
    height: auto;
}

/* Media Column */
.tgs-media-column {
    width: 100%;
    margin-bottom: 1rem;
}

/* Content Column */
.tgs-content-column {
    width: 100%;
}

/* Media container */
.tgs-service-media {
    position: relative;
    padding-top: 56.25%;
    margin: 0;
    border-radius: 0;
    background: #f5f5f5;
    overflow: hidden;
}

.tgs-service-media img,
.tgs-service-media video,
.tgs-service-media iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.tgs-service-media .video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.tgs-service-media .video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.tgs-service-media .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tgs-service-media .play-button .dashicons {
    width: 30px;
    height: 30px;
    font-size: 30px;
    color: var(--tgs-primary);
}

.tgs-service-media .play-button:hover {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.1);
}

.tgs-service-media iframe {
    z-index: 3;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.tgs-service-media.playing iframe {
    opacity: 1;
    visibility: visible;
}

.tgs-service-media.playing .video-thumbnail,
.tgs-service-media.playing .play-button {
    opacity: 0;
    visibility: hidden;
}

/* Service Details */
.tgs-service-details {
    padding: 1rem 1rem;
    background: transparent;
}

.tgs-service-details h1 {
    color: var(--tgs-heading);
    font-size: 1.4rem;
    margin: 0 0 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    text-align: center;
    display: none;
}

.tgs-service-description {
    color: var(--tgs-text);
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Pricing Tiers */
.tgs-pricing-tiers {
    margin: 1rem auto;
    max-width: 280px;
}

.tgs-pricing-tier {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--tgs-text);
    font-size: 1rem;
}

.tgs-duration {
    color: var(--tgs-primary);
    font-weight: 600;
}

.tgs-price {
    font-weight: 500;
}

.tgs-book-now-btn {
    display: inline-block;
    background: var(--tgs-primary);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    margin: 0 auto;
    text-align: center;
    display: block;
}

.tgs-book-now-btn:hover {
    background: var(--tgs-primary-dark);
    color: white;
    text-decoration: none;
}

/* Service Type Tabs */
.tgs-service-tabs {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--tgs-border);
    padding: 1.5rem 2rem;
}

.tgs-tab-button {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--tgs-text);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -1px;
    padding: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tgs-tab-button .dashicons {
    display: none;
}

.tgs-tab-button.active {
    color: var(--tgs-primary);
    background: transparent;
    border-bottom-color: var(--tgs-primary);
}

.tgs-tab-button:hover:not(.active) {
    background: transparent;
    color: var(--tgs-primary);
}

/* Service Sections */
.tgs-services-section {
    display: none;
    padding: 2rem;
    background: #fff;
}

.tgs-services-section.active {
    display: block;
}

/* Clear floats and ensure proper spacing with content below */
.tgs-services-wrapper::after {
    content: '';
    display: table;
    clear: both;
}

/* Update the wrapper to use appropriate width on all devices */
.tgs-services-wrapper {
    max-width: 1200px;
    margin: 0 auto 4rem;
    background: #fff;
    border: 1px solid var(--tgs-border);
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Larger Desktop Screens */
@media (min-width: 1200px) {
    .tgs-services-accordion {
        max-width: 80%;
        margin: 0 auto;
    }
    
    .tgs-service-header h2 {
        font-size: 1.3rem;
    }
    
    .tgs-service-media {
        max-height: 500px;
    }
    
    .tgs-pricing-tiers {
        max-width: 350px;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .tgs-services-wrapper {
        border-radius: 0;
        border: none;
    }
    
    .tgs-service-tabs {
        padding: 1rem 0.5rem;
    }
    
    .tgs-tab-button {
        font-size: 1rem;
        padding: 0.5rem 0.5rem;
    }
    
    .tgs-service-header h2 {
        font-size: 1rem;
    }
    
    .tgs-service-media .play-button {
        width: 50px;
        height: 50px;
    }
    
    .tgs-service-media .play-button .dashicons {
        width: 25px;
        height: 25px;
        font-size: 25px;
    }
}

/* Desktop Two Column Layout */
@media (min-width: 992px) {
    .tgs-service-accordion-content {
        padding: 2rem;
    }
    
    .tgs-service-media {
        padding-top: 56.25%;
        height: auto;
        min-height: auto;
        max-height: none;
        border-radius: 6px;
        overflow: hidden;
        position: relative;
        margin-bottom: 1.5rem;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    }
    
    .tgs-service-media .video-container {
        position: absolute;
        height: 100%;
        width: 100%;
    }
    
    .tgs-service-details {
        padding: 0;
        max-width: 800px;
        margin: 0 auto;
    }
    
    .tgs-service-description {
        margin-bottom: 2rem;
        font-size: 1.05rem;
        line-height: 1.8;
        text-align: justify;
    }
    
    .tgs-pricing-tiers {
        margin: 2rem auto;
        max-width: 500px;
        border-top: 1px solid rgba(0,0,0,0.05);
        padding-top: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .tgs-pricing-tier {
        margin-bottom: 1.2rem;
        padding-bottom: 0.7rem;
        border-bottom: 1px dashed rgba(0,0,0,0.05);
        font-size: 1.1rem;
    }
    
    .tgs-pricing-tier:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .tgs-duration {
        font-size: 1.1rem;
    }
    
    .tgs-price {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    .tgs-book-now-btn {
        margin: 2rem auto 1rem;
        padding: 0.9rem 3rem;
        max-width: 250px;
        font-size: 1rem;
        letter-spacing: 1px;
        border-radius: 4px;
        transition: all 0.3s ease;
    }
    
    .tgs-book-now-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    
    /* Improve active accordion item styling */
    .tgs-service-accordion-item.active {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
}

/* ==========================================
   Category Selection Styles (Updated)
   Based on thai-garden-booking styles
========================================== */

.tgs-categories-container {
    /* width: 100%; */ /* Let wrapper control width */
    max-width: 100%;
    margin: 0 0 30px 0;
    padding: 0;
    box-sizing: border-box;
}

.tgs-categories-container h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    color: var(--tgs-text-color, #333);
}

/* Use grid for category cards */
.tgs-categories-grid {
    display: grid; /* Ensure grid is used */
    /* From Booking Plugin: repeat(auto-fill, minmax(250px, 1fr)) */
    /* Using previous responsive approach which might be better here */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Individual Category Card - Styles from .category-card */
.tgs-category-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    /* aspect-ratio: 1 / 1; */ /* Remove fixed aspect ratio from previous attempt */
    overflow: hidden; /* Keep overflow hidden */
    position: relative; /* Keep relative */
    text-align: center; /* Ensure text is centered */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
}

/* Category Image Section - Styles from .category-image */
.tgs-category-image {
    width: 100%;
    /* height: 200px; */ /* Let's make it responsive instead */
    aspect-ratio: 16 / 9; /* Common aspect ratio for images */
    background-size: cover;
    background-position: center;
    border-radius: 4px; /* Match booking style */
    margin-bottom: 15px;
    /* background-image is set inline */
}

/* Category Title Section - Styles from .category-title */
.tgs-category-title {
    margin-top: 0;
    color: #333; /* Use booking color */
    font-size: 1.1em; /* Use booking size */
    font-weight: 600; /* Use booking weight */
    text-align: center;
    line-height: 1.3;
    margin-bottom: 10px;
    /* Ensure it doesn't take extra margin if image is missing */
    margin-top: 0; 
}

/* Adjust title margin if image is present */
.tgs-category-card:has(.tgs-category-image) .tgs-category-title {
    margin-top: 0; /* Title directly below image */
}

/* Hover and Active States - From .category-card */
.tgs-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #ccc; /* Use booking hover border */
}

/* Keep the active style simple */
.tgs-category-card.active {
    /* Using a simpler active state from previous TGS style - booking style might be too subtle */
    border-color: var(--tgs-primary-color, #4CAF50);
    background-color: rgba(var(--tgs-primary-color-rgb, 76, 175, 80), 0.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(0);
}

/* Hide empty cards (from booking style) */
.tgs-category-card:empty {
    display: none;
}

/* Responsive Adjustments (Merging booking plugin media queries) */
@media (max-width: 1200px) {
    .tgs-categories-grid {
        /* gap: 18px; */ /* Using existing 15px gap */
        gap: 15px;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 992px) {
    .tgs-categories-grid {
        /* gap: 15px; */
        /* grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); */
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 768px) {
     .tgs-categories-container h3 {
        font-size: 1.3em;
     }
     .tgs-category-title {
        font-size: 1em; /* Adjust title size for smaller screens */
     }
     .tgs-category-image {
        aspect-ratio: 1 / 1; /* Square image on smaller screens */
     }
     .tgs-categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
     }
}

@media (max-width: 576px) {
    .tgs-categories-grid {
        /* grid-template-columns: 1fr; */ /* Keep 2 columns for better grid */
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
    .tgs-category-image {
        /* height: 150px; */ /* Use aspect ratio */
    }
}

/* ==========================================
   CSS Variables for Colors 
========================================== */

.tgs-services-wrapper {
    /* Define CSS variables based on data attributes */
    --tgs-primary-color: var(--tgs-primary-color-val, #4CAF50);
    --tgs-secondary-color: var(--tgs-secondary-color-val, #45a049);
    --tgs-text-color: var(--tgs-text-color-val, #333);
    
    /* Generate RGB versions for rgba() usage if possible */
    /* Note: This might require JS if colors are highly dynamic */
    /* Example fallback RGB values: */
    --tgs-primary-color-rgb: 76, 175, 80; 
    --tgs-secondary-color-rgb: 69, 160, 73;
}

/* ==========================================
   Back Button Styles
========================================== */

.tgs-back-btn {
    display: inline-flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 5px; /* Space between icon and text */
    padding: 8px 15px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--tgs-text-color, #333);
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    text-decoration: none; /* Remove underline if it appears */
}

.tgs-back-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.tgs-back-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
    color: var(--tgs-text-color, #333);
} 