/* ==================== BASE CONTAINER ==================== */
.base-services {
    max-width: 1280px;
    width: 100%;
    display: flex;
    margin: 0 auto;
    flex-grow: 1;
    justify-content: center;
    box-sizing: border-box;
}

/* ==================== DESKTOP VIEW ==================== */
.services-desktop-view {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 100vh;
    gap: 1rem;
    flex-wrap: nowrap;
}

/* ==================== CATEGORIES SECTION ==================== */
.services-categories-section {
    max-width: 100%;
    min-width: 0;
    height: 100vh;
    flex-wrap: nowrap;
    overflow-y: auto;
    flex-shrink: 0;
}

.services-category-section-mobile {
    display: none;
}

/* ==================== CONTENT SECTION ==================== */
.services-content-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
}

.services-main-content {
    flex: 1;
    padding: 1.2rem;
    border-left: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.services-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
}

.services-scrollable-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.services-content-row {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 1.2rem;
    height: 100%;
    min-height: 0;
}

.services-variants-section {
    flex: 5;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.services-cart-section {
    flex: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.services-cart-section-centered {
    justify-content: center;
}

/* ==================== LOCATION BUTTON ==================== */
.location-button {
    background-color: #f2f3f5;
    cursor: pointer;
    border: 1px solid #d7d7d7;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.location-button:hover {
    background-color: #e8e9ec;
    transform: scale(1.05);
}

.location-button:active {
    transform: scale(0.98);
}

.location-button img {
    width: 24px;
    height: 24px;
}

/* Search button (same style as location button) */
.search-button {
    background-color: #f2f3f5;
    cursor: pointer;
    border: 1px solid #d7d7d7;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.search-button:hover {
    background-color: #e8e9ec;
    transform: scale(1.05);
}

.search-button:active {
    transform: scale(0.98);
}

.search-button img {
    width: 24px;
    height: 24px;
}

/* ==================== LOADING STATE ==================== */
.services-loading-state {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.services-loading-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
.services-scrollable-content::-webkit-scrollbar,
.services-cart-scrollable::-webkit-scrollbar,
.services-categories-section::-webkit-scrollbar {
    width: 6px;
}

.services-scrollable-content::-webkit-scrollbar-track,
.services-cart-scrollable::-webkit-scrollbar-track,
.services-categories-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.services-scrollable-content::-webkit-scrollbar-thumb,
.services-cart-scrollable::-webkit-scrollbar-thumb,
.services-categories-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.services-scrollable-content::-webkit-scrollbar-thumb:hover,
.services-cart-scrollable::-webkit-scrollbar-thumb:hover,
.services-categories-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ==================== CATEGORIES TAB ==================== */
.categories-tab-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: max-content;
    padding-top: 2.5rem;
}

.categories-tab-tile {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 1rem;
    box-sizing: border-box;
}

.categories-tab-tile.selected {
    color: #B704F6;
    background-color: #FBEFFF;
    border-radius: 12px;
}

.category-title {
    font-family: 'PlusJakartaSans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #424242;
    line-height: 1.3rem;
}

.category-title.selected {
    color: #B704F6;
}

/* ==================== TABLET RESPONSIVE (768px - 1020px) ==================== */
@media (max-width: 1020px) {
    .services-desktop-view {
        flex-direction: column;
        height: auto;
    }

    .services-categories-section {
        display: none;
    }

    /* FIXED: Mobile header section */
    .services-category-section-mobile {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%; /* ← IMPORTANT */
        padding: 1rem;
        gap: 1rem;
        background-color: #fff;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        box-sizing: border-box; /* ← IMPORTANT */
        overflow: hidden; /* ← IMPORTANT: Prevents overflow */
    }

    /* FIXED: Mobile header row */
    .mobile-header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
        max-width: 100%; /* ← IMPORTANT */
        box-sizing: border-box; /* ← IMPORTANT */
    }

    /* FIXED: Category tile - prevent overflow */
    .categories-tab-tile {
        flex: 1;
        min-width: 0; /* ← IMPORTANT: Allows shrinking */
        max-width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        overflow: hidden; /* ← IMPORTANT */
    }

    .category-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .services-content-section {
        flex: 1;
        min-height: auto;
        height: auto;
    }

    .services-main-content {
        padding: 1rem;
        border-left: none;
    }

    .services-cart-section {
        display: none;
    }

    .categories-tab-container {
        width: auto;
        flex: 1;
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
    }
}

/* ==================== MOBILE RESPONSIVE (max-width: 768px) ==================== */
@media (max-width: 768px) {
    .services-desktop-view {
        flex-direction: column;
        height: auto;
    }

    .services-categories-section {
        display: none;
    }

    /* FIXED: Mobile header section */
    .services-category-section-mobile {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100vw; /* ← IMPORTANT: Viewport width */
        padding: 1rem;
        gap: 1rem;
        background-color: #fff;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
        box-sizing: border-box; /* ← IMPORTANT */
        overflow: hidden; /* ← IMPORTANT */
    }

    /* FIXED: Mobile header row */
    .mobile-header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* FIXED: Category tile */
    .categories-tab-tile {
        flex: 1;
        min-width: 0; /* ← IMPORTANT */
        max-width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        overflow: hidden;
    }

    .category-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9375rem;
        max-width: 100%;
    }

    .location-button {
        width: 45px;
        height: 45px;
        flex-shrink: 0; /* ← IMPORTANT: Don't shrink */
    }

    .location-button img {
        width: 20px;
        height: 20px;
    }

        .search-button {
            width: 45px;
            height: 45px;
            flex-shrink: 0;
    }

    .search-button img {
        width: 20px;
        height: 20px;
    }

    .services-content-section {
        flex: 1;
        min-height: auto;
        height: auto;
    }

    .services-main-content {
        padding: 0.75rem;
        border-left: none;
    }

    .services-content-row {
        flex-direction: column;
        gap: 1rem;
        height: auto;
    }

    .services-variants-section {
        flex: none;
        height: auto;
        overflow: visible;
    }

    .services-cart-section {
        display: none;
    }

    .services-scrollable-content {
        height: auto;
        overflow-y: visible;
    }

        .categories-tab-container {
            padding: 0;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .services-desktop-view {
        flex-direction: column;
    }

    .services-categories-section {
        display: none;
    }

    .services-main-content {
        padding: 0;
        border: none;
    }

    .services-cart-section {
        display: none;
    }

    .services-scrollable-content {
        height: auto;
        overflow: visible;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-contrast: high) {
    .services-main-content {
        border-left-color: #000;
        border-left-width: 2px;
    }

    .location-button {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .services-loading-placeholder {
        animation: none;
        background: #f0f0f0;
    }

    .location-button,
    .categories-tab-tile {
        transition: none;
    }
}
