/**
 * Custom Flip Box Widget CSS
 */

 .custom-flip-box-container {
    width: 100%;
    perspective: 1000px;
}

.custom-flip-box {
    position: relative;
    width: 100%;
    height: 400px;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.custom-flip-box.flipped {
    transform: rotateY(180deg);
}

/* Flip direction vertical */
.flip-direction-vertical .custom-flip-box.flipped {
    transform: rotateX(180deg);
}

.custom-flip-box-front, 
.custom-flip-box-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
}

.custom-flip-box-front {
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

.custom-flip-box-back {
    background-color: #b8860b;
    color: white;
    transform: rotateY(180deg);
    padding: 25px;
    overflow-y: auto;
}

/* Vertical flip back side */
.flip-direction-vertical .custom-flip-box-back {
    transform: rotateX(180deg);
}

/* Custom scrollbar styling */
.custom-flip-box-back.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(184, 134, 11, 0.7);
}

.custom-flip-box-back.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-flip-box-back.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(184, 134, 11, 0.7);
    border-radius: 10px;
}

.custom-flip-box-back.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.custom-image-container {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.front-layout-overlay .custom-image-container {
    height: 100%;
}

.front-layout-stacked .custom-image-container {
    flex: 1;
    height: auto;
}

.custom-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.front-layout-stacked .custom-image-container img {
    height: auto;
    max-height: 100%;
}

.custom-flip-box:hover .custom-image-container img {
    transform: scale(1.1);
}

.custom-flip-box-title {
    padding: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.front-layout-overlay .custom-flip-box-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: none;
    color: white;
}

.front-layout-stacked .custom-flip-box-title {
    position: relative;
    background: none;
    color: inherit;
    flex-shrink: 0;
}

.custom-flip-box-back h2 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.custom-flip-box-back .back-content p {
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Flip button styles */
.custom-flip-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 1000;
}

.custom-flip-button:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Arrow style icon */
.custom-flip-button span {
    border: solid #333;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(-45deg);
    transition: transform 0.3s;
}

.custom-flip-box.flipped .custom-flip-button span {
    transform: rotate(135deg);
}

/* Plus/Minus style icon */
.icon-plus span {
    width: 12px;
    height: 2px;
    background-color: #333;
    position: relative;
    border: none;
    padding: 0;
    transform: rotate(0);
}

.icon-plus span::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 12px;
    background-color: #333;
    top: -5px;
    left: 5px;
    transition: transform 0.3s;
}

.custom-flip-box.flipped .icon-plus span::after {
    transform: rotate(90deg);
    opacity: 0;
}

/* Responsive styles */
@media only screen and (max-width: 767px) {
    .custom-flip-box {
        height: 350px;
    }
    
    .custom-flip-box-title {
        font-size: 1rem;
        padding: 10px;
    }
    
    .custom-flip-box-back h2 {
        font-size: 1.1rem;
    }
    
    .custom-flip-box-back {
        padding: 15px;
    }
}

/* Lightbox icon styles */
.custom-image-container {
    position: relative; /* Ensure the container is positioned for absolute child elements */
}

.custom-lightbox-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 5; /* Ensure it’s above the image but below the flip button */
}

.custom-image-container:hover .custom-lightbox-icon {
    opacity: 1;
}

/* Lightbox icon design (magnifying glass with plus) */
.custom-lightbox-icon::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    position: relative;
}

.custom-lightbox-icon::after {
    content: '';
    width: 8px;
    height: 2px;
    background-color: #fff;
    position: absolute;
    bottom: 12px;
    right: 10px;
    transform: rotate(45deg);
}

.custom-lightbox-icon:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.custom-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2147483647 !important;
}

.custom-lightbox-overlay.show {
    opacity: 1;
}

.custom-lightbox-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 8px;
    overflow: visible;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.custom-lightbox-overlay.show .custom-lightbox-container {
    transform: scale(1);
}

.custom-lightbox-content {
    width: 100%;
    height: 100%;
    display: none;
}

.custom-lightbox-content.active {
    display: block;
}

.custom-lightbox-image {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
}

.custom-lightbox-back-content {
    padding: 40px;
    max-height: 80vh;
    overflow-y: auto;
    min-height: 400px;
}

.custom-lightbox-back-content h2 {
    margin-bottom: 20px;
    font-size: 2rem;
    color: #333;
}

.custom-lightbox-back-content .back-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #666;
}

.lightbox-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-nav-arrow.prev {
    left: -70px;
}

