/*
 * Olesen site - common stylesheet
 * Path: /files/wwwroot/olesen/css/default.css
 *
 * Updated 2026-11-09:
 *  - NEW. Consolidates the per-app stylesheets (root default.css,
 *    reader/default.css, issues/default.css) into one file.
 *  - Each app's rules are scoped to its page so they cannot leak into
 *    each other:
 *      portal section  -> body.portal   (root index.php, login, cc)
 *      reader section  -> body.reader   (/reader)
 *      legacy section  -> .legacy       (/issues; wrap page content in <div class="legacy">)
 *  - Time-of-day dark theme (html.dark-theme) applies to all three sections.
 *  - parking/default.css is unchanged (used only by parking/index.html).
 */

/* ===== PORTAL (body.portal) ===== */
* {
    box-sizing: border-box;
}

body.portal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    padding: 20px 15px;
}

.container {
    max-width: 820px;
    margin: 0 auto;
}

.container-login {
    max-width: 420px;
    padding-top: 20px;
}

.inline-form {
    display: inline;
}

.hidden-element {
    display: none;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 1px solid #e1e4e8;
}

.nav-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e1e4e8;
}

.card-login {
    padding: 28px;
    text-align: center;
}

.card-title {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.25rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.card-login .card-title {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 12px;
    text-align: left;
}

.card-login .form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #4a5568;
}

