/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #e8e8e8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Main Container */
.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Brochure Container */
.brochure-container {
    perspective: 1000px;
    width: 986px;
    /* 280px × 3 panels + 146px margin (73px between each) */
    height: 595px;
}

/* Desktop margins for screens bigger than 1024px */
@media (min-width: 1025px) {
    .brochure-container {
        margin-right: 73px;
        margin-bottom: 73px;
    }
}

/* Brochure Base */
.brochure {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.brochure.opened {
    transform: rotateY(0deg);
}

/* Panel Base Styles */
.panel {
    position: absolute;
    width: 350px;
    height: 650px;
    background: white;
    border-radius: 15px;
    transform-origin: left center;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backface-visibility: hidden;
}

/* Cover Panel */
.cover-panel {
    left: 353px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    color: white;
    z-index: 3;
}

.cover-panel .panel-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    position: relative;
}

/* Middle Panel */
.middle-panel {
    left: 353px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    color: white;
    z-index: 2;
    transform: rotateY(180deg);
}

.brochure.opened .middle-panel {
    transform: rotateY(180deg);
}

.brochure.opened.right-open .middle-panel {
    transform: rotateY(0deg);
}

.brochure.opened.right-panel-open .right-panel {
    transform: rotateY(0deg);
}

/* Left Panel */
.left-panel {
    left: 0;
    /* background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); */
    color: white;
    z-index: 2;
    transform: rotateY(-120deg);
    transform-origin: right center;
}

/* Right Panel */
.right-panel {
    left: 706px;
    /* background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); */
    color: white;
    z-index: 3;
    transform: rotateY(120deg);
    transform-origin: left center;
}

/* Back Panels */
.back-left-panel {
    left: 0;
    /* background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); */
    color: white;
    z-index: 1;
    transform: rotateY(120deg);
    transform-origin: right center;
}

.back-center-panel {
    left: 353px;
    /* background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); */
    color: #333;
    z-index: 2;
    transform: rotateY(120deg);
    transform-origin: left center;
}

.back-right-panel {
    left: 706px;
    /* background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); */
    color: #333;
    z-index: 1;
    transform: rotateY(120deg);
    transform-origin: left center;
}

/* Front Flip Open States */
.brochure.opened .left-panel {
    transform: rotateY(0deg);
}

.brochure.opened .cover-panel {
    transform: rotateY(-90deg);
}

.brochure.opened .left-panel {
    transform: rotateY(0deg);
    transition-delay: 0.8s;
}

.brochure.right-open .right-panel {
    transform: rotateY(120deg);
}

/* Back Flip Behavior */
.brochure.flipped {
    transform: translateX(-353px);
}

.brochure.flipped .cover-panel {
    transform: rotateY(0deg);
    transition: none !important;
}

.brochure.flipped .middle-panel {
    transform: rotateY(0deg);
}

.brochure.flipped .front-middle-image {
    display: none;
}

.brochure.flipped .back-middle-image {
    display: block;
}

.brochure.flipping .right-panel {
    transform: rotateY(-90deg);
    transition-delay: 0s;
}

.brochure.flipping .left-panel {
    transform: rotateY(-120deg);
    transition-delay: 0.4s;
}

.brochure.flipping .middle-panel {
    transform: rotateY(180deg);
    transition-delay: 0.4s;
}

.brochure.flipping .cover-panel {
    transition: none !important;
}

.brochure.flipped .left-panel,
.brochure.flipped .middle-panel,
.brochure.flipped .right-panel,
.brochure.flipped .cover-panel {
    display: none;
}

.brochure.flipped .back-left-panel {
    transform: rotateY(0deg);
    left: 353px;
    z-index: 3;
}

.brochure.flipped .back-center-panel {
    transform: rotateY(180deg);
    left: 706px;
    z-index: 2;
    transform-origin: left center;
}

