/* ========================================
   KEY SERVICES MOBILE-FIRST REDESIGN
   Mobile: ≤768px (compact stacked cards with toggle)
   Desktop: >768px (side-by-side, unchanged)
======================================== */

/* ========================================
   MOBILE STYLES (≤768px)
======================================== */
@media (max-width: 768px) {
    /* Key Services Section */
    #KeyServices {
        padding: 40px 0 !important;
    }

    /* Card Grid - Vertical Stack */
    .service-card-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px 15px !important;
        max-width: 100% !important;
    }

    /* Service Cards - Compact Square Buttons */
    .service-square-card {
        min-height: 140px !important;
        max-height: 140px !important;
        padding: 25px 20px !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
    }

    .service-square-card:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 6px 20px rgba(229, 196, 102, 0.2) !important;
    }

    .service-square-card.active {
        background: linear-gradient(135deg, #e5c466 0%, #f5f5dc 100%) !important;
        box-shadow: 0 6px 24px rgba(229, 196, 102, 0.35) !important;
        transform: scale(1.02) !important;
    }

    /* Card Text */
    .service-square-card h3 {
        font-size: 17px !important;
        line-height: 1.3 !important;
        margin-bottom: 12px !important;
        font-weight: 600 !important;
    }

    /* Card Icon */
    .service-square-card .card-icon {
        width: 50px !important;
        height: 50px !important;
        margin: 0 auto !important;
    }

    .service-square-card .card-icon svg {
        width: 24px !important;
        height: 24px !important;
    }

    /* Tab Content Container */
    .tab-content {
        margin-top: 25px !important;
        overflow: hidden !important;
    }

    /* Tab Panes - Toggle Behavior */
    .tab-pane {
        display: none !important;
        opacity: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        transition: opacity 0.3s ease, max-height 0.4s ease !important;
    }

    .tab-pane.show {
        display: block !important;
        opacity: 1 !important;
        max-height: 5000px !important;
        animation: fadeInContent 0.4s ease !important;
    }

    @keyframes fadeInContent {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Content Layout - Text Before Image */
    .tab-pane .row {
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 20px !important;
    }

    /* Text Content Column */
    .tab-pane .col-md-12.col-xl-6:last-child {
        order: 1 !important;
        margin-bottom: 20px !important;
    }

    /* Text Content Styling */
    .tab-pane h5 {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #ffffff !important;
        margin-top: 15px !important;
        margin-bottom: 8px !important;
    }

    .tab-pane h5:first-child {
        margin-top: 0 !important;
    }

    .tab-pane p {
        font-size: 14px !important;
        line-height: 1.6 !important;
        color: #ffffff !important;
        margin-bottom: 12px !important;
    }

    /* Image Column - Below Text */
    .tab-pane .col-md-12.col-xl-6:first-child {
        order: 2 !important;
        margin-top: 10px !important;
    }

    /* Image - Reduced Size with Animation */
    .tab-pane img {
        width: 100% !important;
        max-width: 290px !important;
        height: auto !important;
        object-fit: cover !important;
        border-radius: 16px !important;
        margin: 0 auto !important;
        display: block !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
        animation: slideUpImage 0.5s ease-out !important;
    }

    /* Image Slide Up Animation */
    @keyframes slideUpImage {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Active Image Enhancement */
    .tab-pane.show.active img {
        animation: slideUpImage 0.5s ease-out !important;
    }

    /* Ensure no horizontal scroll */
    .tab-pane .row,
    .tab-pane .col-md-12,
    .tab-pane .col-xl-6 {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
}

/* ========================================
   EXTRA SMALL MOBILE (≤575px)
======================================== */
@media (max-width: 575px) {
    .service-square-card {
        min-height: 130px !important;
        max-height: 130px !important;
        padding: 20px 15px !important;
    }

    .service-square-card h3 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    .service-square-card .card-icon {
        width: 45px !important;
        height: 45px !important;
    }

    .service-square-card .card-icon svg {
        width: 22px !important;
        height: 22px !important;
    }

    .tab-pane img {
        max-width: 280px !important;
        border-radius: 12px !important;
    }

    .tab-pane h5 {
        font-size: 15px !important;
    }

    .tab-pane p {
        font-size: 13px !important;
    }
}

/* ========================================
   DESKTOP STYLES (>768px) - UNCHANGED
   Keep existing behavior from wellness-theme.css
======================================== */
@media (min-width: 769px) {
    /* Desktop maintains original 2-column grid layout */
    .service-card-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Desktop cards keep original sizing */
    .service-square-card {
        min-height: 240px !important;
    }

    /* Desktop tab content keeps original layout */
    .tab-pane .row {
        display: flex !important;
        flex-direction: row !important;
    }

    /* Desktop images keep original size */
    .tab-pane img {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* No animation on desktop */
    .tab-pane img {
        animation: none !important;
    }
}