.card-login .form-group label {
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 1rem;
    text-align: center;
    letter-spacing: 2px;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.add-form {
    display: none;
    gap: 10px;
    margin-bottom: 18px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.add-form.open {
    display: flex;
}

.add-form input {
    padding: 8px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 0.88rem;
}

.add-form input[name="title"] { flex: 2;
}

.add-form input[name="url"] { flex: 3;
}

.add-form input[name="sort_order"] { flex: 1; min-width: 80px;
}

.btn {
    background-color: #3498db;
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-block;
}

.btn:hover { background-color: #2980b9;
}

.btn-full {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.95rem;
}

.btn-success { background-color: #2ecc71;
}

.btn-success:hover { background-color: #27ae60;
}

.btn-warning { background-color: #f39c12;
}

.btn-warning:hover { background-color: #d68910;
}

.btn-danger { background-color: #e74c3c;
}

.btn-danger:hover { background-color: #c0392b;
}

.btn-secondary { background-color: #718096;
}

.btn-secondary:hover { background-color: #4a5568;
}

.btn-info { 
    background-color: #3498db; 
    cursor: default; 
    min-width: 35px; 
    text-align: center;
}

.btn-small { 
    padding: 5px 10px; 
    font-size: 0.8rem;
}

.badge { 
    background: #e2e8f0; 
    color: #2d3748; 
    padding: 4px 10px; 
    border-radius: 12px; 
    font-size: 0.8rem; 
    font-weight: 600;
}

.error-msg {
    color: #e74c3c;
    margin-top: 14px;
    margin-bottom: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.alert-error {
    background: #fed7d7;
    color: #c53030;
    padding: 10px 14px;
    border-radius: 5px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.88rem;
}

.delete-warning {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

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

.link-item {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.link-item:last-child { 
    border-bottom: none;
}

.link-item a {
    color: #1a0dab;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    word-break: break-all;
}

.link-item a:hover { 
    text-decoration: underline;
}

.item-actions { 
    display: flex; 
    gap: 6px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active { 
    display: flex;
}

.modal-card {
    background: #ffffff;
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e4e8;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

html.dark-theme {
    color-scheme: dark;
}

html.dark-theme body.portal {
    background-color: #121212;
    color: #e0e0e0;
}

html.dark-theme .nav-bar {
    background: #1f242d;
    border-color: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html.dark-theme .nav-title {
    color: #f7fafc;
}

html.dark-theme .card, html.dark-theme .modal-card {
    background: #1f242d;
    border-color: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

html.dark-theme .card-title {
    color: #f7fafc;
    border-bottom-color: #3498db;
}

html.dark-theme .form-group label {
    color: #a0aec0;
}

html.dark-theme .form-group input, html.dark-theme .form-control, html.dark-theme .add-form input {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e0e0e0;
}

html.dark-theme .form-group input::placeholder, html.dark-theme .form-control::placeholder, html.dark-theme .add-form input::placeholder {
    color: #718096;
}

html.dark-theme .form-control:focus, html.dark-theme .form-group input:focus, html.dark-theme .add-form input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

html.dark-theme .add-form {
    background: #1a202c;
    border-color: #2d3748;
}

html.dark-theme .badge {
    background: #2d3748;
    color: #e2e8f0;
}

html.dark-theme .alert-error {
    background: #552222;
    color: #fed7d7;
}

html.dark-theme .error-msg, html.dark-theme .delete-warning {
    color: #fc8181;
}

html.dark-theme .link-item {
    border-bottom-color: #2d3748;
}

html.dark-theme .link-item a {
    color: #63b3ed;
}

html.dark-theme .link-item a:hover {
    color: #90cdf4;
}

html.dark-theme .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* ===== READER (body.reader) ===== */
body.reader * { box-sizing: border-box; margin: 0; padding: 0; font-family: sans-serif;
}

body.reader { background: #f4f6f9; color: #333; padding-top: 80px;
}

body.reader .header-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background-color: #f8f9fa; width: 100%; box-sizing: border-box;
}

body.reader .header-bar h2 { margin: 0; white-space: nowrap;
}

body.reader .header-controls { 
    display: flex; 
    flex-wrap: wrap; 
    align-items: center; 
    gap: 8px; 
    flex: 1 1 auto; 
    justify-content: center;
}

body.reader .header-controls input[type="text"], body.reader .header-controls select, body.reader .header-controls button { padding: 8px 12px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; height: 38px;
}

body.reader .header-controls input[type="text"] { width: 200px; flex: 0 0 200px;
}

body.reader #upload-form { display: flex; margin: 0;
}

body.reader #upload-form button { width: 100%;
}

body.reader .grid-container { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; max-width: 1400px; margin: 0 auto;
}

body.reader .card, body.reader .card-master, body.reader .group-wrapper { background: white; border-radius: 8px; padding: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; position: relative; transition: transform 0.2s; width: 300px; max-width: 300px; flex: 1 1 300px; min-height: 180px;
}

body.reader .card-master { background: #34495e; color: #ffffff;
}

body.reader .card:hover, body.reader .card-master:hover { transform: translateY(-3px);
}

body.reader .card-title { font-weight: bold; font-size: 16px; margin-bottom: 5px; color: #2c3e50; padding-right: 60px; word-break: break-word;
}

body.reader .card-series { font-size: 12px; color: #2980b9; margin-bottom: 15px; font-style: italic;
}

body.reader .card-author-badge { 
    display: inline-block; 
    width: fit-content; 
    background-color: #f2f4f6; 
    color: #57626c; 
    border: 1px solid #dde3e8; 
    border-radius: 12px; 
    padding: 3px 10px; 
    font-size: 12px; 
    font-weight: 600; 
    margin-bottom: 8px; 
    letter-spacing: 0.2px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 100%;
}

body.reader .card-series-badge { 
    display: inline-block; 
    width: fit-content; 
    background-color: #eef6fc; 
    color: #2980b9; 
    border: 1px solid #bce1f7; 
    border-radius: 12px; 
    padding: 3px 10px; 
    font-size: 11px; 
    font-weight: 600; 
    margin-top: 6px; 
    margin-bottom: 12px; 
    letter-spacing: 0.3px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 100%;
}

body.reader .badge-subject { position: absolute; top: 12px; right: 12px; background-color: #3498db; color: #ffffff; padding: 3px 8px; font-size: 0.72rem; border-radius: 4px; font-weight: 600; text-transform: capitalize; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

body.reader .card-author-badge, body.reader .card-series-badge, body.reader .badge-subject { cursor: pointer; transition: filter 0.15s ease;
}

body.reader .card-author-badge:hover, body.reader .card-series-badge:hover, body.reader .badge-subject:hover { filter: brightness(0.94);
}

body.reader .progress-container { background: #eee; height: 8px; border-radius: 4px; overflow: hidden;
}

body.reader .progress-bar { background: #3498db; height: 100%; width: 0%;
}

body.reader .progress-text { font-size: 11px; color: #888; margin-top: 4px; text-align: right;
}

body.reader .context-menu { position: absolute; display: none; background: white; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); width: 150px; z-index: 2000;
}

body.reader .context-menu div { padding: 10px 15px; cursor: pointer; font-size: 14px; color: inherit;
}

body.reader .context-menu div:hover { background: #3498db; color: white;
}

body.reader .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 3000;
}

body.reader .modal { background: white; padding: 20px; border-radius: 8px; width: 400px; max-width: 90%; max-height: 90vh; overflow-y: auto;
}

body.reader .modal h3 { margin-bottom: 15px;
}

body.reader .modal label { display: block; margin-top: 10px; font-size: 12px; color: #666;
}

body.reader .modal input, body.reader .modal textarea { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 14px;
}

body.reader .modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px;
}

body.reader .master-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}

body.reader .master-title { font-size: 18px; font-weight: bold; color: #ecf0f1; word-break: break-word;
}

body.reader .master-badge { background: #3498db; color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; white-space: nowrap;
}

body.reader .master-footer { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #bdc3c7; margin-top: 15px;
}

body.reader .master-toggle-icon { font-weight: bold; font-size: 16px;
}

body.reader .group-content { display: none; width: 100%; flex: 0 0 100%; flex-wrap: wrap; gap: 20px; padding: 20px; background: #eef2f5; border-radius: 8px; border-left: 5px solid #34495e; box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); margin: 10px 0;
}

body.reader .group-content.open { display: flex;
}

body.reader .reader-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #1e1e1e; display: none; flex-direction: column; z-index: 4000;
}

body.reader .reader-header { height: 50px; background: #2c3e50; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

body.reader .reader-title { font-weight: bold; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}

body.reader .reader-controls { display: flex; align-items: center; gap: 15px; font-size: 14px;
}

body.reader .reader-controls button, body.reader .reader-close-btn { padding: 6px 14px; background: #34495e; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold;
}

body.reader .reader-controls button:hover, body.reader .reader-close-btn:hover { background: #3498db;
}

body.reader .reader-close-btn { background: #e74c3c;
}

body.reader .reader-close-btn:hover { background: #c0392b;
}

body.reader .reader-body { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: center; background: #2c2c2c; position: relative;
}

body.reader #pdf-canvas { max-width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.reader #epub-viewer { width: 100%; height: 100%; background: white;
}

body.reader .modal-content { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body.reader .epub-modal-content { width: 100%; height: 85vh;
}

body.reader #epub-render-area { flex: 1 1 auto; width: 100%; height: 100%; min-height: 400px; position: relative; background: #ffffff;
}

body.reader #epub-render-area iframe { width: 100% !important; height: 100% !important; border: none !important;
}

body.reader .pdf-modal-content { width: 100%; height: 90vh;
}

body.reader .viewer-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #2c3e50; color: #ffffff; flex: 0 0 auto;
}

