/* 🎨 Banner Section Fix CSS */
/* แก้ไขปัญหาการแสดงผลของ Banner sections ใน desktop */

/* === BANNER SECTIONS GENERAL STYLES === */
.homepage-section[data-section-type*="banner"] .hero-item-col,
#section-wrapper-39 .hero-item-col {
    margin-bottom: 1rem;
}

/* === BANNER IMAGE CONTAINER === */
.homepage-section[data-section-type*="banner"] .hero-item-image-wrapper,
#section-wrapper-39 .hero-item-image-wrapper {
    width: 100%;
    height: auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.homepage-section[data-section-type*="banner"] .hero-item-image-wrapper:hover,
#section-wrapper-39 .hero-item-image-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* === BANNER IMAGES === */
.homepage-section[data-section-type*="banner"] img.img-fluid,
#section-wrapper-39 img.img-fluid {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.3s ease !important;
    border-radius: 8px !important;
}

/* === DESKTOP RESPONSIVE === */
@media (min-width: 992px) {
    /* Large Desktop - 2 columns for Banner 2Column */
    .homepage-section[data-section-type*="banner"] .col-md-6,
    #section-wrapper-39 .col-md-6 {
        flex: 0 0 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
        margin: 0 0.5rem 1rem 0.5rem;
    }
    
    /* Banner images in desktop */
    .homepage-section[data-section-type*="banner"] img.img-fluid,
    #section-wrapper-39 img.img-fluid {
        aspect-ratio: 2/1 !important;
        object-fit: cover !important;
        object-position: center !important;
        min-height: 200px !important;
        max-height: 300px !important;
    }
    
    /* Banner container adjustments */
    .homepage-section[data-section-type*="banner"] .hero-item-image-wrapper,
    #section-wrapper-39 .hero-item-image-wrapper {
        aspect-ratio: 2/1 !important;
        height: auto !important;
        min-height: 200px !important;
        max-height: 300px !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    /* Medium Desktop/Tablet - adjust for better spacing */
    .homepage-section[data-section-type*="banner"] .col-md-6,
    #section-wrapper-39 .col-md-6 {
        flex: 0 0 calc(50% - 0.75rem);
        max-width: calc(50% - 0.75rem);
        margin: 0 0.375rem 1rem 0.375rem;
    }
    
    .homepage-section[data-section-type*="banner"] img.img-fluid,
    #section-wrapper-39 img.img-fluid {
        aspect-ratio: 2.2/1 !important;
        min-height: 180px !important;
        max-height: 250px !important;
    }
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 767px) {
    /* Mobile - 3 columns grid layout */
    .homepage-section[data-section-type*="banner"] .row,
    #section-wrapper-39 .row {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }
    
    .homepage-section[data-section-type*="banner"] .col-md-6,
    #section-wrapper-39 .col-md-6 {
        flex: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .homepage-section[data-section-type*="banner"] img.img-fluid,
    #section-wrapper-39 img.img-fluid {
        aspect-ratio: 1 / 1 !important;
        min-height: auto !important;
        max-height: none !important;
        object-fit: cover !important;
    }
    
    .homepage-section[data-section-type*="banner"] .hero-item-image-wrapper,
    #section-wrapper-39 .hero-item-image-wrapper {
        aspect-ratio: 1 / 1 !important;
        min-height: auto !important;
        max-height: none !important;
    }
}

/* === TEXT OVERLAY IMPROVEMENTS === */
.homepage-section[data-section-type*="banner"] .hero-item-text-overlay,
#section-wrapper-39 .hero-item-text-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    padding: 1.5rem 1rem 1rem 1rem;
    text-align: left;
    z-index: 2;
}

.homepage-section[data-section-type*="banner"] .hero-item-text-overlay h5,
#section-wrapper-39 .hero-item-text-overlay h5 {
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.homepage-section[data-section-type*="banner"] .hero-item-text-overlay p,
#section-wrapper-39 .hero-item-text-overlay p {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.95;
}

/* === LINK STYLING === */
.homepage-section[data-section-type*="banner"] .hero-item-link,
#section-wrapper-39 .hero-item-link {
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.homepage-section[data-section-type*="banner"] .hero-item-link:hover,
#section-wrapper-39 .hero-item-link:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* === SECTION CONTAINER === */
.homepage-section[data-section-type*="banner"] .row,
#section-wrapper-39 .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    align-items: stretch;
}

/* === FIX FOR SECTION ID 39 SPECIFICALLY === */
#section-wrapper-39 {
    padding: 1rem 0;
}

#section-wrapper-39 .container {
    max-width: 1200px;
    padding: 0 15px;
}

#section-wrapper-39 .row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
}

/* === LOADING STATE === */
.homepage-section[data-section-type*="banner"] img.img-fluid,
#section-wrapper-39 img.img-fluid {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.homepage-section[data-section-type*="banner"] img.img-fluid[src],
#section-wrapper-39 img.img-fluid[src] {
    background: none;
    animation: none;
}

/* === HOVER EFFECTS === */
.homepage-section[data-section-type*="banner"] .hero-item-col:hover img,
#section-wrapper-39 .hero-item-col:hover img {
    transform: scale(1.05);
}

/* === ACCESSIBILITY === */
.homepage-section[data-section-type*="banner"] .hero-item-link:focus,
#section-wrapper-39 .hero-item-link:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* === HIGH DPI DISPLAYS === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .homepage-section[data-section-type*="banner"] img.img-fluid,
    #section-wrapper-39 img.img-fluid {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* === PRINT STYLES === */
@media print {
    .homepage-section[data-section-type*="banner"],
    #section-wrapper-39 {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* === DEBUG HELPER === */
/* 
  ใช้สำหรับ debug - เพิ่ม class .debug-banner ใน HTML element เพื่อดู border
  .debug-banner .hero-item-col { border: 2px solid red !important; }
  .debug-banner img { border: 2px solid blue !important; }
*/ 