/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:wght@400;600&family=Raleway:wght@300;400;500&display=swap');

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

body {
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(135deg, #F5C9A8 0%, #D7C6E0 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #4B2C23;
}

/* Password Screen Styles */
.password-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #F5C9A8 0%, #D7C6E0 100%);
}

.password-box {
    background: #F9F3ED;
    padding: 60px 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid #E6DAD1;
}

.password-box h1 {
    font-family: 'Crimson Text', serif;
    color: #4B2C23;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 600;
}

.password-box p {
    color: #666;
    margin-bottom: 30px;
    font-weight: 300;
}

#password-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #E6DAD1;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    font-family: 'Raleway', sans-serif;
    background: #F9F3ED;
}

#password-input:focus {
    outline: none;
    border-color: #D7C6E0;
    box-shadow: 0 0 0 3px rgba(215, 198, 224, 0.2);
}

.password-box button {
    background: #D7C6E0;
    color: #4B2C23;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.password-box button:hover {
    background: #C1A7D6;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(193, 167, 214, 0.3);
}

.error-hidden {
    display: none;
}

#error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-size: 14px;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Book Container Styles */
.hidden {
    display: none !important;
}

#book-container {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
    width: 100%;
}

.book-header {
    text-align: center;
    margin-bottom: 40px;
}

.book-header h1 {
    font-family: 'Crimson Text', serif;
    font-size: 3em;
    color: #4B2C23;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    color: #666;
    font-size: 1.2em;
    font-weight: 300;
}

/* Flipbook Styles */
#flipbook {
    width: 100%;
    max-width: 900px;
    height: 600px;
    max-height: calc(100vh - 200px);
    margin: 0 auto 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.12);
    overflow: hidden;
}

#flipbook .page {
    background: #F9F3ED;
    border: 1px solid #E6DAD1;
    overflow: hidden;
    box-sizing: border-box;
}

#flipbook .even {
    box-shadow: inset -7px 0 20px -7px rgba(0,0,0,0.1);
}

#flipbook .odd {
    box-shadow: inset 7px 0 20px -7px rgba(0,0,0,0.1);
}

.page-content {
    padding: 12px 16px;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
}

.page-content img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    margin-bottom: 8px;
    display: block;
}

.memory-text {
    text-align: center;
    max-width: 400px;
}

.memory-text h2 {
    font-family: 'Crimson Text', serif;
    color: #4B2C23;
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: 600;
}

.memory-text p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95em;
}

/* Special Pages */
.cover-page {
    background: linear-gradient(135deg, #F5C9A8, #D7C6E0);
    color: #4B2C23;
}

.cover-title {
    font-family: 'Crimson Text', serif;
    font-size: 3.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.cover-subtitle {
    font-size: 1.3em;
    font-weight: 300;
    margin-bottom: 40px;
}

.cover-decoration {
    font-size: 3em;
}

.back-cover {
    background: linear-gradient(135deg, #D7C6E0, #F5C9A8);
    color: #4B2C23;
}

.back-cover-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.8em;
    line-height: 1.8;
    font-style: italic;
    margin-bottom: 30px;
}

.blank-page {
    text-align: center;
}

.blank-page h2 {
    font-family: 'Crimson Text', serif;
    color: #4B2C23;
    font-size: 2em;
    margin-bottom: 20px;
}

.blank-page p {
    color: #666;
    line-height: 1.8;
    max-width: 350px;
    margin: 0 auto 30px;
}

.heart-decoration {
    font-size: 2em;
    letter-spacing: 10px;
}

/* Control Buttons */
.controls {
    text-align: center;
    margin-top: 16px;
}

.btn-prev, .btn-next {
    background: #D7C6E0;
    border: 2px solid #E6DAD1;
    color: #4B2C23;
    padding: 12px 30px;
    margin: 0 10px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-prev:hover, .btn-next:hover {
    background: #C1A7D6;
    border-color: #C1A7D6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(193, 167, 214, 0.3);
}

/* Responsive Design */
@media (max-width: 960px) {
    #flipbook {
        max-width: 700px;
        height: 500px;
    }
    
    .page-content {
        padding: 10px 14px;
        overflow: hidden;
    }
    
    .cover-title {
        font-size: 2.5em;
    }
}

@media (max-width: 750px) {
    #flipbook {
        max-width: 500px;
        height: 400px;
        max-height: calc(100vh - 180px);
        margin-bottom: 12px;
    }
    
    .page-content {
        padding: 8px 12px;
        overflow: hidden;
    }
    
    .page-content img {
        max-width: 100%;
        max-height: 100%;
    }
    
    .memory-text h2 {
        font-size: 1.4em;
    }
    
    .memory-text p {
        font-size: 0.85em;
    }
    
    .cover-title {
        font-size: 2em;
    }
    
    .book-header {
        margin-bottom: 20px;
    }
    
    .book-header h1 {
        font-size: 2em;
    }
    
    .controls {
        margin-top: 12px;
    }
}

@media (max-width: 550px) {
    #book-container {
        padding: 6px 4px 20px;
    }

    .book-header {
        margin-bottom: 10px;
    }

    .book-header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    #flipbook {
        width: 100%;
        max-width: 340px;
        height: 420px;
        max-height: calc(100vh - 140px);
        margin-bottom: 4px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    }

    .page-content {
        padding: 6px 10px;
        overflow: hidden;
    }

    .page-content img {
        max-width: 100%;
        max-height: 100%;
    }
    
    .controls {
        position: fixed;
        bottom: 8px;
        left: 0;
        right: 0;
        background: rgba(249, 243, 237, 0.95);
        padding: 8px 12px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-top: 0;
    }

    .btn-prev, .btn-next {
        flex: 1;
        padding: 10px;
        font-size: 15px;
    }
}

@media (max-width: 420px) {
    #book-container {
        padding: 4px 4px 75px;
    }

    .book-header {
        margin-bottom: 8px;
    }

    #flipbook {
        max-width: 280px;
        height: 380px;
        max-height: calc(100vh - 130px);
        margin-bottom: 2px;
    }

    .page-content {
        padding: 4px 8px;
        overflow: hidden;
    }

    .page-content img {
        max-width: 100%;
        max-height: 100%;
    }

    .controls {
        bottom: 6px;
        padding: 6px 10px;
        gap: 8px;
    }

    .btn-prev, .btn-next {
        font-size: 14px;
        padding: 8px;
    }
}

/* YouTube Player Container - Hidden */
#youtube-player-container {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}