/**
 * Creative Book Layout Plugin - Enhanced 3D Styles
 * 本格的な3D本表現とユーザビリティ向上
 */

/* ==========================================================================
   3D Book Container & Environment
   ========================================================================== */

.cbl-book-container {
    position: relative;
    margin: 2rem auto;
    max-width: 1400px;
    min-height: 800px;
    font-family: 'Georgia', 'Times New Roman', serif;
    background: 
        radial-gradient(circle at 30% 70%, rgba(120, 100, 80, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(90, 70, 60, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    perspective: 2000px;
    perspective-origin: 50% 50%;
    overflow: hidden;
}

/* 環境光エフェクト */
.cbl-book-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 60% 40%, 
            rgba(255, 255, 255, 0.1) 0%, 
            rgba(255, 255, 255, 0.05) 30%, 
            transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.cbl-book-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

/* ==========================================================================
   Enhanced 3D Book Structure
   ========================================================================== */

.cbl-book {
    position: relative;
    width: 800px;
    height: 600px;
    background: #ffffff;
    border-radius: 12px;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 0 0 2px rgba(139, 69, 19, 0.3),
        0 15px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

/* 本の厚み表現（複数の影レイヤー） */
.cbl-book::before {
    content: '';
    position: absolute;
    top: 5px;
    left: -8px;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #d4af8c 0%, #c49c7a 100%);
    border-radius: 8px 12px 12px 8px;
    z-index: -1;
    transform: translateZ(-20px);
    box-shadow: 
        -2px 0 4px rgba(0, 0, 0, 0.3),
        -4px 0 8px rgba(0, 0, 0, 0.2),
        -6px 0 12px rgba(0, 0, 0, 0.1);
}

.cbl-book::after {
    content: '';
    position: absolute;
    top: 8px;
    left: -12px;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #b8935f 0%, #a68556 100%);
    border-radius: 6px 12px 12px 6px;
    z-index: -2;
    transform: translateZ(-40px);
    box-shadow: 
        -3px 0 6px rgba(0, 0, 0, 0.4),
        -6px 0 12px rgba(0, 0, 0, 0.3),
        -9px 0 18px rgba(0, 0, 0, 0.2);
}

/* Book spine decoration */
.cbl-book-spine {
    position: absolute;
    left: -12px;
    top: 0;
    width: 12px;
    height: 100%;
    background: linear-gradient(to bottom, 
        #8B4513 0%, 
        #A0522D 20%, 
        #CD853F 40%, 
        #DEB887 60%, 
        #F4A460 80%, 
        #D2B48C 100%);
    border-radius: 8px 0 0 8px;
    z-index: -1;
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.3);
}

.cbl-book-spine::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 2px;
    width: 6px;
    height: 80%;
    background: linear-gradient(to bottom, 
        rgba(255, 215, 0, 0.6) 0%, 
        rgba(255, 215, 0, 0.3) 50%, 
        rgba(255, 215, 0, 0.6) 100%);
    border-radius: 3px;
}

/* ==========================================================================
   Advanced Page System
   ========================================================================== */

.cbl-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(45deg, transparent 49%, rgba(0, 0, 0, 0.02) 50%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, rgba(0, 0, 0, 0.02) 50%, transparent 51%),
        #ffffff;
    background-size: 20px 20px;
    border-radius: 12px;
    padding: 3rem 2rem;
    overflow-y: auto;
    transform-style: preserve-3d;
    transform-origin: left center;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        inset 0 0 0 1px rgba(0, 0, 0, 0.1),
        inset 20px 0 20px -20px rgba(139, 69, 19, 0.1);
    z-index: 1;
}

/* Page flip states */
.cbl-page.cbl-flipping-out {
    transform: rotateY(-180deg);
    z-index: 2;
}

.cbl-page.cbl-flipping-in {
    transform: rotateY(-180deg);
    z-index: 1;
}

.cbl-page.cbl-page-back {
    transform: rotateY(-180deg);
    background: 
        linear-gradient(45deg, transparent 49%, rgba(0, 0, 0, 0.02) 50%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, rgba(0, 0, 0, 0.02) 50%, transparent 51%),
        #f8f8f8;
    box-shadow: 
        inset 0 0 0 1px rgba(0, 0, 0, 0.1),
        inset -20px 0 20px -20px rgba(139, 69, 19, 0.1);
}

.cbl-page-content {
    position: relative;
    height: 100%;
    backface-visibility: hidden;
}

/* Current page highlighting */
.cbl-page.cbl-current {
    z-index: 3;
    box-shadow: 
        0 5px 20px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(0, 0, 0, 0.1),
        inset 20px 0 20px -20px rgba(139, 69, 19, 0.15);
}

/* ==========================================================================
   Enhanced Cover Page Design
   ========================================================================== */

.cbl-cover-page {
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, 
            #667eea 0%, 
            #764ba2 25%, 
            #8e44ad 50%, 
            #9b59b6 75%, 
            #764ba2 100%);
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 0 3px rgba(139, 69, 19, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 100px rgba(255, 255, 255, 0.1);
}

/* 表紙の装飾パターン */
.cbl-cover-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        );
    opacity: 0.7;
    z-index: 1;
}

.cbl-cover-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    padding: 2rem;
}

