/* ==================== CSS VARIABLES ==================== */
:root {
    --icg-primary: #0c1e7f;
    --icg-secondary: #612897;
    --icg-gold: #e3b534;
    --icg-dark: #2C2C2C;
    --icg-darker: #1a1a1a;
    --icg-gray: #444444;
    --icg-light-gray: #666666;
    --icg-border-radius: 15px;
    --icg-transition: all 0.3s ease;
}

/* ==================== BASE STYLES ==================== */
.imaginarium-carousel-gallery * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.imaginarium-carousel-gallery {
    width: 100%;
}

.icg-container {
    width: 100%;
    margin: 0 auto;
}

/* ==================== SINGLE ITEM STYLES ==================== */
.icg-single-item {
    width: 100%;
    cursor: pointer;
    transition: var(--icg-transition);
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.icg-single-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.icg-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.icg-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.8s ease;
    transform-origin: center;
}

.icg-single-item:hover .icg-img {
    transform: scale(1.08);
}

/* ALWAYS VISIBLE OVERLAY WITH TITLE */
.icg-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    padding: 35px 0px 20px;
    color: white;
    transform: translateY(0);
    transition: transform 0.4s ease;
    opacity: 1;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.icg-item-title {
    font-size: 20px !important;
    font-weight: 600 !important;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 1;
    transform: translateY(0);
    text-transform: uppercase;
}

.icg-item-description {
    font-size: 1.1rem;
    opacity: 0.9;
    text-align: center;
    margin-bottom: 15px;
    opacity: 0.9;
    transform: translateY(0);
}

/* Icon-only button, only visible on hover */
.icg-open-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--icg-gold);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50% !important;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--icg-transition);
    opacity: 0;
    visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    padding: 0 !important;
}

.icg-single-item:hover .icg-open-btn {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.icg-open-btn:hover {
    background: #d1a42f;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.icg-open-btn i {
    font-size: 1.3rem;
}

/* Zoom overlay effect */
.icg-zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 44, 44, 0.4);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 12px;
}

.icg-single-item:hover .icg-zoom-overlay {
    opacity: 1;
}

/* ==================== POPUP CAROUSEL ==================== */
.icg-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.icg-popup.active {
    display: flex;
}