.brochure.flipped .back-right-panel {
    transform: rotateY(180deg);
    left: 1062px;
    z-index: 1;
    transform-origin: left center;
}

.brochure.flipped.back-center-open .back-center-panel {
    transform: rotateY(0deg);
    left: 706px;
    z-index: 4;
}

.brochure.flipped.back-right-open .back-right-panel {
    transform: rotateY(0deg);
    left: 1062px;
    z-index: 5;
}


/* Panel Content */
.panel-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Panel Images */
.panel-image {
    width: 100%;
    height: 100%;
    object-fit: fit;
    border-radius: 15px;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Buttons & Misc UI */
.buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

.open-button-container {
    text-align: center;
    margin: 0;
    position: relative;
    z-index: 10;
}

.download-button-container {
    text-align: center;
    margin: 0;
    position: relative;
    z-index: 10;
}

.cta-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cta-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
}

/* Download Button */
.download-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.download-button:hover {
    background: linear-gradient(135deg, #3d8bfe 0%, #00d4fe 100%);
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

.download-button i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.download-button:hover i {
    transform: translateY(-2px);
}

/* Side Controls */
.side-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 100;
}

.side-arrow-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.side-arrow-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.1);
}

.left-arrow {
    margin-left: 5px;
}

.right-arrow {
    margin-right: 5px;
}

/* Floating Controls */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* Responsive Design */
/* Tablet and small desktop scaling */
@media (min-width: 768px) and (max-width: 1024px) {
    .brochure-container {
        width: 80vw;
        height: 98vh;
        display: flex;
        flex-direction: column;
        gap: 0;
        margin: 0 auto 20px;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 0;
        /* Progressive scaling - wider screens show smaller cards for full visibility */
        transform: scale(calc(0.2 + (100vw - 768px) / 5000));
        max-width: 350px;
    }

    .panel {
        width: 100%;
        height: 98vh;
        position: relative;
        left: 0 !important;
        transform: none !important;
        margin-bottom: 0;
        flex-shrink: 0;
        display: none;
        transition: opacity 0.3s ease-in-out;
    }

    .panel:first-of-type {
        display: block;
    }

    .brochure {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        height: auto;
        position: relative;
        transform: none !important;
        perspective: none !important;
    }

    .brochure,
    .panel,
    .brochure.opened .left-panel,
    .brochure.opened .right-panel,
    .brochure.opened .middle-panel,
    .brochure.flipped {
        transition: none !important;
        transform: none !important;
    }

    .brochure.opened .left-panel,
    .brochure.opened .right-panel,
    .brochure.opened .middle-panel {
        transform: none !important;
        display: none !important;
    }

    .brochure.flipped .back-left-panel,
    .brochure.flipped .back-center-panel,
    .brochure.flipped .back-right-panel {
        transform: none !important;
        display: none !important;
    }

    .mobile-nav {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        display: flex;
        justify-content: space-between;
        gap: 0;
        margin: 0;
        pointer-events: none;
        z-index: 100;
    }

    .mobile-nav-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.6);
        border: none;
        color: white;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: auto;
    }

    .mobile-nav-btn:hover {
        background: rgba(102, 126, 234, 0.8);
        transform: scale(1.1);
    }

    .mobile-nav-btn:disabled {
        background: rgba(102, 126, 234, 0.2);
        cursor: not-allowed;
        transform: none;
        opacity: 0.4;
    }

    .mobile-nav-btn:first-child {
        margin-left: 10px;
    }

    .mobile-nav-btn:last-child {
        margin-right: 10px;
    }

    .mobile-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }

    .mobile-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.3);
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-dot.active {
        background: rgba(102, 126, 234, 1);
        transform: scale(1.2);
    }

    .controls {
        display: none !important;
    }

    .side-controls {
        display: none !important;
    }

    .open-button-container {
        display: none !important;
    }

    .download-button-container {
        display: block !important;
        /* margin: 30px auto 0; */
        margin-bottom: 15px;
        text-align: center;
    }

    .main-container {
        padding-top: 30px;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* gap: 20px; */
    }
}