body.reader .viewer-header span { font-weight: bold; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%;
}

body.reader .viewer-header .viewer-zoom-display { font-weight: 400; font-size: 12px; color: #b8c2cc; max-width: none; margin: 0 8px; flex: 0 0 auto;
}

body.reader .viewer-controls { display: flex; align-items: center; gap: 10px;
}

body.reader .viewer-controls button { background-color: #34495e; color: #ffffff; padding: 6px 12px; font-size: 0.85rem;
}

body.reader .viewer-controls button:hover { background-color: #1a242f;
}

body.reader .viewer-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background: #2c3e50; color: #ffffff; border-top: 1px solid #ddd; flex: 0 0 auto;
}

body.reader .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #f4f4f4; border-bottom: 1px solid #ddd;
}

body.reader .modal-close { font-size: 24px; background: none; border: none; cursor: pointer;
}

body.reader .pdf-viewer-body { position: absolute; inset: 0; overflow: auto; display: flex; background: #525659; padding: 10px;
}

body.reader #pdf-render-canvas { margin: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.3); display: block;
}

body.reader .pdf-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background: #f4f4f4; border-top: 1px solid #ddd;
}

body.reader .pdf-page-indicator input { width: 50px; text-align: center; padding: 4px;
}

body.reader button, body.reader .btn { display: inline-flex; align-items: center; justify-content: center; background-color: #3498db; color: #ffffff; border: none; padding: 8px 14px; border-radius: 5px; cursor: pointer; font-weight: 600; font-size: 0.88rem; font-family: inherit; line-height: 1.2; text-decoration: none; transition: background-color 0.2s ease, opacity 0.2s ease; outline: none;
}

body.reader button:hover, body.reader .btn:hover { background-color: #2980b9;
}

body.reader button:active, body.reader .btn:active { transform: translateY(1px);
}

body.reader .btn-small { padding: 6px 10px; font-size: 0.78rem; height: auto;
}

body.reader .btn-danger { background-color: #e74c3c; color: #ffffff;
}

body.reader .btn-danger:hover { background-color: #c0392b;
}

