/* Mini controls next to next-btn */
.nav-right-container {
    display: flex;
    align-items: center;
    gap: 30px;
}

.controls-mini {
    display: flex;
    gap: 20px;
    align-items: center;
}

.mini-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.mini-btn:hover {
    color: #e32636;
    transform: scale(1.1);
}

/* Book Mode Styles */
body.book-active {
    background-color: #f5f5f5;
    overflow: hidden; /* Use overlay scroll if needed */
}

/* Hide side panes when in book mode */
.app-container.book-active .left-pane,
.app-container.book-active .right-pane {
    display: none !important;
}

/* Expand center pane with 3D perspective */
.app-container.book-active .center-pane {
    padding: 0;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    overflow: hidden; 
    perspective: 2500px; /* Crucial for 3D */
}

/* Custom flipbook container for 2 pages */
.flipbook-page-wrapper {
    display: flex;
    height: 92vh; 
    max-height: 950px; 
    aspect-ratio: 1.4 / 1; 
    width: auto; 
    max-width: 95vw;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    background-color: #fff;
    position: relative;
    border-radius: 4px;
    margin: auto;
    transform-style: preserve-3d; /* Maintain 3D context */
}

/* Create the spine effect */
.flipbook-page-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 30px;
    transform: translateX(-50%);
    background: linear-gradient(to right, 
        rgba(0,0,0,0) 0%, 
        rgba(0,0,0,0.08) 20%, 
        rgba(0,0,0,0.2) 45%, 
        rgba(0,0,0,0.25) 50%, 
        rgba(0,0,0,0.2) 55%, 
        rgba(0,0,0,0.08) 80%, 
        rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 100;
}

.book-page-half {
    flex: 1 1 50%;
    width: 50%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: #fff;
}

.book-page-half .catalog-page {
    width: 100%;
    height: 100%; 
    max-width: none;
    margin: 0;
    min-height: 0; 
}

/* Flipping Leaf Layer */
.flipping-leaf {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 200;
    pointer-events: none;
    transform-style: preserve-3d;
    display: none; /* Shown via JS */
}

.flipping-leaf.flip-next {
    right: 0;
    transform-origin: left center;
}

.flipping-leaf.flip-prev {
    left: 0;
    transform-origin: right center;
}

.leaf-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-color: #fff;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.05);
}

.leaf-face.back {
    transform: rotateY(180deg);
}

.book-blank-page {
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Roboto', sans-serif;
    color: #ccc;
    font-size: 24px;
    font-weight: bold;
    background: #fafafa;
    min-height: 80vh;
}

/* Navigation Overlay */
.book-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
}

.app-container.book-active + .book-nav-overlay {
    display: block;
}

.book-nav-overlay button {
    pointer-events: auto;
    position: absolute;
    background-color: rgba(255,255,255,0.9);
    color: #e32636;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
}

.book-nav-overlay button:hover {
    background-color: #fff;
    transform: scale(1.1);
}

.book-nav-overlay .book-prev {
    top: 50%;
    left: 30px;
    transform: translateY(-50%);
}
.book-nav-overlay .book-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.book-nav-overlay .book-next {
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
}
.book-nav-overlay .book-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.book-nav-overlay .book-close {
    top: 30px;
    right: 40px;
    background-color: #000;
    color: #fff;
    width: 50px;
    height: 50px;
    font-size: 24px;
}
.book-nav-overlay .book-close:hover {
    background-color: #e32636;
    color: #fff;
    transform: scale(1.1);
}

/* Override internal catalog components for better fit in book mode */
.app-container.book-active .catalog-header {
    padding-top: 15px; /* Tighter top */
    padding-bottom: 8px;
}

.app-container.book-active .header-logo-img {
    max-width: 40px;
    margin-top: 8px;
}

.app-container.book-active .suitable-brand {
    font-size: 14px;
    padding: 3px 8px;
}

.app-container.book-active .suitable-text {
    font-size: 10px;
}

.app-container.book-active .header-gray-bar {
    top: 23px; /* Aligned to middle of shrunken logo */
    height: 30px;
    width: 55%;
    z-index: 0;
}

.app-container.book-active .category-title {
    font-size: 15px; /* Smaller */
    padding-bottom: 2px;
}

.app-container.book-active .category-area {
    position: relative; /* Change from absolute to prevent overlapping */
    padding: 10px 20px 0 20px;
    text-align: right;
    margin-top: -10px;
}

.app-container.book-active .header-right {
    margin-top: 5px;
}

.app-container.book-active .catalog-body {
    padding: 0px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden; /* No internal scroll */
}

.app-container.book-active .product-grid-catalog {
    gap: 6px 6px; /* Super tight gap */
    flex: 1;
    min-height: 0;
}

.app-container.book-active .product-image-box {
    aspect-ratio: auto;
    height: 70px; /* Super compact height */
}

.app-container.book-active .product-image-box img {
    max-height: 60px;
}

.app-container.book-active .catalog-footer {
    margin-top: 10px;
}

.app-container.book-active .disclaimer {
    padding: 0 20px 5px 20px;
    font-size: 7px;
}

.app-container.book-active .footer-red-banner {
    height: 30px;
}

.app-container.book-active .footer-banner-text {
    font-size: 10px;
}

.app-container.book-active .catalog-product {
    padding-top: 10px;
}

.app-container.book-active .product-name {
    font-size: 9px;
    line-height: 1.1;
}

.app-container.book-active .product-spec {
    font-size: 7px;
}

.app-container.book-active .product-nr-label {
    font-size: 9px;
    padding: 2px 8px;
    top: -8px;
}

.app-container.book-active .product-model-label {
    font-size: 8px;
    padding: 2px 10px;
    top: 10px;
}

.app-container.book-active .product-details-box {
    padding: 14px 8px 8px 8px;
    margin-top: -15px;
}

/* Shadow underneath leaf */
.leaf-shadow {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.15);
    z-index: 150;
    pointer-events: none;
    opacity: 0;
}

/* Animations */
@keyframes flipToLeft {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(-180deg); }
}

@keyframes flipToRight {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(180deg); }
}

@keyframes shadowFade {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.animate-flip-next {
    display: block !important;
    animation: flipToLeft 0.8s ease-in-out forwards;
}

.animate-flip-prev {
    display: block !important;
    animation: flipToRight 0.8s ease-in-out forwards;
}

.animate-shadow {
    animation: shadowFade 0.8s ease-in-out;
}

