/* EPUB Export Styles */

.epub-export {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.epub-export h1 {
    margin-bottom: 0.5em;
}

.epub-export h1 big {
    font-size: 1.2em;
    margin-right: 0.3em;
    color: #666;
}

.epub-export-intro {
    color: #666;
    margin-bottom: 2em;
    font-size: 0.95em;
}

.export-section {
    margin-bottom: 2em;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 8px;
}

.export-section h2 {
    margin: 0 0 1em 0;
    font-size: 1.1em;
    color: #333;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.category-btn:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.category-btn.active {
    border-color: #4a90d9;
    background: #e8f4ff;
}

.category-btn .cat-emoji {
    font-size: 1.8em;
}

.category-btn .category-name {
    font-size: 0.95em;
    font-weight: 500;
    color: #333;
}

/* Year Range */
.year-range-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.year-range-inputs label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #555;
}

.year-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    min-width: 100px;
}

.btn-small {
    padding: 8px 16px;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-small:hover {
    background: #5a6268;
}

.range-info {
    margin-top: 10px;
    font-size: 0.9em;
    color: #28a745;
}

.range-info.error {
    color: #dc3545;
}

/* Options */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.option-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-hint {
    margin: 0 0 15px 26px;
    font-size: 0.85em;
    color: #888;
}

/* Size Warning */
.size-warning {
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 1em;
    color: #856404;
    font-size: 0.9em;
}

/* Time Warning */
.time-warning {
    padding: 12px 16px;
    background: #e7f3ff;
    border: 1px solid #b6d4fe;
    border-radius: 6px;
    margin-bottom: 1em;
    color: #084298;
    font-size: 0.9em;
}

/* Export Button */
.btn-export {
    width: 100%;
    padding: 14px 24px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-export:hover:not(:disabled) {
    background: #357ab8;
}

.btn-export:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Progress */
.export-progress {
    margin-top: 1em;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #28a745;
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    margin: 8px 0 0 0;
    font-size: 0.9em;
    color: #666;
    text-align: center;
}

/* Catalog counts */
.category-btn .category-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-btn .category-count {
    font-size: 0.8em;
    color: #777;
}

.category-btn:disabled,
.btn-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Series (Tracts) */
.series-row {
    margin-bottom: 12px;
}

.series-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #555;
}

.series-select {
    min-width: 240px;
    max-width: 100%;
}

/* Progress messages and actions */
.progress-text.error {
    color: #dc3545;
}

.progress-text.success {
    color: #28a745;
}

.export-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.export-actions .btn-small {
    text-decoration: none;
}

.btn-cancel {
    background: #dc3545;
}

.btn-cancel:hover {
    background: #b52b38;
}

.btn-download {
    background: #28a745;
    color: #fff;
}

.btn-download:hover {
    background: #218838;
    color: #fff;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .year-range-inputs {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .year-range-inputs label {
        width: 100%;
    }
    
    .year-select {
        flex: 1;
        width: 100%;
    }
    
    .btn-small {
        width: 100%;
        margin-top: 5px;
    }

    .series-row label {
        flex-direction: column;
        align-items: flex-start;
    }

    .series-select {
        width: 100%;
        min-width: 0;
    }

    .export-actions .btn-small {
        text-align: center;
        box-sizing: border-box;
    }
}

/* ===== Dark theme ===== */
body.dark-mode .epub-export {
    color: #d4d0cb;
}

body.dark-mode .epub-export h1,
body.dark-mode .epub-export a h1 {
    color: #e8e5e0;
}

body.dark-mode .epub-export a {
    color: #9db8cc;
}

body.dark-mode .epub-export h1 big {
    color: #888;
}

body.dark-mode .epub-export-intro {
    color: #888;
}

body.dark-mode .export-section {
    background: #252525;
}

body.dark-mode .export-section h2 {
    color: #e8e5e0;
}

body.dark-mode .category-btn {
    background: #2a2a2a;
    border-color: #3d3d3d;
}

body.dark-mode .category-btn:hover {
    border-color: #5a8fd9;
    background: #2f3540;
}

body.dark-mode .category-btn.active {
    border-color: #5a8fd9;
    background: #2a3848;
}

body.dark-mode .category-btn .category-name {
    color: #d4d0cb;
}

body.dark-mode .year-range-inputs label {
    color: #bbb;
}

body.dark-mode .year-select {
    background: #2a2a2a;
    color: #d4d0cb;
    border-color: #3d3d3d;
}

body.dark-mode .year-select option {
    background: #2a2a2a;
    color: #d4d0cb;
}

body.dark-mode .btn-small {
    background: #555;
    color: #eee;
}

body.dark-mode .btn-small:hover {
    background: #666;
}

body.dark-mode .range-info {
    color: #6fcf97;
}

body.dark-mode .range-info.error {
    color: #f0a0a8;
}

body.dark-mode .option-label {
    color: #d4d0cb;
}

body.dark-mode .option-hint {
    color: #777;
}

body.dark-mode .size-warning {
    background: #3a3420;
    border-color: #c9a227;
    color: #e8d48b;
}

body.dark-mode .time-warning {
    background: #1e2a3a;
    border-color: #3a5d97;
    color: #9db8cc;
}

body.dark-mode .btn-export {
    background: #4a90d9;
    color: #fff;
}

body.dark-mode .btn-export:hover:not(:disabled) {
    background: #5a9fe0;
}

body.dark-mode .btn-export:disabled {
    background: #444;
    color: #888;
}

body.dark-mode .progress-bar {
    background: #333;
}

body.dark-mode .progress-text {
    color: #888;
}

body.dark-mode .category-btn .category-count {
    color: #999;
}

body.dark-mode .series-row label {
    color: #bbb;
}

body.dark-mode .progress-text.error {
    color: #f08080;
}

body.dark-mode .progress-text.success {
    color: #7ccf8f;
}

body.dark-mode .export-actions a.btn-download {
    color: #fff;
}

body.dark-mode .btn-small.btn-cancel {
    background: #a83a44;
}

body.dark-mode .btn-small.btn-download {
    background: #2f8a45;
}
