/* KHome Gallery Frontend Styles */
/* Version 2.0 - Fullpage.js Compatible */

/* =============================================
   RESET & BASE STYLES
   ============================================= */

.khome-wrap {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.khome-wrap *,
.khome-wrap *::before,
.khome-wrap *::after {
    box-sizing: border-box !important;
}

/* =============================================
   LAYOUT: SINGLE THUMBNAIL
   ============================================= */

.khome-thumb-container {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.khome-thumb {
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 5px !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    text-decoration: none !important;
}

.khome-thumb img {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}

/* Overlay hover effect */
.khome-thumb .khome-overlay {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0) !important;
    transition: background-color 0.3s ease !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

.khome-thumb:hover .khome-overlay {
    background-color: rgba(0, 0, 0, 0.19) !important;
}

/* Thumbnail title */
.khome-thumb-title {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%) !important;
    color: #fff !important;
    padding: 30px 15px 12px 15px !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: center !important;
    z-index: 2 !important;
    line-height: 1.4 !important;
}

/* Image count badge */
.khome-image-count {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: #fff !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    backdrop-filter: blur(5px) !important;
    transition: background 0.3s ease !important;
    z-index: 3 !important;
}

.khome-thumb:hover .khome-image-count {
    background: rgba(0, 0, 0, 0.9) !important;
}

/* Gallery icon overlay */
.khome-thumb::before {
    content: '' !important;
    display: block !important;
    background-image: url(/wp-content/uploads/2026/01/zoom-image.png) !important;
    position: absolute !important;
    opacity: 0 !important;
    transition: all .3s ease-in-out !important;
    top: 50% !important;
    left: 50% !important;
    width: 50px !important;
    height: 50px !important;
    background-size: 50px 50px !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2 !important;
}

.khome-thumb:hover::before {
    opacity: 1 !important;
}

a.khome-thumb:hover {
    background: rgb(0 0 0) !important;
}

/* Gallery icon overlay - border */
/* Dùng box-shadow thay vì ::after để scale cùng với ảnh */
.khome-thumb::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border: 1px solid #c9ab70 !important;
    opacity: 0 !important;
    transition: all .3s ease !important;
    z-index: 1 !important;
    border-radius: inherit !important;
    pointer-events: none !important;
}

.khome-thumb:hover::after {
    opacity: 1 !important;
}

/* Riêng cho thumb-small: dùng box-shadow inset để không bị lệch khi scale */
.khome-showcase .khome-thumb-small::after {
    display: none !important;
}

.khome-showcase .khome-thumb-small {
    box-shadow: inset 0 0 0 0 #c9ab70 !important;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, box-shadow 0.2s ease !important;
}

.khome-showcase .khome-thumb-small:hover {
    transform: scale(1.02) !important;
    box-shadow: inset 0 0 0 2px #c9ab70 !important;
}

/* =============================================
   LAYOUT: SHOWCASE (1 ảnh lớn + nhiều ảnh nhỏ)
   CRITICAL: Fullpage.js Compatible
   ============================================= */

.khome-showcase {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 15px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
}

