/**
 * CLS Optimization CSS for Doctor Directory Website
 * Prevents Cumulative Layout Shift by fixing dimensions and reserving space
 * for dynamic content, lazy-loaded images, and user interactions
 */

/* ========================================
   FONT OPTIMIZATION - Prevent Font-Related CLS
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* ========================================
   IMAGE CONTAINER SIZING
   Reserve space for lazy-loaded images
   ======================================== */

/* Doctor Profile Page - Hero/Main Image */
.doctor-main-image-container {
    width: 100%;
    margin-bottom: 20px;
}

.gallery-slider-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    container-type: inline-size;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background-color: #e9ecef;
}

/* Desktop size */
@media (min-width: 1200px) {
    .gallery-slider-container {
        min-height: 500px;
    }
}

/* Tablet size */
@media (max-width: 991px) and (min-width: 768px) {
    .gallery-slider-container {
        min-height: 400px;
    }
}

/* Mobile size */
@media (max-width: 767px) {
    .gallery-slider-container {
        min-height: 300px;
    }
}

.gallery-thumbnails {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    justify-content: center;
    min-height: 110px;
}

.gallery-thumbnail {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    background-color: #e9ecef;
}

@media (max-width: 768px) {
    .gallery-thumbnail {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
    }
}

@media (max-width: 576px) {
    .gallery-thumbnails {
        padding: 10px;
        min-height: 90px;
    }
    
    .gallery-thumbnail {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
    }
}

/* ========================================
   DOCTOR CARD IMAGES - List and Grid View
   Prevent layout shift from image loading
   ======================================== */

/* Doctor List Cards - Image Box */
.clinic-block-one .image-box,
.clinic-block-one figure.image-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background-color: #e9ecef;
    border-radius: 8px 8px 0 0;
}

.clinic-block-one .image-box img,
.clinic-block-one figure.image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #e9ecef;
}

/* Explicit height fallback for cards */
.clinic-list-content .clinic-block-one .image-box img,
.clinic-grid-content .team-block .team-block-three .image-box img {
    min-height: 245px;
}

/* Grid view team blocks */
.team-block-three .image-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background-color: #e9ecef;
}

.team-block-three .image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #e9ecef;
}

/* ========================================
   DOCTOR CARD CONTENT SECTIONS
   Reserve space for dynamic content
   ======================================== */

/* Content Box in Doctor Cards */
.clinic-block-one .content-box {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: white;
    min-height: 300px;
}

/* Like/Favorite Box - Reserve Space */
.clinic-block-one .like-box,
.team-block-three figure.image-box .like-box {
    min-height: 40px;
    margin-bottom: 10px;
}

/* Name Box - Reserve Space */
.clinic-block-one .name-box,
.team-block-three .name-box {
    margin: 10px 0 8px 0;
    min-height: 50px;
}

.clinic-block-one .name-box h3,
.team-block-three .name-box h3 {
    margin: 0;
    min-height: 28px;
    line-height: 1.4;
}

/* Designation - Reserve Space */
.clinic-block-one .designation,
.team-block-three .designation {
    display: block;
    min-height: 20px;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
}

