/**
 * Superior e-Pub Viewer — Core reader styles.
 */

/* Container */
.wpkko-epub-viewer {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.wpkko-epub-viewer * {
    box-sizing: border-box;
}

/* Toolbar */
.wpkko-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    z-index: 10;
}

.wpkko-btn {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}

.wpkko-btn:hover {
    opacity: 0.8;
}

.wpkko-icon {
    display: inline-block;
}

.wpkko-page-info {
    font-size: 13px;
    padding: 0 6px;
    min-width: 40px;
    text-align: center;
}

.wpkko-skin-switcher {
    margin-left: auto;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    background: transparent;
    max-width: 180px;
}

/* Reader area */
.wpkko-reader-area {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* Loading overlay */
.wpkko-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 20;
}

.wpkko-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #ddd;
    border-top-color: #555;
    border-radius: 50%;
    animation: wpkko-spin 0.8s linear infinite;
}

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

/* Sidebar panels (TOC, Search, Bookmarks) */
.wpkko-toc-sidebar,
.wpkko-search-panel,
.wpkko-bookmarks-panel {
    position: absolute;
    top: 42px;
    left: 0;
    width: 280px;
    max-height: calc(100% - 50px);
    overflow-y: auto;
    z-index: 15;
    border-right: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 0 0 8px 0;
    padding: 0;
}

.wpkko-toc-header,
.wpkko-search-header,
.wpkko-bookmarks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    font-size: 14px;
}

.wpkko-toc-list,
.wpkko-search-results,
.wpkko-bookmarks-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wpkko-toc-list li,
.wpkko-search-results li,
.wpkko-bookmarks-list li {
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.wpkko-toc-list a,
.wpkko-search-results a,
.wpkko-bookmarks-list a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.wpkko-toc-list a:hover,
.wpkko-search-results a:hover,
.wpkko-bookmarks-list a:hover {
    opacity: 0.8;
}

.wpkko-toc-list ul {
    list-style: none;
    padding-left: 16px;
    margin: 0;
}

.wpkko-search-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    font-size: 13px;
    margin-right: 4px;
}

.wpkko-btn-search-go {
    padding: 4px 8px;
    font-size: 13px;
    margin-right: 4px;
}

.wpkko-no-results,
.wpkko-no-bookmarks {
    padding: 12px;
    font-style: italic;
    font-size: 13px;
    opacity: 0.7;
}

/* Text color button */
.wpkko-btn-text-color .wpkko-icon {
    font-weight: bold;
    font-size: 15px;
}

.wpkko-btn-delete-bookmark {
    float: right;
    font-size: 16px;
    border: none !important;
    background: none !important;
    cursor: pointer;
    opacity: 0.6;
    padding: 8px 12px !important;
}

.wpkko-btn-delete-bookmark:hover {
    opacity: 1;
}

/* Toast notifications */
.wpkko-toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 30;
    background: #333;
    color: #fff;
    opacity: 1;
    transition: opacity 0.4s;
}

.wpkko-toast-fade {
    opacity: 0;
}

/* Login notice */
.wpkko-epub-login-notice {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
}

.wpkko-epub-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
}

/* Fullscreen */
.wpkko-epub-viewer:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .wpkko-toolbar {
        gap: 2px;
        padding: 4px 6px;
    }

    .wpkko-btn {
        padding: 3px 5px;
        font-size: 12px;
    }

    .wpkko-toc-sidebar,
    .wpkko-search-panel,
    .wpkko-bookmarks-panel {
        width: 100%;
        border-right: none;
        border-radius: 0;
    }

    .wpkko-skin-switcher {
        max-width: 120px;
        font-size: 11px;
    }
}