/* Main image - 70% width */
.khome-showcase-main {
    display: block !important;
    flex: 0 0 70% !important;
    width: 70% !important;
    max-width: 70% !important;
    height: auto !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.khome-showcase .khome-thumb-main {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 250px !important;
    aspect-ratio: 4 / 3 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    position: relative !important;
}

.khome-showcase .khome-thumb-main img {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 20px !important;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out !important;
    will-change: opacity, transform !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* Smooth fade animation classes */
.khome-showcase .khome-thumb-main img.khome-fade-out {
    opacity: 0 !important;
    transform: scale(1.02) !important;
}

.khome-showcase .khome-thumb-main img.khome-fade-in {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Thumbs wrapper - 30% width */
.khome-showcase-thumbs-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 calc(30% - 15px) !important;
    width: calc(30% - 15px) !important;
    max-width: calc(30% - 15px) !important;
    gap: 10px !important;
    position: relative !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}

.khome-showcase-thumbs {
    display: block !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.khome-thumbs-slider {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Small thumbnails */
.khome-showcase .khome-thumb-small {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 15px !important;
    overflow: hidden !important;
    position: relative !important;
    cursor: pointer !important;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    will-change: transform, opacity !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

.khome-showcase .khome-thumb-small img {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 15px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hover đã được định nghĩa ở trên với box-shadow */

/* Active state khi click - animation nhanh hơn */
.khome-thumb-small.khome-active {
    transform: scale(0.96) !important;
    opacity: 0.6 !important;
    box-shadow: inset 0 0 0 2px #c9ab70 !important;
}

/* Navigation container */
.khome-nav-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 5px 0 !important;
    flex-shrink: 0 !important;
}

/* Navigation buttons */
.khome-nav-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border: none !important;
    border-radius: 50% !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.khome-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8) !important;
}

.khome-nav-btn:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

.khome-nav-btn svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
}

/* Hidden gallery links */
.khome-hidden-gallery {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* =============================================
   FULLPAGE.JS SPECIFIC OVERRIDES
   ============================================= */

/* Override fullpage table layout */
.fp-section .khome-wrap,
.fp-table .khome-wrap,
.fp-tableCell .khome-wrap,
.fp-slide .khome-wrap {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
}

.fp-section .khome-showcase,
.fp-table .khome-showcase,
.fp-tableCell .khome-showcase,
.fp-slide .khome-showcase {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    backface-visibility: visible !important;
}

.fp-section .khome-showcase-main,
.fp-table .khome-showcase-main,
.fp-tableCell .khome-showcase-main {
    display: block !important;
    flex: 0 0 70% !important;
    width: 70% !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fp-section .khome-showcase-thumbs-wrapper,
.fp-table .khome-showcase-thumbs-wrapper,
.fp-tableCell .khome-showcase-thumbs-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 calc(30% - 15px) !important;
    width: calc(30% - 15px) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fp-section .khome-thumb,
.fp-table .khome-thumb,
.fp-tableCell .khome-thumb {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fp-section .khome-thumb img,
.fp-table .khome-thumb img,
.fp-tableCell .khome-thumb img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fp-section .khome-thumbs-slider,
.fp-table .khome-thumbs-slider,
.fp-tableCell .khome-thumbs-slider {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.fp-section .khome-thumb-small,
.fp-table .khome-thumb-small,
.fp-tableCell .khome-thumb-small {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Disable transforms in fullpage to avoid conflicts */
.fp-section .khome-thumb:hover,
.fp-table .khome-thumb:hover,
.fp-tableCell .khome-thumb:hover {
    transform: none !important;
}

.fp-section .khome-showcase .khome-thumb-small:hover,
.fp-table .khome-showcase .khome-thumb-small:hover,
.fp-tableCell .khome-showcase .khome-thumb-small:hover {
    transform: scale(1.02) !important;
}

/* =============================================
   RESPONSIVE: TABLET
   ============================================= */

@media (max-width: 991px) {
    .khome-showcase {
        flex-direction: row !important;
        gap: 12px !important;
    }
    
    .khome-showcase-main {
        flex: 0 0 65% !important;
        width: 65% !important;
        max-width: 65% !important;
    }
    
    .khome-showcase-thumbs-wrapper {
        flex: 0 0 calc(35% - 12px) !important;
        width: calc(35% - 12px) !important;
        max-width: calc(35% - 12px) !important;
    }
    
    .khome-showcase .khome-thumb-small {
        aspect-ratio: 4 / 3 !important;
    }
}

/* =============================================
   RESPONSIVE: MOBILE
   ============================================= */

@media (max-width: 767px) {
    .khome-showcase {
        flex-direction: column !important;
        gap: 15px !important;
        min-height: auto !important;
    }
    
    .khome-showcase-main {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .khome-showcase .khome-thumb-main {
        aspect-ratio: 16 / 9 !important;
        min-height: auto !important;
    }
    
    .khome-showcase-thumbs-wrapper {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-direction: row !important;
        gap: 10px !important;
        overflow-x: auto !important;
    }
    
    .khome-showcase-thumbs {
        flex: 1 1 auto !important;
        overflow: hidden !important;
    }
    
    .khome-thumbs-slider {
        flex-direction: row !important;
        gap: 10px !important;
    }
    
    .khome-showcase .khome-thumb-small {
        flex: 0 0 100px !important;
        width: 100px !important;
        height: 70px !important;
        aspect-ratio: auto !important;
    }
    
    .khome-nav-container {
        flex-direction: row !important;
        flex-shrink: 0 !important;
    }
    
    /* Fullpage mobile */
    .fp-section .khome-showcase,
    .fp-table .khome-showcase,
    .fp-tableCell .khome-showcase {
        flex-direction: column !important;
    }
    
    .fp-section .khome-showcase-main,
    .fp-table .khome-showcase-main,
    .fp-tableCell .khome-showcase-main {
        flex: 0 0 auto !important;
        width: 100% !important;
    }
    
    .fp-section .khome-showcase-thumbs-wrapper,
    .fp-table .khome-showcase-thumbs-wrapper,
    .fp-tableCell .khome-showcase-thumbs-wrapper {
        flex: 0 0 auto !important;
        width: 100% !important;
        flex-direction: row !important;
    }
    
    .fp-section .khome-thumbs-slider,
    .fp-table .khome-thumbs-slider,
    .fp-tableCell .khome-thumbs-slider {
        flex-direction: row !important;
    }
}

/* =============================================
   SMALL MOBILE
   ============================================= */

@media (max-width: 480px) {
    .khome-showcase .khome-thumb-small {
        flex: 0 0 80px !important;
        width: 80px !important;
        height: 60px !important;
    }
    
    .khome-nav-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }
    
    .khome-nav-btn svg {
        width: 14px !important;
        height: 14px !important;
    }
}