/* Description Text - Reserve Space */
.clinic-block-one .text,
.team-block-three .lower-content .text {
    min-height: 60px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.clinic-block-one .text p,
.team-block-three .lower-content .text p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

/* Rating Box - Reserve Space */
.clinic-block-one .rating-box,
.team-block-three .rating-box {
    min-height: 30px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.clinic-block-one .rating-box .rating,
.team-block-three .rating-box .rating {
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clinic-block-one .rating-box .rating li,
.team-block-three .rating-box .rating li {
    min-width: 16px;
    min-height: 16px;
    display: flex;
    align-items: center;
}

.clinic-block-one .rating-box .rating li i,
.team-block-three .rating-box .rating li i {
    width: 16px;
    height: 16px;
    font-size: 14px;
}

.clinic-block-one .rating-box .link,
.team-block-three .rating-box .link {
    min-height: 20px;
    margin-left: auto;
}

/* Location Box - Reserve Space */
.clinic-block-one .location-box,
.team-block-three .location-box {
    min-height: 36px;
    margin-bottom: 10px;
    padding: 4px 0;
}

.clinic-block-one .location-box p,
.team-block-three .location-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clinic-block-one .location-box i,
.team-block-three .location-box i {
    margin-right: 6px;
    min-width: 14px;
}

/* Action Buttons - Reserve Space */
.clinic-block-one .btn-box,
.team-block-three .lower-box {
    min-height: 44px;
    margin-top: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.clinic-block-one .btn-box a,
.team-block-three .lower-box a {
    padding: 10px 20px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Team Block Three - Lower Content */
.team-block-three .lower-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 300px;
}

/* ========================================
   DOCTOR PROFILE PAGE - ADVANCED RESERVATIONS
   ======================================== */

/* Clinic Details Block */
.clinic-details-content .clinic-block-one {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Profile Info Box */
.clinic-details-content .clinic-block-one .content-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Name Box in Profile */
.clinic-details-content .name-box {
    min-height: 50px;
    margin-bottom: 12px;
}

.clinic-details-content .name-box h2 {
    margin: 0;
    min-height: 36px;
    line-height: 1.4;
}

/* Designation in Profile */
.clinic-details-content .designation {
    display: block;
    min-height: 22px;
    margin-bottom: 12px;
    font-size: 15px;
}

/* Profile Rating Box */
.clinic-details-content .rating-box {
    min-height: 40px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clinic-details-content .rating-box .rating {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
}

.clinic-details-content .rating-box .rating li {
    min-width: 18px;
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clinic-details-content .rating-box .rating i {
    font-size: 16px;
}

/* Profile Description Text */
.clinic-details-content .text {
    min-height: 50px;
    margin-bottom: 15px;
    line-height: 1.7;
}

.clinic-details-content .text p {
    margin: 0;
}

/* Profile Info List */
.clinic-details-content .info {
    min-height: 60px;
    margin-bottom: 15px;
}

.clinic-details-content .info li {
    min-height: 24px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons in Profile */
.clinic-details-content .btn-box,
.make-appointment-box {
    min-height: 50px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.clinic-details-content .btn-box a,
.make-appointment-box a,
.make-appointment-box button {
    padding: 12px 30px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* ========================================
   TABS AND DYNAMIC CONTENT
   ======================================== */

/* Tab Buttons - Reserve Space */
.tabs-box .tab-btn-box {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
}

.tabs-box .tab-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.tabs-box .tab-btns .tab-btn {
    min-height: 44px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tab Content Sections */
.tabs-content .tab {
    min-height: 200px;
}

.tabs-content .tab .inner-box,
.tabs-content .tab .experience-box,
.tabs-content .tab .location-box,
.tabs-content .tab .review-box {
    min-height: 150px;
}

/* ========================================
   REVIEW AND RATING SECTIONS
   Reserve space for review content
   ======================================== */

/* Rating Inner Section */
.rating-inner {
    display: flex;
    gap: 20px;
    min-height: 180px;
    margin-bottom: 20px;
}

.rating-box h2 {
    min-height: 48px;
    display: flex;
    align-items: center;
}

.rating-box .rating {
    min-height: 28px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

/* Rating Progress Bar */
.rating-pregress {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.rating-pregress .single-progress {
    min-height: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-pregress .porgress-bar {
    min-height: 8px;
    flex: 1;
}

.rating-pregress .text {
    min-width: 100px;
    min-height: 20px;
}

/* Individual Review Item */
.review-block-one {
    min-height: 120px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.review-block-one .author-info {
    min-height: 50px;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.review-block-one .author-image {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    object-fit: cover;
}

.review-block-one .author-details {
    flex: 1;
    min-height: 50px;
}

.review-block-one .author-details h4 {
    margin: 0;
    min-height: 20px;
}

.review-block-one .author-details .rating {
    min-height: 18px;
    display: flex;
    gap: 2px;
}

.review-block-one .text {
    min-height: 40px;
    line-height: 1.6;
}

/* ========================================
   APPOINTMENT SECTION
   ======================================== */

.appointment-box {
    min-height: 100px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
}

.appointment-box h4 {
    min-height: 28px;
    margin-bottom: 12px;
}

.appointment-info {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.appointment-info p {
    margin: 0;
    min-height: 20px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .gallery-slider-container {
        min-height: 300px;
    }

    .clinic-block-one .content-box {
        min-height: 280px;
    }

    .clinic-details-content .clinic-block-one {
        padding: 20px;
    }

    .rating-inner {
        flex-direction: column;
        min-height: auto;
    }

    .tabs-box .tab-btn-box {
        min-height: auto;
    }

    .tabs-box .tab-btns {
        flex-direction: column;
    }

    .tabs-box .tab-btns .tab-btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .gallery-slider-container {
        min-height: 250px;
    }

    .gallery-thumbnails {
        min-height: 80px;
    }

    .clinic-block-one .content-box {
        min-height: 250px;
        padding: 15px;
    }

    .clinic-details-content .clinic-block-one {
        padding: 15px;
    }

    .clinic-block-one .name-box h3,
    .clinic-details-content .name-box h2 {
        font-size: 16px;
    }

    .clinic-block-one .designation {
        font-size: 13px;
    }

    .rating-box {
        flex-wrap: wrap;
    }

    .clinic-block-one .btn-box,
    .team-block-three .lower-box {
        flex-direction: column;
    }

    .clinic-block-one .btn-box a,
    .team-block-three .lower-box a {
        width: 100%;
    }
}

/* ========================================
   ADDITIONAL OPTIMIZATIONS
   ======================================== */

/* Prevent layout shift from skeleton loaders */
.skeleton-loader {
    background: linear-gradient(90deg, #e9ecef 25%, #f0f3f6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Ensure proper stacking context */
.clinic-block-one,
.team-block-three,
.gallery-slider-container {
    position: relative;
    z-index: 1;
}

/* Prevent horizontal scroll shift */
html, body {
    overflow-x: hidden;
}

/* Ensure consistent scrollbar width */
::-webkit-scrollbar {
    width: 15px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 8px;
}

/* Loading states for images */
img[loading="lazy"] {
    background-color: #e9ecef;
}

/* Prevent shift from ads or dynamic content */
.ad-placeholder,
.dynamic-content-area {
    background-color: #f8f9fa;
    min-height: 250px;
    margin: 20px 0;
    border-radius: 8px;
}

/* Container queries for responsive without reflow */
@supports (container-type: inline-size) {
    .clinic-block-one,
    .team-block-three {
        container-type: inline-size;
    }
}