body.reader .modal-close, body.reader .reader-close-btn, body.reader button[onclick*="close"] { background: #e74c3c; color: #ffffff; border: none;
}

body.reader .modal-close:hover, body.reader .reader-close-btn:hover, body.reader button[onclick*="close"]:hover { background: #c0392b;
}

body.reader .modal-header .modal-close { background: transparent; color: #7f8c8d; font-size: 20px; padding: 2px 8px; border-radius: 4px;
}

body.reader .modal-header .modal-close:hover { background: #e2e8f0; color: #2c3e50;
}

body.reader .modal-actions button[type="submit"], body.reader .modal-actions button[onclick*="save"] { background-color: #2ecc71; color: #ffffff;
}

body.reader .modal-actions button[type="submit"]:hover, body.reader .modal-actions button[onclick*="save"]:hover { background-color: #27ae60;
}

body.reader .modal-actions button[type="button"]:not([class*="btn-"]), body.reader button.btn-secondary { background-color: #718096; color: #ffffff;
}

body.reader .modal-actions button[type="button"]:not([class*="btn-"]):hover, body.reader button.btn-secondary:hover { background-color: #4a5568;
}

body.reader .search-container { position: relative; display: inline-flex; align-items: center; width: 200px;
}

body.reader .search-container input[type="text"] { width: 100% !important; padding-right: 30px !important;
}

body.reader #clear-search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    color: #888;
    font-size: 14px;
    font-weight: bold;
    line-height: 1 !important;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

body.reader #clear-search-btn:hover {
    color: #333;
    background-color: #e2e8f0 !important;
}

body.reader .pdf-toolbar button, body.reader .reader-controls button, body.reader #epub-viewer-modal button:not([onclick*="close"]) { background-color: #34495e; color: #ffffff; padding: 6px 12px; font-size: 0.85rem;
}

body.reader .pdf-toolbar button:hover, body.reader .reader-controls button:hover, body.reader #epub-viewer-modal button:not([onclick*="close"]):hover { background-color: #2c3e50;
}

body.reader #toggle-dark-btn { background-color: #8e44ad;
}

body.reader #toggle-dark-btn:hover { background-color: #732d91;
}

body.reader .viewer-header .viewer-controls button, body.reader .viewer-footer button {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.reader .viewer-header .viewer-controls button:hover, body.reader .viewer-footer button:hover {
    background-color: #333333 !important;
}

body.reader .viewer-header .viewer-controls button.active {
    background-color: #8e44ad !important;
}

body.reader .viewer-header .viewer-controls button.active:hover {
    background-color: #732d91 !important;
}

body.reader .viewer-render-wrapper {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.reader .tap-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    z-index: 10;
    cursor: pointer;
}

body.reader .tap-zone-left { left: 0;
}

body.reader .tap-zone-right { right: 18px;
}

@media screen and (max-width: 768px) {
body.reader .header-bar { position: sticky; top: 0; z-index: 1000; display: flex; flex-direction: column; align-items: stretch; padding: 10px 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body.reader .header-bar h2 { text-align: center; margin-bottom: 6px; font-size: 1.1rem;
}

body.reader .header-controls { display: flex; flex-wrap: wrap; width: 100%; gap: 6px; justify-content: center;
}

body.reader .header-controls .search-container, body.reader .header-controls select {
        flex: 1 1 110px;
        min-width: 90px;
        width: auto !important;
        max-width: none !important;
}

body.reader .header-controls .search-container input[type="text"] {
        width: 100% !important;
        flex: 1 1 auto !important;
}

body.reader #upload-form { flex: 1 1 90px; display: flex;
}

body.reader .header-controls a.btn, body.reader .header-controls label.btn {
        flex: 1 1 90px;
        min-width: 80px;
        white-space: nowrap;
        text-align: center;
}

body.reader .grid-container { padding: 10px; gap: 12px;
}

body.reader .card, body.reader .card-master, body.reader .group-wrapper { width: 100%; max-width: 300px; flex: 1 1 300px;
}

body.reader .modal-overlay { padding: 0 !important;
}

body.reader .epub-modal-content, body.reader .pdf-modal-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
}

body.reader .epub-modal-content, body.reader .pdf-modal-content {
        height: 100dvh !important;
        max-height: 100dvh !important;
}

body.reader .viewer-header, body.reader .viewer-footer { flex-wrap: wrap; row-gap: 6px;
}
}

html.dark-theme body.reader  {
    color-scheme: dark;
}