@media (max-width: 768px) {
    .brochure-container {
        width: 95vw;
        height: 95vh;
        display: flex;
        flex-direction: column;
        gap: 0;
        margin: 0 auto 20px;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 0;
        /* Dynamic scaling based on viewport width - wider screens = smaller cards for full visibility */
        transform: scale(calc(0.35 + (100vw - 320px) / 3500));
        max-width: 380px;
    }

    .panel {
        width: 100%;
        height: 95vh;
        position: relative;
        left: 0 !important;
        transform: none !important;
        margin-bottom: 0;
        flex-shrink: 0;
        display: none;
        /* Hide all panels by default */
        transition: opacity 0.3s ease-in-out;
    }

    /* Show only the first panel by default */
    .panel:first-of-type {
        display: block;
    }

    .brochure {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        height: auto;
        position: relative;
        transform: none !important;
        perspective: none !important;
    }

    .brochure,
    .panel,
    .brochure.opened .left-panel,
    .brochure.opened .right-panel,
    .brochure.opened .middle-panel,
    .brochure.flipped {
        transition: none !important;
        transform: none !important;
    }

    .brochure.opened .left-panel,
    .brochure.opened .right-panel,
    .brochure.opened .middle-panel {
        transform: none !important;
        display: none !important;
        /* Hide all by default */
    }

    .brochure.flipped .back-left-panel,
    .brochure.flipped .back-center-panel,
    .brochure.flipped .back-right-panel {
        transform: none !important;
        display: none !important;
        /* Hide all by default */
    }

    /* Mobile navigation controls */
    .mobile-nav {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        display: flex;
        justify-content: space-between;
        gap: 0;
        margin: 0;
        pointer-events: none;
        z-index: 100;
    }

    .mobile-nav-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.6);
        border: none;
        color: white;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: auto;
    }

    .mobile-nav-btn:hover {
        background: rgba(102, 126, 234, 0.8);
        transform: scale(1.1);
    }

    .mobile-nav-btn:disabled {
        background: rgba(102, 126, 234, 0.2);
        cursor: not-allowed;
        transform: none;
        opacity: 0.4;
    }

    .mobile-nav-btn:first-child {
        margin-left: 10px;
    }

    .mobile-nav-btn:last-child {
        margin-right: 10px;
    }

    .mobile-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        /* margin: 10px 0; */
        margin-bottom: 15px;
        flex-wrap: wrap;
    }

    .mobile-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.3);
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-dot.active {
        background: rgba(102, 126, 234, 1);
        transform: scale(1.2);
    }

    .controls {
        display: none !important;
    }

    .side-controls {
        display: none !important;
    }

    .open-button-container {
        display: none !important;
    }

    .download-button-container {
        display: block !important;
        /* margin: 30px auto 0; */
        margin-bottom: 15px;
        text-align: center;
    }

    .main-container {
        padding-top: 30px;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* gap: 20px; */
    }
}

@media (max-width: 480px) {
    .brochure-container {
        margin: 0 auto 20px;
        gap: 0;
        width: 90vw;
        height: 90vh;
        padding: 0;
        /* Dynamic scaling for smaller screens - starts larger and scales down for full visibility */
        transform: scale(calc(0.45 + (100vw - 280px) / 3000));
        max-width: 320px;
    }

    .panel {
        height: 90vh;
        width: 100%;
    }

    .brochure {
        gap: 10px;
    }

    .mobile-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .mobile-dot {
        width: 8px;
        height: 8px;
    }
}

/* Left edge shadows for p2, p3, p6, p5
.middle-panel {
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.4) !important;
}

.right-panel {
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.4) !important;
}

.back-center-panel {
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.4) !important;
}

.back-right-panel {
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.4) !important;
} */