* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #5e9ed6 0%, #3b7ec7 100%);
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

/* Landing Section */
#landing-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    margin: 0 auto;
}

.landing-content {
    background: white;
    border-radius: 20px;
    text-align: center;
    padding: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    width: 100%;
}

.landing-content h2 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.tagline {
    font-size: 1.2em;
    color: #666;
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.6;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.feature {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.feature h3 {
    font-size: 1.3em;
    color: #3b7ec7;
    margin-bottom: 10px;
}

.feature p {
    color: #666;
    line-height: 1.5;
}

.cta-button {
    width: 100%;
    padding: 20px 40px;
    font-size: 1.3em;
    border: none;
    background: linear-gradient(135deg, #5e9ed6 0%, #3b7ec7 100%);
    color: white;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    margin-bottom: 50px;
    box-shadow: 0 5px 20px rgba(59, 126, 199, 0.4);
    text-wrap-mode: nowrap;
}

.cta-button:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(59, 126, 199, 0.6);
}

#examples-section {
    border-top: 2px solid #eee;
    padding-top: 40px;
}

#examples-section h3 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

#examples-grid, #user-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.example-item {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.example-item:hover {
    transform: translateY(-3px);
    border-color: #5e9ed6;
    box-shadow: 0 5px 15px rgba(94, 158, 214, 0.3);
}

.example-item img {
    max-width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    background: white;
}

.example-item h4 {
    font-size: 0.9em;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Upload Section */
#upload-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.upload-box {
    background: white;
    border-radius: 15px;
    padding: 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.upload-box input[type="file"] {
    display: none;
}

.upload-box label {
    display: block;
    padding: 40px 60px;
    background: #5e9ed6;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    border: 3px dashed white;
}

.upload-box label:hover {
    background: #3b7ec7;
    transform: scale(1.05);
}

.back-button {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1em;
    border: 2px solid #5e9ed6;
    background: white;
    color: #5e9ed6;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.back-button:hover {
    background: #5e9ed6;
    color: white;
    transform: scale(1.05);
}

/* Config Section */
#config-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.config-box {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
}

.config-box h2 {
    margin-bottom: 10px;
    color: #333;
}

.config-box p {
    margin-bottom: 20px;
    color: #666;
}

#page-config-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.page-config-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.page-config-item canvas {
    width: 120px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 4px;
    object-fit: contain;
    background: white;
}

.page-config-item label {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.page-config-item select {
    padding: 8px 12px;
    border: 2px solid #5e9ed6;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.9em;
    cursor: pointer;
}

.display-mode-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 20px;
}

.display-mode-selector label {
    font-weight: 600;
    color: #333;
}

.display-mode-selector select {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #5e9ed6;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 1em;
    cursor: pointer;
}

.feature-selector {
    margin-bottom: 20px;
}

.feature-selector > label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.feature-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.feature-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    color: #555;
    cursor: pointer;
}

.feature-checkboxes input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.generate-btn {
    width: 100%;
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    background: #5e9ed6;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.generate-btn:hover {
    background: #3b7ec7;
    transform: scale(1.02);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Flipbook Section */
#flipbook-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    visibility: hidden;
}

.flipbook-container {
    perspective: 2500px;
    perspective-origin: 50% 50%;
    margin-bottom: 30px;
    position: relative;
    width: 100%;
}

.flipbook-container.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #5e9ed6 0%, #3b7ec7 100%);
    z-index: 9999;
    margin: 0;
}

.flipbook-container.fullscreen-mode .canvas-wrapper {
    width: 100%;
    height: 100%;
    padding: 40px;
}

/* Native fullscreen API styles */
.flipbook-container:fullscreen {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #5e9ed6 0%, #3b7ec7 100%);
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.flipbook-container:fullscreen .canvas-wrapper {
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.feature-toolbar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.feature-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.9em;
    border: 2px solid white;
    background: rgba(94, 158, 214, 0.9);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.feature-btn:hover {
    background: rgba(59, 126, 199, 1);
    transform: scale(1.05);
}

.flipbook-container:fullscreen .feature-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.flipbook-container:fullscreen .fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    margin: 0;
    z-index: 100;
}

.fullscreen-btn {
    display: block;
    margin: 0 auto 10px auto;
    padding: 10px 20px;
    font-size: 1em;
    border: 2px solid white;
    background: rgba(94, 158, 214, 0.9);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    z-index: 10;
}

.fullscreen-btn:hover {
    background: rgba(59, 126, 199, 1);
    transform: scale(1.05);
}

.canvas-wrapper {
    width: 100%;
    height: 500px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.nav-arrow {
    width: 60px;
    height: 60px;
    border: none;
    background: none;
    color: #ccc;
    font-size: 3em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-arrow:hover:not(:disabled) {
    color: #000;
    transform: scale(1.2);
}

.nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.book-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.book {
    position: relative;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    transform-style: preserve-3d;
    /*
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    background: #2a2a2a;
    */
	/*
    border: 1px solid black;
    */
    box-sizing: border-box;
    cursor: grab;
}

.book:active {
    cursor: grabbing;
}

.page {
    position: absolute;
    /*
    background: white;
    */
    transform-style: preserve-3d;
    backface-visibility: visible;
    overflow: visible;
}

.page canvas {
    display: block;
}

.page-left {
    left: 0;
    top: 0;
    transform-origin: right center;
}

.page-right {
    left: 50%;
    top: 0;
    transform-origin: left center;
}

/* Layer the pages */
.page {
    z-index: 1;
}

/* Page flip canvas */
#page-flip-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100;
}

.page.flipping {
    /*opacity: 0;*/
}

/* PDF Link Overlays */
.pdf-link-overlay {
    text-decoration: none;
    transition: background 0.2s;
}

.pdf-link-overlay:hover {
    background: rgba(100, 150, 255, 0.2);
}

/* Debug Slider */
.debug-slider-container {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
}

.debug-slider-container label {
    font-weight: 600;
    color: #333;
}

.debug-slider-container input[type="range"] {
    width: 300px;
    cursor: pointer;
}

.debug-slider-container span {
    font-weight: 600;
    color: #5e9ed6;
    min-width: 50px;
}

