/* 故事書網頁樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 30%, #F4A460 70%, #DEB887 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 標題區域 */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #8B4513;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.controls {
    display: flex;
    gap: 10px;
}

/* 按鈕樣式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #8B4513;
    color: white;
}

.btn-primary:hover {
    background: #A0522D;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #D2691E;
    color: white;
}

.btn-secondary:hover {
    background: #FF8C00;
    transform: translateY(-2px);
}

.btn-info {
    background: #4682B4;
    color: white;
}

.btn-info:hover {
    background: #5F9EA0;
    transform: translateY(-2px);
}

.btn-warning {
    background: #DAA520;
    color: white;
}

.btn-warning:hover {
    background: #FFD700;
    transform: translateY(-2px);
}

/* 書本容器 */
.book-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 10px 0;
}

/* 書本封面 */
.book-cover {
    position: relative;
    width: 1100px;
    height: 500px;
    max-width: 90vw;
    cursor: pointer;
    transition: all 0.5s ease;
    transform-style: preserve-3d;
}

.book-cover:hover {
    transform: scale(1.05) rotateY(5deg);
}

.cover-content {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #F5F5DC;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(139, 69, 19, 0.8), rgba(210, 105, 30, 0.6));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-cover:hover .cover-overlay {
    opacity: 1;
}

.cover-overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.cover-overlay p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.open-book-btn {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

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

/* 書本閱讀器 */
.book-reader {
    width: 100%;
    max-width: 1400px;
    background: #F5F5DC;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.book-pages {
    display: flex;
    height: 600px;
    position: relative;
    justify-content: center;
}

/* 點擊區域 */
.click-area {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

.left-click-area {
    left: 0;
}

.right-click-area {
    right: 0;
}

.page {
    width: 100%;
    max-width: 1300px;
    position: relative;
    background: #FFFEF7;
    border: 2px solid #E6E6FA;
    border-radius: 10px;
    margin: 0 auto;
}

.current-page {
    display: block;
}

.page-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page-image {
    max-width: 98%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.page-number {
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-size: 14px;
    color: #8B4513;
    font-weight: bold;
}

/* 翻頁控制 */
.page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #F0E68C;
    border-top: 2px solid #D3D3D3;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #8B4513;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background: #A0522D;
    transform: translateY(-2px);
}

.page-btn:disabled {
    background: #D3D3D3;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.page-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #D3D3D3;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B4513, #D2691E);
    width: 0%;
    transition: width 0.3s ease;
}



/* 工具列 */
.toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 50;
}

.tool-btn {
    padding: 8px 15px;
    background: transparent;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    background: rgba(139, 69, 19, 0.1);
    transform: translateY(-2px);
}

/* 面板樣式 */
.share-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.share-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* 分享選項 */
.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.share-btn {
    padding: 12px 20px;
    border: 2px solid #E6E6FA;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.share-btn:hover {
    background: #F0E68C;
    border-color: #D2691E;
}



/* 載入動畫 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.loading-animation {
    margin: 20px 0;
}

.book-loading {
    position: relative;
    width: 60px;
    height: 40px;
    margin: 0 auto;
}

.book-page {
    position: absolute;
    width: 50px;
    height: 35px;
    background: #F5F5DC;
    border: 2px solid #8B4513;
    border-radius: 3px;
    animation: pageFlip 2s infinite;
}

.book-page:nth-child(1) {
    animation-delay: 0s;
    z-index: 3;
}

.book-page:nth-child(2) {
    animation-delay: 0.3s;
    z-index: 2;
}

.book-page:nth-child(3) {
    animation-delay: 0.6s;
    z-index: 1;
}

@keyframes pageFlip {
    0%, 50% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

/* 翻頁動畫 */
.page-transition-slide {
    animation: slideIn 0.5s ease;
}

.page-transition-fade {
    animation: fadeIn 0.5s ease;
}

.page-transition-flip {
    animation: flipIn 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes flipIn {
    from {
        transform: rotateY(-90deg);
        opacity: 0;
    }
    to {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .book-cover {
        width: 95%;
        max-width: 900px;
        height: 400px;
    }
    
    .book-pages {
        height: 450px;
    }
    
    .page {
        max-width: 95%;
        height: 450px;
    }
    
    .page-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .toolbar {
        bottom: 10px;
        padding: 8px 15px;
    }
    
    .tool-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .book-cover {
        width: 98%;
        max-width: 600px;
        height: 300px;
    }
    
    .page {
        height: 350px;
        max-width: 98%;
    }
    
    .book-pages {
        height: 350px;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .settings-content,
    .bookmark-content,
    .share-content {
        margin: 20px;
        padding: 20px;
    }
}