/* ===================================
   Home Index Popup Promotion Styles
   Enhanced with Multi-Promotion Slider Support
   Version 2.1 - Improved Visual Design & UX
   =================================== */

/* Popup Modal Container */
.popup-promotion-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

    .popup-promotion-modal.show {
        display: flex;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

/* Overlay */
.popup-promotion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.85) 100%);
    backdrop-filter: blur(8px);
    transition: backdrop-filter 0.3s ease;
}

/* Modal Content - Centered in viewport with minimal spacing */
.popup-promotion-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    padding: 0;
    width: 92%;
    max-width: 750px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: slideInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

@keyframes slideInScale {
    from {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Close Button */
.popup-promotion-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    backdrop-filter: blur(10px);
}

    .popup-promotion-close:hover,
    .popup-promotion-close:focus {
        background: rgba(220, 53, 69, 0.9);
        border-color: rgba(255, 255, 255, 0.4);
        transform: rotate(90deg) scale(1.1);
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    }

/* ***** Multi-Promotion Slider ***** */
.multi-promotion-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    overflow-y: auto;
    cursor: grab;
    user-select: none;
    flex: 1;
    max-height: calc(85vh - 40px);
}

    .multi-promotion-slider-wrapper.dragging {
        cursor: grabbing;
    }

.multi-promotion-slider-container {
    position: relative;
    width: 100%;
    min-height: 100px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Individual Promotion Slides */
.promotion-slide {
    display: none;
    position: relative;
    animation: fadeSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

    .promotion-slide.active {
        display: block;
    }

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Multi-Promotion Navigation Buttons */
.multi-promotion-prev,
.multi-promotion-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 14px 10px;
    color: white;
    font-weight: bold;
    font-size: 22px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 8px;
    user-select: none;
    background: linear-gradient(135deg, rgba(141, 198, 216, 0.85) 0%, rgba(107, 162, 181, 0.85) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 90;
    line-height: 1;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.multi-promotion-next {
    right: 10px;
}

.multi-promotion-prev {
    left: 10px;
}

    .multi-promotion-prev:hover,
    .multi-promotion-next:hover,
    .multi-promotion-prev:focus,
    .multi-promotion-next:focus {
        background: linear-gradient(135deg, rgba(141, 198, 216, 1) 0%, rgba(107, 162, 181, 1) 100%);
        transform: translateY(-50%) scale(1.08);
        box-shadow: 0 6px 20px rgba(141, 198, 216, 0.5);
        border-color: rgba(255, 255, 255, 0.4);
    }

    .multi-promotion-prev:active,
    .multi-promotion-next:active {
        transform: translateY(-50%) scale(0.98);
    }

/* Hide multi-promotion nav when only 1 promotion */
.popup-promotion-modal[data-promotion-count="1"] .multi-promotion-prev,
.popup-promotion-modal[data-promotion-count="1"] .multi-promotion-next,
.popup-promotion-modal[data-promotion-count="1"] .multi-promotion-indicators {
    display: none;
}

/* Multi-Promotion Indicators */
.multi-promotion-indicators {
    text-align: center;
    padding: 12px 0;
    position: relative;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.05));
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.multi-promotion-indicator {
    cursor: pointer;
    height: 9px;
    width: 9px;
    margin: 0 5px;
    background-color: rgba(141, 198, 216, 0.3);
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid transparent;
    padding: 0;
    position: relative;
    vertical-align: middle;
    box-sizing: border-box;
}

    .multi-promotion-indicator::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 0;
        height: 0;
        background: rgba(141, 198, 216, 0.3);
        border-radius: 50%;
        transition: all 0.3s ease;
    }

    .multi-promotion-indicator.active {
        background: linear-gradient(135deg, #8DC6D8 0%, #6ba2b5 100%);
        border-color: rgba(107, 162, 181, 0.5);
        transform: scale(1.3);
        box-shadow: 0 2px 8px rgba(141, 198, 216, 0.4);
    }

        .multi-promotion-indicator.active::before {
            width: 200%;
            height: 200%;
            opacity: 0;
        }

    .multi-promotion-indicator:hover,
    .multi-promotion-indicator:focus {
        background: linear-gradient(135deg, #8DC6D8 0%, #6ba2b5 100%);
        transform: scale(1.2);
        box-shadow: 0 2px 6px rgba(141, 198, 216, 0.3);
    }

/* ***** Single Image Promotion ***** */
.popup-promotion-image {
    width: 100%;
    overflow: hidden;
    position: relative;
    max-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

    .popup-promotion-image::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.05) 100%);
        pointer-events: none;
        z-index: 1;
    }

    .popup-promotion-image img {
        width: 100%;
        height: auto;
        max-height: 55vh;
        object-fit: contain;
        display: block;
        margin: auto;
    }

    .popup-promotion-image:hover img {
        transform: scale(1.02);
    }

    .popup-promotion-image a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

/* ***** Nested Image Slider within Promotion ***** */
.popup-promotion-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    max-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.popup-slider-container {
    position: relative;
    width: 100%;
    max-height: 55vh;
}

/* Nested Image Slides */
.popup-slide {
    display: none;
    position: relative;
    animation: fadeSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 55vh;
}

    .popup-slide.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.popup-slide-image {
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
    display: block;
}

.popup-slide a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.popup-slide-caption {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    color: #fff;
    padding: 18px 18px 12px;
    backdrop-filter: blur(10px);
}

    .popup-slide-caption p {
        margin: 0;
        font-size: 13px;
        line-height: 1.5;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

/* Nested Image Slider Navigation Buttons */
.popup-slider-prev,
.popup-slider-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 0 8px 8px 0;
    user-select: none;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    z-index: 50;
    line-height: 1;
    backdrop-filter: blur(10px);
}

.popup-slider-next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

.popup-slider-prev {
    left: 0;
}

    .popup-slider-prev:hover,
    .popup-slider-next:hover,
    .popup-slider-prev:focus,
    .popup-slider-next:focus {
        background: rgba(0, 0, 0, 0.85);
        transform: translateY(-50%) scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.2);
    }