.cbl-cover-image {
    margin-bottom: 2rem;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.cbl-cover-image img {
    max-width: 300px;
    height: auto;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.cbl-cover-title h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin: 0 0 1rem 0;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
    font-weight: bold;
    letter-spacing: 3px;
    line-height: 1.2;
}

.cbl-cover-excerpt {
    font-size: clamp(1rem, 2vw, 1.4rem);
    opacity: 0.9;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 1rem;
}

/* ==========================================================================
   Hierarchical Table of Contents
   ========================================================================== */

.cbl-toc-page {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            rgba(0, 0, 0, 0.02) 40px,
            rgba(0, 0, 0, 0.02) 41px
        );
}

.cbl-toc-page h2 {
    text-align: center;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #333;
    margin-bottom: 3rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cbl-toc {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    max-height: 450px;
    overflow-y: auto;
}

.cbl-toc-section {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.cbl-toc-section:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cbl-toc-section h3 {
    font-size: 1.4rem;
    color: #667eea;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-left: 4px solid #667eea;
    border-radius: 0 8px 8px 0;
    position: relative;
    cursor: pointer;
}

.cbl-toc-section h3::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    transition: transform 0.3s ease;
    color: #667eea;
    -webkit-text-fill-color: #667eea;
}

.cbl-toc-section.collapsed h3::after {
    transform: rotate(-90deg);
}

/* Hierarchical list structure */
.cbl-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cbl-toc-section.collapsed ul {
    max-height: 0;
}

.cbl-toc li {
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInFade 0.5s ease forwards;
}

.cbl-toc li:nth-child(1) { animation-delay: 0.1s; }
.cbl-toc li:nth-child(2) { animation-delay: 0.15s; }
.cbl-toc li:nth-child(3) { animation-delay: 0.2s; }
.cbl-toc li:nth-child(4) { animation-delay: 0.25s; }
.cbl-toc li:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInFade {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cbl-toc a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #555;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.cbl-toc a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    transition: width 0.3s ease;
    z-index: -1;
}

.cbl-toc a:hover {
    color: #333;
    border-color: #667eea30;
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.cbl-toc a:hover::before {
    width: 100%;
}

/* Entry icons */
.cbl-toc a::after {
    content: attr(data-type);
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.cbl-toc a[data-type="character"]::after { 
    content: "👤"; 
    background: #e8f5e8;
}
.cbl-toc a[data-type="location"]::after { 
    content: "🏛️"; 
    background: #fff3e0;
}
.cbl-toc a[data-type="item"]::after { 
    content: "⚔️"; 
    background: #f3e5f5;
}

/* ==========================================================================
   Enhanced Character Pages
   ========================================================================== */

.cbl-character-page {
    background: 
        radial-gradient(circle at 85% 15%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
}

.cbl-character-layout {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 2rem;
    height: 100%;
}

.cbl-character-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cbl-character-header h2 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    margin: 0 0 1rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cbl-character-basic-info {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.cbl-character-basic-info span {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cbl-character-body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Enhanced character image container */
.cbl-character-image {
    position: relative;
}

.cbl-character-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.2),
        0 0 0 4px rgba(255, 255, 255, 0.9),
        0 0 0 5px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease;
}

.cbl-character-image img:hover {
    transform: scale(1.02) translateY(-2px);
}

.cbl-character-image::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: 
        conic-gradient(from 45deg, 
            transparent, 
            rgba(102, 126, 234, 0.1), 
            transparent, 
            rgba(118, 75, 162, 0.1), 
            transparent);
    border-radius: 16px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cbl-character-image:hover::after {
    opacity: 1;
}

.cbl-placeholder-image {
    width: 100%;
    height: 300px;
    background: 
        linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    border-radius: 12px;
    font-style: italic;
    position: relative;
    overflow: hidden;
}

.cbl-placeholder-image::before {
    content: '📷';
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Stats grid with enhanced styling */
.cbl-character-stats h3,
.cbl-character-skills h3 {
    font-size: 1.4rem;
    color: #495057;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.cbl-character-stats h3::after,
.cbl-character-skills h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

.cbl-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.cbl-stat {
    background: 
        linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e9ecef;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cbl-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.cbl-stat:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cbl-stat:hover::before {
    transform: translateX(0);
}

.cbl-stat-name {
    display: block;
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cbl-stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Enhanced skill tags */
.cbl-skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cbl-skill-tag {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cbl-skill-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.cbl-skill-tag:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cbl-skill-tag:hover::before {
    left: 100%;
}

/* ==========================================================================
   Enhanced Controls
   ========================================================================== */

.cbl-controls {
    margin-top: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: 
        rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.cbl-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.cbl-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.cbl-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cbl-btn:hover:not(:disabled)::before {
    left: 100%;
}

.cbl-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cbl-btn:disabled {
    background: linear-gradient(135deg, #dee2e6 0%, #ced4da 100%);
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cbl-page-info {
    font-size: 1.1rem;
    color: #495057;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 25px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .cbl-book {
        width: 700px;
        height: 525px;
    }
    
    .cbl-toc {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cbl-book-container {
        padding: 1.5rem;
        margin: 1rem;
    }

    .cbl-book {
        width: 100%;
        max-width: 600px;
        height: 450px;
    }

    .cbl-page {
        padding: 2rem 1.5rem;
    }

    .cbl-character-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .cbl-character-image {
        max-width: 250px;
        margin: 0 auto;
    }

    .cbl-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cbl-controls {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }

    .cbl-btn {
        min-width: 120px;
        padding: 0.75rem 1.5rem;
    }

    .cbl-toc {
        max-height: 350px;
    }
}

@media (max-width: 480px) {
    .cbl-book {
        height: 400px;
    }

    .cbl-page {
        padding: 1.5rem 1rem;
    }

    .cbl-stats-grid {
        grid-template-columns: 1fr;
    }

    .cbl-character-basic-info {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .cbl-toc {
        max-height: 300px;
    }
}

/* ==========================================================================
   Animation & Transitions
   ========================================================================== */

@keyframes bookOpen {
    0% {
        transform: perspective(2000px) rotateY(-30deg) rotateX(5deg);
        opacity: 0;
    }
    100% {
        transform: perspective(2000px) rotateY(0deg) rotateX(0deg);
        opacity: 1;
    }
}

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

.cbl-book {
    animation: bookOpen 1s ease-out;
}

/* Loading animation */
.cbl-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    font-size: 1.2rem;
    color: #667eea;
}

.cbl-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
}

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

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .cbl-page,
    .cbl-btn,
    .cbl-toc a,
    .cbl-stat,
    .cbl-skill-tag {
        transition: none;
    }
    
    .cbl-book {
        animation: none;
    }
    
    .cbl-loading::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cbl-book {
        border: 3px solid #000;
    }

    .cbl-page {
        border: 2px solid #000;
    }

    .cbl-btn {
        border: 2px solid #000;
    }
    
    .cbl-toc a {
        border: 1px solid #000;
    }
}