:root {
            --primary-color: #1857A6;
            --accent-color: #EDB516;
            --white-color: #FFFFFF;
            --dark-text-on-accent: #333;
            --light-bg-color: #f0f2f5;
            --flip-duration: 0.8s;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--light-bg-color);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .flipbook-container {
            background: var(--white-color);
            border-radius: 8px; /* Slightly sharper for a modern look */
            box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
            overflow: hidden;
            position: relative;
            max-width: 1200px;
            width: 100%;
            display: flex;
            flex-direction: column;
        }

        .flipbook-header {
            background-color: var(--primary-color);
            color: var(--white-color);
            padding: 20px;
            text-align: center;
            position: relative;
        }

        .flipbook-header h1 {
            font-size: 2.2rem;
            margin-bottom: 10px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
        }

        .flipbook-header p {
            opacity: 0.9;
            font-size: 1.1rem;
        }

        .flipbook-viewer {
            position: relative;
            width: 100%;
            height: 430px; /* Adjust as needed */
            background: #e9ecef;
            overflow: hidden;
            /* Creates the 3D space for pages to flip inside */
            perspective: 2500px;
        }

        .page-container {
            position: absolute;
            width: 100%;
            height: 100%;
            display: flex;
        }
        
        /* --- Styles for 3D Page Flip --- */
        .page {
            flex: 0 0 50%;
            height: 100%;
            position: relative;
            background: var(--white-color);
            /* This is crucial for 3D transforms */
            transform-style: preserve-3d;
            transition: transform var(--flip-duration) cubic-bezier(0.645, 0.045, 0.355, 1);
            /* A subtle inner shadow to mimic page curvature */
            box-shadow: inset -2px 0px 5px rgba(0,0,0,0.1);
        }

        .page.flipping {
            /* Animation for turning page forward */
            transform-origin: left center;
            transform: rotateY(-180deg);
        }

        /* We need to hide the back of the page during the flip */
        .page-front, .page-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            -webkit-backface-visibility: hidden;
        }

        .page-back {
            transform: rotateY(180deg);
        }

        .page img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            user-select: none;
        }

        .page-number {
            position: absolute;
            bottom: 10px;
            right: 15px;
            background: rgba(0,0,0,0.6);
            color: var(--white-color);
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 0.9rem;
            font-weight: bold;
        }

        .loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 1.2rem;
            color: #666;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid var(--primary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .controls {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            background-color: var(--primary-color);
            gap: 15px;
        }

        .btn {
            background-color: var(--accent-color);
            color: var(--dark-text-on-accent);
            border: none;
            padding: 12px 24px;
            border-radius: 50px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        }

        .btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 7px 15px rgba(0,0,0,0.3);
            filter: brightness(1.05);
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn:disabled {
            background: #b0bec5;
            color: #607d8b;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .page-info {
            color: var(--white-color);
            font-weight: bold;
            font-size: 1.1rem;
            min-width: 80px;
            text-align: center;
        }

        .zoom-controls {
            display: flex;
            gap: 10px;
            align-items: center;
        }
        
        .zoom-btn {
            width: 40px;
            height: 40px;
        }

        .fullscreen-btn {
            padding: 10px 15px;
        }

        .thumbnail-strip {
            display: flex;
            overflow-x: auto;
            padding: 15px;
            background: #e0e0e0;
            gap: 10px;
            border-top: 1px solid #bdc3c7;
        }

        .thumbnail {
            flex: 0 0 auto;
            width: 60px;
            height: 80px;
            border: 3px solid transparent;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.3s ease;
            overflow: hidden;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }

        .thumbnail:hover {
            transform: scale(1.05);
            border-color: var(--primary-color);
        }

        .thumbnail.active {
            border-color: var(--accent-color);
            box-shadow: 0 0 15px var(--accent-color);
            transform: scale(1.1);
        }

        .thumbnail img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .progress-bar {
            width: 100%;
            height: 5px;
            background: rgba(255,255,255,0.2);
            position: absolute;
            bottom: 0;
            left: 0;
        }

        .progress-fill {
            height: 100%;
            background: var(--accent-color);
            width: 0; /* Will be set by JS */
            transition: width 0.4s ease-out;
        }

        @media (max-width: 768px) {
            .flipbook-viewer { height: 45vh; }
            .page { flex: 0 0 100%; box-shadow: none; }
            .zoom-controls { display: none; } /* Hide zoom on mobile for simplicity */
        }