/* Nested Image Slider Indicators */
.popup-slider-indicators {
    text-align: center;
    padding: 10px 0;
    position: absolute;
    bottom: 10px;
    width: 100%;
    z-index: 50;
}

.popup-slider-indicator {
    cursor: pointer;
    height: 7px;
    width: 7px;
    margin: 0 4px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid transparent;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    vertical-align: middle;
    box-sizing: border-box;
}

    .popup-slider-indicator.active {
        background-color: #fff;
        transform: scale(1.4);
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
    }

    .popup-slider-indicator:hover,
    .popup-slider-indicator:focus {
        background-color: #fff;
        transform: scale(1.2);
    }

/* ***** Promotion Body Content ***** */
.popup-promotion-body {
    padding: 15px 20px;
    flex-shrink: 0;
}

.popup-promotion-title {
    margin: 0 0 10px 0;
    font-size: 22px;
    color: #1a1a1a;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.popup-promotion-description {
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

.popup-promotion-caption {
    margin-top: 10px;
    color: #888;
    font-size: 12px;
    font-style: italic;
    line-height: 1.5;
}

/* ***** Promotion Footer with Button ***** */
.popup-promotion-footer {
    text-align: center;
    padding: 0 20px 16px;
    flex-shrink: 0;
}

.popup-promotion-button {
    display: inline-block;
    padding: 11px 32px;
    background: linear-gradient(135deg, #8DC6D8 0%, #6ba2b5 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px rgba(141, 198, 216, 0.4);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

    .popup-promotion-button::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.5s ease;
    }

    .popup-promotion-button:hover::before {
        left: 100%;
    }

    .popup-promotion-button:hover,
    .popup-promotion-button:focus {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(141, 198, 216, 0.6);
        color: #fff;
        text-decoration: none;
    }

    .popup-promotion-button:active {
        transform: translateY(-1px);
    }

/* ***** Responsive Design ***** */
@media (max-width: 768px) {
    .popup-promotion-content {
        width: 94%;
        max-height: 88vh;
        border-radius: 10px;
    }

    .multi-promotion-slider-wrapper {
        max-height: calc(88vh - 38px);
    }

    .popup-promotion-image {
        max-height: 45vh;
    }

        .popup-promotion-image img {
            max-height: 45vh;
        }

    .popup-promotion-slider {
        max-height: 45vh;
    }

    .popup-slider-container {
        max-height: 45vh;
    }

    .popup-slide {
        max-height: 45vh;
    }

    .popup-slide-image {
        max-height: 45vh;
    }

    .popup-promotion-title {
        font-size: 19px;
    }

    .popup-promotion-description {
        font-size: 13px;
    }

    .popup-promotion-body {
        padding: 12px 16px;
    }

    .popup-promotion-footer {
        padding: 0 16px 14px;
    }

    .popup-slider-prev,
    .popup-slider-next {
        padding: 9px;
        font-size: 16px;
    }

    .multi-promotion-prev,
    .multi-promotion-next {
        padding: 11px 7px;
        font-size: 18px;
    }

    .popup-promotion-close {
        font-size: 17px;
        width: 34px;
        height: 34px;
        top: 7px;
        right: 7px;
    }

    .popup-slide-caption {
        padding: 13px 10px 10px;
    }

        .popup-slide-caption p {
            font-size: 12px;
        }

    .multi-promotion-indicators {
        padding: 11px 0;
    }

    .popup-promotion-button {
        padding: 9px 28px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .popup-promotion-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 10px;
    }

    .multi-promotion-slider-wrapper {
        max-height: calc(90vh - 35px);
    }

    .popup-promotion-image {
        max-height: 40vh;
    }

        .popup-promotion-image img {
            max-height: 40vh;
        }

    .popup-promotion-slider {
        max-height: 40vh;
    }

    .popup-slider-container {
        max-height: 40vh;
    }

    .popup-slide {
        max-height: 40vh;
    }

    .popup-slide-image {
        max-height: 40vh;
    }

    .popup-promotion-body {
        padding: 10px 14px;
    }

    .popup-promotion-footer {
        padding: 0 14px 12px;
    }

    .popup-promotion-button {
        padding: 9px 26px;
        font-size: 13px;
    }

    .popup-slider-prev,
    .popup-slider-next {
        padding: 7px;
        font-size: 15px;
    }

    .multi-promotion-prev,
    .multi-promotion-next {
        padding: 9px 5px;
        font-size: 16px;
    }

    .popup-promotion-title {
        font-size: 17px;
    }

    .popup-promotion-description {
        font-size: 12px;
    }

    .popup-promotion-close {
        font-size: 15px;
        width: 30px;
        height: 30px;
        top: 5px;
        right: 5px;
    }
}

/* Extra small devices (very small phones) */
@media (max-width: 360px) {
    .popup-promotion-content {
        width: 96%;
        max-height: 92vh;
    }

    .popup-promotion-image {
        max-height: 36vh;
    }

        .popup-promotion-image img {
            max-height: 36vh;
        }

    .popup-promotion-slider {
        max-height: 36vh;
    }

    .popup-slider-container {
        max-height: 36vh;
    }

    .popup-slide {
        max-height: 36vh;
    }

    .popup-slide-image {
        max-height: 36vh;
    }

    .popup-promotion-body {
        padding: 8px 12px;
    }

    .popup-promotion-footer {
        padding: 0 12px 10px;
    }

    .popup-promotion-title {
        font-size: 15px;
    }

    .popup-promotion-description {
        font-size: 11px;
    }

    .popup-promotion-button {
        padding: 7px 22px;
        font-size: 12px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .popup-promotion-content {
        max-height: 92vh;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .multi-promotion-slider-wrapper {
        max-height: 92vh;
    }

    .popup-promotion-image {
        max-height: 65vh;
        width: 50%;
    }

        .popup-promotion-image img {
            max-height: 65vh;
        }

    .popup-promotion-slider {
        max-height: 65vh;
        width: 50%;
    }

    .popup-slider-container {
        max-height: 65vh;
    }

    .popup-slide {
        max-height: 65vh;
    }

    .popup-slide-image {
        max-height: 65vh;
    }

    .popup-promotion-body {
        width: 50%;
        padding: 10px;
    }

    .popup-promotion-footer {
        width: 100%;
        padding: 6px 10px 10px;
    }
}

/* ***** Accessibility & Keyboard Navigation ***** */
.popup-promotion-close:focus,
.popup-slider-prev:focus,
.popup-slider-next:focus,
.popup-slider-indicator:focus,
.multi-promotion-prev:focus,
.multi-promotion-next:focus,
.multi-promotion-indicator:focus,
.popup-promotion-button:focus {
    outline: 3px solid #8DC6D8;
    outline-offset: 3px;
}

/* Focus visible for better keyboard navigation */
.popup-promotion-close:focus-visible,
.popup-slider-prev:focus-visible,
.popup-slider-next:focus-visible,
.popup-slider-indicator:focus-visible,
.multi-promotion-prev:focus-visible,
.multi-promotion-next:focus-visible,
.multi-promotion-indicator:focus-visible,
.popup-promotion-button:focus-visible {
    outline: 3px solid #8DC6D8;
    outline-offset: 3px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .popup-promotion-modal,
    .popup-promotion-content,
    .promotion-slide,
    .popup-slide,
    .multi-promotion-prev,
    .multi-promotion-next,
    .multi-promotion-indicator,
    .popup-slider-prev,
    .popup-slider-next,
    .popup-promotion-button {
        animation: none !important;
        transition: none !important;
    }
}

/* ***** No-JS Fallback ***** */
.no-js .promotion-slide {
    display: none;
}

    .no-js .promotion-slide:first-child {
        display: block;
    }

.no-js .multi-promotion-prev,
.no-js .multi-promotion-next,
.no-js .multi-promotion-indicators,
.no-js .popup-slider-prev,
.no-js .popup-slider-next,
.no-js .popup-slider-indicators {
    display: none;
}

.no-js .popup-slide:first-child {
    display: block;
}

/* ***** Loading State ***** */
.popup-promotion-modal.loading .multi-promotion-slider-container {
    opacity: 0.6;
    pointer-events: none;
}

/* ***** Drag Indicator ***** */
.multi-promotion-slider-wrapper::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: rgba(141, 198, 216, 0.3);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.multi-promotion-slider-wrapper:hover::after {
    background: rgba(141, 198, 216, 0.5);
}

.popup-promotion-modal[data-promotion-count="1"] .multi-promotion-slider-wrapper::after {
    display: none;
}