html.dark-theme body.reader {
    background: #121212;
    color: #e0e0e0;
}

html.dark-theme body.reader .header-bar {
    background-color: #1f242d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

html.dark-theme body.reader .header-controls input[type="text"], html.dark-theme body.reader .header-controls select, html.dark-theme body.reader .header-controls button {
    background-color: #2d3748;
    color: #e0e0e0;
    border-color: #4a5568;
}

html.dark-theme body.reader .header-controls input[type="text"]::placeholder {
    color: #a0aec0;
}

html.dark-theme body.reader .card, html.dark-theme body.reader .card-master, html.dark-theme body.reader .group-wrapper {
    background: #1f242d;
    color: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

html.dark-theme body.reader .card-title {
    color: #f7fafc;
}

html.dark-theme body.reader .card-series {
    color: #63b3ed;
}

html.dark-theme body.reader .card-author-badge {
    background-color: #2d3748;
    color: #a0aec0;
    border-color: #4a5568;
}

html.dark-theme body.reader .card-series-badge {
    background-color: #1a365d;
    color: #63b3ed;
    border-color: #2b6cb0;
}

html.dark-theme body.reader .progress-container {
    background: #2d3748;
}

html.dark-theme body.reader .progress-text {
    color: #a0aec0;
}

html.dark-theme body.reader .context-menu, html.dark-theme body.reader .modal {
    background: #1f242d;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

html.dark-theme body.reader .modal label {
    color: #a0aec0;
}

html.dark-theme body.reader .modal input, html.dark-theme body.reader .modal textarea {
    background-color: #2d3748;
    color: #e0e0e0;
    border-color: #4a5568;
}

html.dark-theme body.reader .modal-header {
    background: #1a202c;
    border-bottom-color: #2d3748;
}

html.dark-theme body.reader .modal-header .modal-close {
    color: #a0aec0;
}

html.dark-theme body.reader .modal-header .modal-close:hover {
    background: #2d3748;
    color: #ffffff;
}

html.dark-theme body.reader .group-content {
    background: #1a202c;
    border-left-color: #4a5568;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

html.dark-theme body.reader .master-title {
    color: #f7fafc;
}

html.dark-theme body.reader .master-footer {
    color: #a0aec0;
}

html.dark-theme body.reader #clear-search-btn {
    color: #a0aec0;
}

html.dark-theme body.reader #clear-search-btn:hover {
    color: #ffffff;
    background-color: #4a5568 !important;
}

/* ===== LEGACY (.legacy) ===== */
.legacy * {
        font-family: Arial, sans-serif;
        line-height: 1.6;
        margin: 20px;
        color: #333;
}

.legacy table {
        border-collapse: collapse;
        width: 100%;
        font-family: Arial, Helvetica, sans-serif;
}

.legacy th, .legacy td {
        text-align: left;
        padding: 12px;
        border: 1px solid #ddd;
        font-family: Arial, Helvetica, sans-serif;
}

.legacy th {
        background-color: #f2f2f2;
        font-family: Arial, Helvetica, sans-serif;
}

.legacy .wide-input {
        width: 100ch;
        font-family: Arial, sans-serif; 
        padding: 8px;
        font-size: 14px;
}

.legacy .tall-box {
        width: 100ch;
        height: 6em; 
        display: block;
        font-family: Arial, sans-serif; 
        padding: 8px;
        font-size: 14px;
}

.legacy .btngreen {
        padding: 10px 15px;
        background: green; color: white; 
    	margin-bottom: 10px;
        text-decoration: none;
        border-radius: 4px;
        display: inline-block;
        border: none;
        cursor: pointer;
        font-family: Arial, Helvetica, sans-serif;
}

.legacy .btn {
        padding: 10px 15px;
     	margin-bottom: 10px;
        text-decoration: none;
        border-radius: 4px;
        display: inline-block;
        border: none;
        cursor: pointer;
        font-family: Arial, Helvetica, sans-serif;
}

/* Legacy pages: time-of-day dark theme */
html.dark-theme .legacy {
    background: #121212;
    color: #e0e0e0;
}
html.dark-theme .legacy th {
    background-color: #1f242d;
}
html.dark-theme .legacy th,
html.dark-theme .legacy td {
    border-color: #2d3748;
}
html.dark-theme .legacy input,
html.dark-theme .legacy select,
html.dark-theme .legacy textarea {
    background-color: #2d3748;
    color: #e0e0e0;
    border-color: #4a5568;
}
