/**
 * WIA Book Reader - Frontend CSS
 * 弘益人間 - 널리 인간을 이롭게
 */

.wiabook-reader-container {
    font-family: Georgia, 'Noto Serif KR', serif;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Loading */
.wiabook-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

.wiabook-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: wiabook-spin 1s linear infinite;
}

@keyframes wiabook-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toolbar */
.wiabook-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #333;
    color: white;
}

.wiabook-toolbar-left,
.wiabook-toolbar-center,
.wiabook-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wiabook-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.wiabook-btn:hover {
    background: rgba(255,255,255,0.1);
}

.wiabook-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.wiabook-page-info {
    font-size: 14px;
    min-width: 80px;
    text-align: center;
}

/* Content Area */
.wiabook-content {
    display: flex;
    flex: 1;
    min-height: 400px;
    overflow: hidden;
}

.wiabook-sidebar {
    width: 250px;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    padding: 15px;
    overflow-y: auto;
    display: none;
}

.wiabook-sidebar.active {
    display: block;
}

.wiabook-sidebar h3 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-size: 16px;
}

.wiabook-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wiabook-toc-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.wiabook-toc-list a {
    color: #333;
    text-decoration: none;
}

.wiabook-toc-list a:hover {
    color: #667eea;
}

.wiabook-main {
    flex: 1;
    padding: 30px 50px;
    overflow-y: auto;
    line-height: 1.8;
}

.wiabook-chapter-content {
    max-width: 700px;
    margin: 0 auto;
}

.wiabook-chapter-content h1,
.wiabook-chapter-content h2,
.wiabook-chapter-content h3 {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.wiabook-chapter-content p {
    margin-bottom: 1em;
    text-align: justify;
}

.wiabook-chapter-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}

/* Braille Sidebar */
.wiabook-braille-sidebar {
    border-right: none;
    border-left: 1px solid #ddd;
}

.wiabook-braille-content {
    font-family: 'Braille', monospace;
    font-size: 24px;
    line-height: 1.5;
    letter-spacing: 2px;
}

/* Themes */
.wiabook-reader-container[data-theme="dark"] {
    background: #1a1a1a;
    color: #e0e0e0;
}

.wiabook-reader-container[data-theme="dark"] .wiabook-sidebar {
    background: #252525;
    border-color: #333;
}

.wiabook-reader-container[data-theme="dark"] .wiabook-toc-list a {
    color: #e0e0e0;
}

.wiabook-reader-container[data-theme="sepia"] {
    background: #f4ecd8;
    color: #5c4b37;
}

.wiabook-reader-container[data-theme="sepia"] .wiabook-sidebar {
    background: #e8dcc8;
}

/* Fullscreen */
.wiabook-reader-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    border-radius: 0;
}

/* Error */
.wiabook-error {
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    color: #c53030;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .wiabook-main {
        padding: 20px;
    }
    
    .wiabook-sidebar {
        position: absolute;
        left: 0;
        top: 50px;
        height: calc(100% - 50px);
        z-index: 10;
    }
    
    .wiabook-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
}