.lightbox-nav-arrow.next {
    right: -70px;
}

.lightbox-nav-arrow::after {
    content: '';
    border: solid #333;
    border-width: 0 3px 3px 0;
    display: inline-block;
    padding: 4px;
}

.lightbox-nav-arrow.prev::after {
    transform: rotate(135deg);
}

.lightbox-nav-arrow.next::after {
    transform: rotate(-45deg);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -20px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.lightbox-close:hover {
    background: #AE8604;
    color: white;
}

.lightbox-close::before {
    content: '×';
    color: #333;
}

.custom-lightbox-content {
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.custom-lightbox-content.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.custom-lightbox-content.slide-out-left {
    transform: translateX(-100px);
    opacity: 0;
}

.custom-lightbox-content.slide-out-right {
    transform: translateX(100px);
    opacity: 0;
}

.lightbox-nav-arrow::after {
    border-color: #333;
    transition: border-color 0.3s ease;
}

.lightbox-nav-arrow:hover::after {
    border-color: white;
}

/* Make image container clickable when lightbox is enabled */
.custom-image-container:has(.custom-lightbox-icon) {
    cursor: pointer;
}

/* Fallback for browsers that don't support :has() */
.custom-image-container .custom-lightbox-icon {
    pointer-events: none;
}

.custom-image-container:hover .custom-lightbox-icon {
    pointer-events: auto;
}

/* Responsive adjustments for smaller screens */
@media only screen and (max-width: 768px) {
    .lightbox-nav-arrow.prev {
        left: -60px;
    }
    
    .lightbox-nav-arrow.next {
        right: -60px;
    }
    
    .lightbox-close {
        top: -45px;
        right: -15px;
    }
    
    .custom-lightbox-container {
        max-width: 95%;
        margin: 0 60px; /* Add margin to prevent buttons from going off-screen */
    }
}

@media only screen and (max-width: 480px) {
    .lightbox-nav-arrow.prev {
        left: 10px;
        top: 10px;
        transform: none;
    }
    
    .lightbox-nav-arrow.next {
        right: 10px;
        top: 10px;
        transform: none;
    }
    
    .lightbox-close {
        top: 10px;
        right: 60px;
    }
    
    .custom-lightbox-container {
        margin: 0 10px;
    }
}

.lightbox-nav-arrow,
.lightbox-close {
    position: fixed !important;
    z-index: 10001 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

/* Arrows centered vertically */
.lightbox-nav-arrow.prev {
    left: 30px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.lightbox-nav-arrow.next {
    right: 30px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Close button at top-right */
.lightbox-close {
    top: 30px !important;
    right: 30px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* --- Hover Effects --- */
.lightbox-nav-arrow:hover,
.lightbox-close:hover {
    background: #AE8604 !important;
}

/* Arrow color (icon is made via borders) */
.lightbox-nav-arrow::after {
    border-color: #333 !important;
    transition: border-color 0.3s ease !important;
}

.lightbox-nav-arrow:hover::after {
    border-color: #fff !important;
}

/* Close button "×" icon */
.lightbox-close::before {
    content: '×' !important;
    color: #333 !important;
    font-size: 20px !important;
}

.lightbox-close:hover::before {
    color: #fff !important;
}

.custom-lightbox-container {
    max-width: 500px !important;  /* Fix width (adjust as needed) */
    max-height: 600px !important; /* Fix height */
    width: 90% !important;        /* Responsive on small screens */
    height: auto !important;
}

.custom-lightbox-back-content {
    padding: 20px !important;
    max-height: 400px !important; /* Scrollable area */
    overflow-y: auto !important;
    min-height: 200px !important;
    border-radius: 6px !important;
}

/* Headings */
.custom-lightbox-back-content h2 {
    font-size: 1.5rem !important;
    margin-bottom: 15px !important;
    color: #333 !important;
}


/* Scrollbar for Chrome, Edge, Safari */
.custom-lightbox-back-content::-webkit-scrollbar {
    width: 8px !important;
}

.custom-lightbox-back-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05) !important;
    border-radius: 4px !important;
}

.custom-lightbox-back-content::-webkit-scrollbar-thumb {
    background: #AE8604 !important; /* Same gold color */
    border-radius: 4px !important;
    transition: background 0.3s ease !important;
}

.custom-lightbox-back-content::-webkit-scrollbar-thumb:hover {
    background: #8a6803 !important; /* Darker gold on hover */
}