/* UPDATED POPUP CONTAINER - FIXED RESPONSIVE ISSUES */
.icg-popup-container {
    width: 95%;
    max-width: 1400px;
    height: auto;
    min-height: 500px;
    max-height: 95vh;
    background-color: var(--icg-dark);
    border-radius: var(--icg-border-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: fadeInZoom 0.4s ease-out;
}

/* ==================== DESKTOP LAYOUT (993px and above) ==================== */
@media (min-width: 993px) {
    .icg-popup-container {
        width: 90%;
        max-height: 90vh;
        flex-direction: row;
    }
    
    .icg-main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: var(--icg-dark);
        min-height: 600px;
    }
    
    .icg-sidebar-container {
        width: 200px;
        background-color: var(--icg-darker);
        border-left: 1px solid var(--icg-gray);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex-shrink: 0;
    }
    
    .icg-sidebar-title {
        display: none;
        padding: 15px 20px;
        background-color: var(--icg-gold);
        color: white;
        font-weight: 600;
        text-align: center;
        text-transform: uppercase;
        font-size: 0.9rem;
        letter-spacing: 1px;
    }
    
    .icg-sidebar {
        flex: 1;
        padding: 20px 15px;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        gap: 12px;
        align-items: center;
        background-color: var(--icg-darker);
    }
    
    .icg-thumb {
        width: 100%;
        height: 100px;
        min-height: 100px;
        border-radius: 8px;
        overflow: hidden;
        cursor: pointer;
        opacity: 0.6;
        transition: var(--icg-transition);
        border: 3px solid transparent;
        position: relative;
        flex-shrink: 0;
    }
    
    .icg-thumb:hover,
    .icg-thumb.active {
        opacity: 1;
        transform: scale(1.05);
        border-color: var(--icg-gold);
    }
    
    .icg-thumb-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .icg-thumb:hover .icg-thumb-img {
        transform: scale(1.1);
    }
    
    /* Desktop scrollbar for sidebar */
    .icg-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .icg-sidebar::-webkit-scrollbar-track {
        background: var(--icg-gray);
        border-radius: 3px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb {
        background: var(--icg-gold);
        border-radius: 3px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb:hover {
        background: #d1a42f;
    }
    
    .icg-nav {
        position: absolute;
        top: 50%;
        left: 0;
        right: 200px; /* Account for sidebar width */
        display: flex;
        justify-content: space-between;
        padding: 0 15px;
        transform: translateY(-50%);
        z-index: 2;
    }
}

/* ==================== TABLET LAYOUT (769px to 992px) ==================== */
@media (min-width: 769px) and (max-width: 992px) {
    .icg-popup-container {
        width: 90%;
        max-height: 95vh;
        flex-direction: column;
    }
    
    .icg-main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: var(--icg-dark);
        min-height: 400px;
        order: 1;
    }
    
    .icg-sidebar-container {
        width: 100%;
        background-color: var(--icg-darker);
        border-top: 1px solid var(--icg-gray);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex-shrink: 0;
        order: 2;
        height: 120px;
    }
    
    .icg-sidebar-title {
        display: none;
        padding: 10px 15px;
        background-color: var(--icg-gold);
        color: white;
        font-weight: 600;
        text-align: center;
        text-transform: uppercase;
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }
    
    .icg-sidebar {
        padding: 15px 10px;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        flex-direction: row;
        gap: 10px;
        align-items: center;
        height: 100%;
        background-color: var(--icg-darker);
        scrollbar-width: thin;
        scrollbar-color: var(--icg-gold) var(--icg-gray);
    }
    
    .icg-thumb {
        width: 120px;
        height: auto;
        min-width: 120px;
        border-radius: 8px;
        overflow: hidden;
        cursor: pointer;
        opacity: 0.6;
        transition: var(--icg-transition);
        border: 2px solid transparent;
        position: relative;
        flex-shrink: 0;
    }
    
    .icg-thumb:hover,
    .icg-thumb.active {
        opacity: 1;
        transform: scale(1.05);
        border-color: var(--icg-gold);
    }
    
    .icg-thumb-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .icg-thumb:hover .icg-thumb-img {
        transform: scale(1.1);
    }
    
    .icg-nav {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
        transform: translateY(-50%);
        z-index: 2;
    }
    
    /* Tablet scrollbar for horizontal thumbnails */
    .icg-sidebar::-webkit-scrollbar {
        height: 6px;
    }
    
    .icg-sidebar::-webkit-scrollbar-track {
        background: var(--icg-gray);
        border-radius: 3px;
        margin: 0 10px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb {
        background: var(--icg-gold);
        border-radius: 3px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb:hover {
        background: #d1a42f;
    }
}

/* ==================== MOBILE LAYOUT (768px and below) ==================== */
@media (max-width: 768px) {
    .icg-popup {
        padding: 10px;
    }
    
    .icg-popup-container {
        width: 100%;
        max-height: 95vh;
        flex-direction: column;
        min-height: 400px;
    }
    
    .icg-main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: var(--icg-dark);
        order: 1;
        min-height: 300px;
    }
    
    .icg-sidebar-container {
        width: 100%;
        background-color: var(--icg-darker);
        border-top: 1px solid var(--icg-gray);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex-shrink: 0;
        order: 2;
        height: 100px;
    }
    
    .icg-sidebar-title {
        display: none;
        padding: 8px 12px;
        background-color: var(--icg-gold);
        color: white;
        font-weight: 600;
        text-align: center;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
    
    .icg-sidebar {
        padding: 10px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        height: 100%;
        background-color: var(--icg-darker);
        scrollbar-width: thin;
        scrollbar-color: var(--icg-gold) var(--icg-gray);
    }
    
    .icg-thumb {
        width: 120px;
        height: auto;
        min-width: 120px;
        border-radius: 4px;
        overflow: hidden;
        cursor: pointer;
        opacity: 0.6;
        transition: var(--icg-transition);
        border: 2px solid transparent;
        position: relative;
        flex-shrink: 0;
    }
    
    .icg-thumb:hover,
    .icg-thumb.active {
        opacity: 1;
        transform: scale(1.05);
        border-color: var(--icg-gold);
    }
    
	.icg-thumb-img {
		width: 100%;
		height: 100% !important;
		object-fit: cover;
		transition: transform 0.3s ease;
	}
    
    .icg-thumb:hover .icg-thumb-img {
        transform: scale(1.1);
    }
    
    .icg-nav {
        position: absolute;
        top: 30%;
        bottom: 110px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        padding: 0 15px;
        transform: none;
        z-index: 2;
    }
    
    /* Mobile scrollbar for horizontal thumbnails */
    .icg-sidebar::-webkit-scrollbar {
        height: 4px;
    }
    
    .icg-sidebar::-webkit-scrollbar-track {
        background: var(--icg-gray);
        border-radius: 2px;
        margin: 0 8px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb {
        background: var(--icg-gold);
        border-radius: 2px;
    }
    
    .icg-sidebar::-webkit-scrollbar-thumb:hover {
        background: #d1a42f;
    }
}

/* ==================== SMALL MOBILE (576px and below) ==================== */
@media (max-width: 576px) {
    .icg-popup-container {
        max-height: 90vh;
        min-height: 350px;
    }
    
    .icg-main-content {
        min-height: 250px;
    }
    
    .icg-sidebar-container {
        height: 90px;
    }
    
    .icg-sidebar {
        padding: 8px 6px;
        gap: 6px;
    }
    .icg-thumb-img {height: 100% !important;}
    .icg-thumb {
        width: 60px;
        height: 50px;
        min-width: 60px;
        border-radius: 5px;
    }
    
    .icg-nav {
        bottom: 100px;
    }
}

/* ==================== EXTRA SMALL MOBILE (480px and below) ==================== */
@media (max-width: 480px) {
    .icg-popup-container {
        max-height: 85vh;
        min-height: 300px;
        border-radius: 10px;
    }
    
    .icg-main-content {
        min-height: 200px;
    }
    
    .icg-sidebar-container {
        height: 80px;
    }
    
    .icg-sidebar {
        padding: 6px 5px;
        gap: 5px;
    }
    
    .icg-thumb {
        width: 55px;
        height: 45px;
        min-width: 55px;
        border-radius: 4px;
    }
        .icg-thumb-img {height: 100% !important;}
    .icg-nav {
        bottom: 90px;
        padding: 0 10px;
    }
    
    .icg-prev,
    .icg-next {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* ==================== COMMON STYLES FOR ALL DEVICES ==================== */
.icg-progress {
    width: 100%;
    height: 4px;
    background: var(--icg-gray);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.icg-progress-bar {
    height: 100%;
    background: var(--icg-gold);
    width: 0%;
    transition: width 0.1s linear;
}

.icg-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--icg-gold);
    border: none;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50% !important;
    transition: var(--icg-transition);
    padding: 0 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.icg-close:hover {
    background: #d1a42f;
    transform: rotate(90deg) scale(1.1);
}

.icg-main {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--icg-dark);
}

.icg-media-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 20px;
    background-color: var(--icg-darker);
    border-radius: 8px;
    position: relative;
    min-height: 200px;
}

.icg-main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

.icg-content {
    padding: 0 5px;
    overflow-y: auto;
/*     max-height: 200px; */
    background-color: var(--icg-dark);
}

.icg-popup-title {
    font-size: 30px !important;
    font-weight: 600 !important;
    color: #E1B129 !important;
    margin-bottom: 15px;
}

.icg-popup-description {
    color: #bfbfbf !important;
    line-height: 1.7;
}

.icg-prev,
.icg-next {
    background: rgba(227, 181, 52, 0.9);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50% !important;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--icg-transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 0 !important;
}
button.icg-prev:focus,
button.icg-next:focus
{
    background: rgba(227, 181, 52, 1);
    transform: scale(1.1);
}




.icg-prev:hover,
.icg-next:hover {
    background: linear-gradient(200deg, #0c1e7f 0%, #612897 100%) !important;
    transform: scale(1.1);
}



.icg-hover-message {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 3;
    white-space: nowrap;
}

.icg-hover-message.show {
    opacity: 1;
}

/* ==================== LANDSCAPE MODE ==================== */
@media (max-height: 600px) and (orientation: landscape) {
    .icg-popup-container {
        max-height: 98vh;
        min-height: auto;
        flex-direction: row;
    }
    
    .icg-main-content {
        min-height: auto;
    }
    
    .icg-sidebar-container {
        width: 120px;
        height: auto;
        border-left: 1px solid var(--icg-gray);
        border-top: none;
    }
    
    .icg-sidebar {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px;
        gap: 8px;
    }
    
    .icg-thumb {
        width: 100%;
        height: 60px;
        min-width: auto;
        min-height: 60px;
    }
    
    .icg-media-container {
        min-height: 150px;
    }
    
    .icg-nav {
        position: absolute;
        top: 50%;
        bottom: auto;
        right: 120px;
        transform: translateY(-50%);
    }
    
    .icg-content {
/*         max-height: 120px; */
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInZoom {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== TOUCH DEVICE IMPROVEMENTS ==================== */
@media (hover: none) and (pointer: coarse) {
    .icg-open-btn {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%) scale(0.9);
    }
    
    .icg-single-item:hover .icg-open-btn {
        transform: translate(-50%, -50%) scale(0.9);
    }
    
    .icg-thumb:hover {
        transform: none;
    }
    
    .icg-thumb:active {
        transform: scale(0.95);
    }
    
    .icg-prev:active,
    .icg-next:active {
        background: rgba(227, 181, 52, 1);
        transform: scale(0.95);
    }
}

/* ==================== GALLERY ITEM RESPONSIVE ==================== */
@media (max-width: 768px) {
    .icg-item-title {
        font-size: 1rem !important;
    }
    
    .icg-open-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .icg-overlay {
        padding: 25px 15px 15px;
    }
    
    .icg-media-container {
        min-height: 200px;
        margin-bottom: 15px;
    }
    
    .icg-popup-title {
        font-size: 1.6rem;
    }
    
    .icg-popup-description {
        font-size: 1rem;
    }
    
    .icg-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    
    .icg-overlay {
        padding: 35px 0 5px;
    }
}

@media (max-width:767px) {
    .icg-item-title {
        font-size: 1rem !important;
    }
    
    .icg-open-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .icg-overlay {
        padding: 15px 8px 8px;
    }
    
    .icg-media-container {
        min-height: 150px;
    }
    
    .icg-popup-title {
        font-size: 1.2rem !important;
        margin-bottom: 10px;
    }
    
    .icg-content {
/*         max-height: 120px; */
    }
    
    .icg-close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
        font-size: 1.3rem;
    }
}


/* ==================== GALLERY THUMBNAIL RESPONSIVE HEIGHTS ==================== */
/* Desktop Large */
@media (min-width: 1200px) {
    .icg-img-wrapper {
        height: var(--icg-thumbnail-height-desktop, 350px);
    }
	.utopia-gallery .icg-img-wrapper {
        height: var(--icg-thumbnail-height-desktop, auto);
    }
}

/* Desktop */
@media (min-width: 993px) and (max-width: 1199px) {
    .icg-img-wrapper {
        height: 320px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 992px) {
    .icg-img-wrapper {
/*         height: var(--icg-thumbnail-height-tablet, 220px); */
    }
}

/* Mobile (767px and below) */
@media (max-width: 767px) {
    .icg-img-wrapper {
/*         height: var(--icg-thumbnail-height-mobile, 220px) !important; */
    }
    
    .icg-img {
        object-fit: cover !important;
        object-position: center !important;
    }
}

/* Small Mobile (576px and below) */
@media (max-width: 576px) {
/*     .icg-img-wrapper {
        height: var(--icg-thumbnail-height-small, 200px) !important;
    } */
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    .icg-img-wrapper {
/*         height: var(--icg-thumbnail-height-xs, 200px) !important;
    } */
}

/* Very Small Mobile (375px and below) */
@media (max-width: 375px) {
/*     .icg-img-wrapper {
        height: 180px !important;
    } */
}