/* EreadHub Reader Styles */

.ebook-reader-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ebook-reader-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.ebook-reader-title {
    margin: 0 0 15px 0;
    font-size: 1.4em;
    font-weight: 600;
}

.ebook-reader-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ebook-reader-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.ebook-reader-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.ebook-reader-download {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 1);
}

.ebook-reader-download:hover {
    background: rgba(76, 175, 80, 1);
}

.ebook-reader-content {
    padding: 0;
    position: relative;
}

.ebook-reader-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

/* PDF Reader Styles */
.pdf-reader {
    position: relative;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.pdf-reader iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* EPUB Reader Styles */
.epub-reader {
    position: relative;
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
    padding: 20px;
}

.epub-reader-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #666;
    font-size: 1.1em;
}

.epub-reader-loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Markdown Reader Styles */
.markdown-reader {
    position: relative;
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow-y: auto;
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: #333;
    margin: 30px 0 15px 0;
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 2.2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.markdown-content h2 {
    font-size: 1.8em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.markdown-content h3 {
    font-size: 1.4em;
}

.markdown-content p {
    margin: 0 0 20px 0;
    color: #444;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0 0 20px 20px;
    color: #444;
}

.markdown-content li {
    margin: 5px 0;
}

.markdown-content blockquote {
    border-left: 4px solid #667eea;
    margin: 20px 0;
    padding: 10px 20px;
    background: #f8f9fa;
    font-style: italic;
    color: #555;
}

.markdown-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: "Courier New", Consolas, monospace;
    font-size: 0.9em;
}

.markdown-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Courier New", Consolas, monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: left;
}

.markdown-content th {
    background: #f8f9fa;
    font-weight: 600;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 15px 0;
}

.markdown-content a {
    color: #667eea;
    text-decoration: none;
}

.markdown-content a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* Raw markdown display */
.markdown-raw {
    font-family: "Courier New", Consolas, monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    color: #333;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
}

/* Fullscreen styles */
.ebook-reader-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
    margin: 0;
    border-radius: 0;
}

.ebook-reader-fullscreen .ebook-reader-content > div {
    height: calc(100vh - 80px) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ebook-reader-container {
        margin: 10px 0;
        border-radius: 8px;
    }

    .ebook-reader-header {
        padding: 15px;
    }

    .ebook-reader-title {
        font-size: 1.2em;
    }

    .ebook-reader-controls {
        gap: 8px;
    }

    .ebook-reader-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }

    .markdown-reader {
        padding: 20px;
    }

    .epub-reader {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .ebook-reader-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .ebook-reader-btn {
        text-align: center;
    }

    .markdown-reader {
        padding: 15px;
    }

    .markdown-content h1 {
        font-size: 1.8em;
    }

    .markdown-content h2 {
        font-size: 1.5em;
    }
}
