/* ============================================================
   bibliotheses.org — LIS Reviewer Global Stylesheet
   ============================================================
   Table of Contents:
   1.  CSS Variables & Root
   2.  Base / Body
   3.  Header & Navigation
   4.  Buttons
   5.  Layout (Container, Grid, Flex)
   6.  Cards
   7.  Sidebar / Stats
   8.  Forms & Inputs
   9.  Tables
   10. Modal / Overlay
   11. Auth
   12. Status Labels
   13. Footer
   14. Utility Classes
   15. Descriptive Cataloging (descriptive.html)
   16. Shelving Game (shelving-game.html)
   17. Mock Exam (mock-exam.html)
   18. Admin (admin.html, admin-add.html)
   19. Print
   ============================================================ */


/* ===== 1. CSS VARIABLES & ROOT ===== */
:root {
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --primary-dark: #4338ca;
    --bg: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* ===== 2. BASE / BODY ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }


/* ===== 3. HEADER & NAVIGATION ===== */
header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    width: 100%;
}
header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary);
}
header p {
    color: var(--text-muted);
    margin: 5px 0 0 0;
    font-size: 1rem;
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}
nav a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
}
nav a:hover {
    text-decoration: underline;
}

/* Smaller header variant (used on inner pages) */
header.small-header { padding: 20px; }
header.small-header h1 { font-size: 1.5rem; }

/* Back navigation pills */
.back-nav {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 20;
}
.back-btn {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--white);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.back-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}


/* ===== 4. BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-size: 1rem;
    font-weight: bold;
    font-family: var(--font);
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
}
.btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-sm {
    padding: 8px 12px;
    width: auto;
    font-size: 0.85rem;
}

.btn-secondary { background: var(--success); }
.btn-secondary:hover { background: #059669; }

.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger); width: auto; padding: 8px 12px; font-size: 0.85rem; }
.btn-danger:hover { background: #dc2626; }

.btn-skip { background: var(--text-muted); }

.btn-lcc { background: var(--primary); margin-top: 0; padding: 15px; }
.btn-lcc:hover { background: var(--primary-dark); }

.btn-ddc { background: #0ea5e9; margin-top: 0; padding: 15px; }
.btn-ddc:hover { background: #0284c7; }

.btn-next { background: var(--primary); }

.auth-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: bold;
}
.auth-btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
}


/* ===== 5. LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.container-flex {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.container-slim {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.flex-row {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}


/* ===== 6. CARDS ===== */
.card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    display: block;
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
}
.card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
    text-decoration: none;
}

.icon { font-size: 2rem; margin-bottom: 15px; }
.card h2 { margin: 0 0 10px 0; font-size: 1.25rem; color: #0f172a; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Subject cards (mock exam selector) */
.subject-card {
    cursor: pointer;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    transition: 0.2s;
}
.subject-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}


/* ===== 7. SIDEBAR / STATS ===== */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-lg);
    height: fit-content;
}

.stat-group {
    font-weight: bold;
    color: var(--primary);
    margin-top: 15px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
}


/* ===== 8. FORMS & INPUTS ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    font-family: var(--font);
    font-size: 0.95rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: auto;
}


/* ===== 9. TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    vertical-align: top;
}

th {
    background: #f8fafc;
    font-weight: bold;
    color: var(--primary);
}

/* Audit table (descriptive cataloging results) */
.audit-table th {
    background: #1e293b;
    color: var(--white);
}


/* ===== 10. MODAL / OVERLAY ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.overlay-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--white);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    padding: 30px;
    box-sizing: border-box;
    text-align: center;
}

/* Helper popup (descriptive cataloging) */
.helper-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.helper-popup {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-lg);
    max-width: 550px;
    width: 90%;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.helper-content {
    font-size: 0.95rem;
    line-height: 1.5;
}


/* ===== 11. AUTH ===== */
.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 350px;
}

.login-card h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 25px;
}

.login-card .btn { margin-bottom: 10px; }

.btn-login { background: var(--primary); }
.btn-register { background: var(--text-muted); }


/* ===== 12. STATUS LABELS ===== */
.status {
    margin-top: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.online { color: var(--success); }
.soon { color: var(--text-light); }

.status-check {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}
.status-pass {
    background: #def7ec;
    color: #03543f;
}
.status-rec {
    background: #fef3c7;
    color: #92400e;
}


/* ===== 13. FOOTER ===== */
footer {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 0.85rem;
}


/* ===== 14. UTILITY CLASSES ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }


/* ========================================================================
   15. DESCRIPTIVE CATALOGING (descriptive.html)
   ======================================================================== */

/* App Layout */
.app-container {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1.2fr;
    gap: 15px;
    max-width: 100%;
    padding: 10px;
    margin: 0 auto;
    min-height: 100vh;
    display: none;
}
.app-container.active { display: grid; }

.pane {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-y: auto;
}

.source-pane { max-height: 90vh; position: relative; }
.workspace-pane { max-height: 90vh; overflow-y: auto; }
.output-pane { max-height: 90vh; }

.img-frame {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: zoom-in;
}
.img-frame img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}
.img-frame:hover img {
    transform: scale(1.8);
}

#loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* MARC Fields */
.field-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.field-card strong { display: block; margin-bottom: 8px; color: #0f172a; }

.subfield-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.sub-label {
    font-weight: bold;
    color: var(--primary);
    font-size: 0.9rem;
    min-width: 30px;
    font-family: monospace;
}
.subfield-group input {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0;
}
.subfield-group input:focus {
    border-color: var(--primary);
    outline: none;
}

/* MARC Output */
.marc-line {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-all;
}
.marc-tag { font-weight: bold; color: var(--primary); }
.marc-sub { color: #059669; }

/* Card Preview */
.card-preview-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 15px;
    font-size: 0.85rem;
}

/* Setup / Results Overlay */
#setupOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    overflow-y: auto;
    padding: 20px 0;
}

#resultsOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 100;
    overflow-y: auto;
    padding: 20px 0;
}

.rec-text {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.4;
}

/* Group headers (collapsible MARC groups) */
.group-header { letter-spacing: 0.02em; }

details summary { cursor: pointer; }
details summary::-webkit-details-marker { color: var(--primary); }


/* ========================================================================
   16. SHELVING GAME (shelving-game.html)
   ======================================================================== */

.quiz-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 850px;
    width: 100%;
    position: relative;
    overflow: visible;
    min-height: 400px;
}

.quiz-card h1 { font-size: 1.4rem; color: #1a202c; margin-bottom: 5px; text-align: center; }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.timer {
    font-size: 1.5rem;
    font-weight: 800;
    color: #e11d48;
    background: #ffe4e6;
    padding: 5px 15px;
    border-radius: var(--radius-sm);
}

.set-counter {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary);
}

/* Shelf */
.sortable-list {
    list-style: none;
    padding: 20px 20px 0 20px;
    margin: 0;
    display: flex;
    flex-direction: row;
    gap: 12px;
    background: var(--border);
    border-bottom: 15px solid #cbd5e1;
    border-radius: var(--radius-md) var(--radius-md) 4px 4px;
    min-height: 240px;
    align-items: flex-end;
    overflow-x: auto;
}

/* Book Spines */
.item {
    background: var(--white);
    border: 2px solid #cbd5e1;
    border-bottom: none;
    padding: 20px 10px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: all 0.2s ease;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    height: 210px;
    width: 80px;
    user-select: none;
    text-align: center;
}
.item:hover {
    border-color: var(--primary);
    background: #f8fafc;
    transform: translateY(-5px);
}
.item.dragging {
    opacity: 0.4;
    background: var(--primary-light);
    border: 2px dashed var(--primary);
}
.item.locked {
    cursor: not-allowed !important;
    pointer-events: none;
    border-color: #cbd5e1 !important;
    transform: none !important;
}

/* Spine Labels */
.spine-label {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 10px 5px;
    border-radius: 4px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.1;
}
.call-class { font-weight: 800; font-size: 1.1rem; color: #0f172a; }
.call-num { font-weight: 600; font-size: 0.95rem; color: #1e293b; }
.call-cut { font-weight: 500; font-size: 0.9rem; color: #334155; }
.call-year { font-weight: 400; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Results */
#result {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    display: none;
    line-height: 1.5;
    border-left: 5px solid;
}
#result.success { display: block; background: #def7ec; color: #03543f; border-left-color: var(--success); }
#result.error   { display: block; background: #fde8e8; color: #9b1c1c; border-left-color: var(--danger); }

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

/* End Screen */
.rank-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 10px 0;
    color: #1e293b;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
}

.stat-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.stat-box span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}


/* ========================================================================
   17. MOCK EXAM (mock-exam.html)
   ======================================================================== */

.exam-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.progress-bar {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

#examContent {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    min-height: 400px;
}

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    cursor: pointer;
    transition: 0.2s;
    font-family: var(--font);
    font-size: 0.95rem;
}
.option-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-start {
    background: var(--primary);
    color: var(--white);
    padding: 15px 30px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    font-weight: bold;
    font-size: 1rem;
    margin-top: 10px;
    font-family: var(--font);
    transition: background 0.2s;
}
.btn-start:hover { background: var(--primary-dark); }


/* ========================================================================
   18. ADMIN (admin.html, admin-add.html)
   ======================================================================== */

.main-content { flex: 1; }

.opt-list {
    margin: 0;
    padding-left: 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Donation box (support.html) */
.donation-box {
    padding: 30px;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    margin-top: 20px;
}
.donation-box img {
    max-width: 300px;
    margin-top: 20px;
}


/* ========================================================================
   19. PRINT
   ======================================================================== */

@media print {
    body { background: white; }
    .back-btn, .btn, nav { display: none !important; }
    .pane { border: 1px solid #ccc; page-break-inside: avoid; }
    .app-container { display: block !important; }
    #setupOverlay, #resultsOverlay { position: static; background: none; }
    .modal-card { box-shadow: none; border: 1px solid #ccc; }
}

/* ========================================================================
   20. MERGED WORKSPACE LAYOUT (descriptive_merged.html - Prototype + Bibliotheses)
   ======================================================================== */

/* App Container: 2-column layout */
.app-container.merge-layout {
    display: grid;
    grid-template-columns: 30% 1fr;
    gap: 0;
    max-width: 100%;
    padding: 0;
    margin: 0;
    min-height: calc(100vh - 80px);
    display: none;
}
.app-container.merge-layout.active { display: grid; }

/* Top Bar */
#topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 40px;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 50;
}
#topbar .logo {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    letter-spacing: 0.2px;
    margin-right: 4px;
}
#topbar .sep {
    width: 1px;
    height: 20px;
    background: var(--border);
}
#bookProg {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 4px;
}
#topbar .btn {
    margin-top: 0;
    width: auto;
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 600;
}
#topbar .btn-sm-top { padding: 4px 10px; font-size: 0.75rem; width: auto; margin-top: 0; }
#topbar .btn-success { background: var(--success); }
#topbar .btn-success:hover { background: #059669; }
#topbar .btn-success.on { background: #047857; }
#topbar .btn-danger { background: var(--danger); width: auto; padding: 4px 10px; font-size: 0.75rem; }
#topbar .btn-danger:hover { background: #dc2626; }

/* Left Pane (Source Image) */
.left-pane {
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    position: sticky;
    top: 40px;
    align-self: start;
}
.left-pane .phead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}
.img-frame-merged {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    margin: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    min-height: 280px;
    cursor: zoom-in;
}
.img-frame-merged img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}
.img-frame-merged:hover img { transform: scale(1.8); }
#loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.78rem;
    z-index: 2;
}
.left-pane .arow {
    display: flex;
    gap: 4px;
    padding: 4px 8px 6px;
}
.left-pane .arow .btn {
    flex: 1;
    margin-top: 0;
    padding: 6px 8px;
    font-size: 0.78rem;
    width: auto;
}
#statusLine {
    padding: 4px 12px 6px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Right Pane (MARC Workspace) */
.right-pane {`r`n    display: flex;`r`n    flex-direction: column;`r`n    overflow: hidden;`r`n    background: var(--white);`r`n    max-height: calc(100vh - 80px);`r`n}
.right-pane .phead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.right-pane .phead .vgroup { display: flex; gap: 0; }
.right-pane .phead .vgroup button {
    padding: 3px 14px;
    font-size: 0.76rem;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    font-family: var(--font);
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.15s;
}
.right-pane .phead .vgroup button:first-child { border-radius: 4px 0 0 4px; }
.right-pane .phead .vgroup button:last-child { border-radius: 0 4px 4px 0; }
.right-pane .phead .vgroup button:not(:last-child) { border-right: none; }
.right-pane .phead .vgroup button.active {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: var(--white);
    font-weight: 600;
}
#workContent { flex: 1; overflow-y: auto; padding: 0; }

/* Koha-style MARC Form */
.koha-form { padding: 0; }
.koha-form .k-row {
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
}
.koha-form .k-row:hover { background: #f8fafc; }
.koha-form .k-tag {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--primary);
    min-width: 38px;
    flex-shrink: 0;
}
.koha-form .k-inds {
    display: inline-flex;
    gap: 2px;
    flex-shrink: 0;
}
.koha-form .k-inds select {
    width: 22px;
    height: 20px;
    font-size: 0.66rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--white);
    text-align: center;
    font-family: 'Consolas', monospace;
    cursor: pointer;
    padding: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin-bottom: 0;
}
.koha-form .k-inds select:disabled { background: #f0f0f0; color: #bbb; }
.koha-form .k-fieldname {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}
.koha-form .k-top .lightbulb {
    font-size: 0.9rem;
    opacity: 0.25;
    cursor: help;
    color: var(--warning);
    transition: opacity 0.15s;
    margin-left: 6px;
    flex-shrink: 0;
}
.koha-form .k-top .lightbulb:hover { opacity: 1; }
.koha-form .k-top .lightbulb.show { opacity: 0.65; }
.koha-form .k-top {
    display: flex;
    align-items: center;
    gap: 6px;
}
.koha-form .k-top .ksf-first {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}
.koha-form .k-top .ksf-first .ksf-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
    min-width: 20px;
    flex-shrink: 0;
}
.koha-form .k-top .ksf-first input {
    height: 26px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--white);
    flex: 1;
    min-width: 80px;
    transition: border-color 0.1s;
    margin-bottom: 0;
}
.koha-form .k-top .ksf-first input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,0.1); }
.koha-form .k-sfs {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 3px 0 3px 190px;
}
.koha-form .k-sfs .ksf {
    display: flex;
    align-items: center;
    gap: 3px;
}
.koha-form .k-sfs .ksf .ksf-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
    min-width: 22px;
    flex-shrink: 0;
}
.koha-form .k-sfs .ksf input {
    height: 26px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--white);
    flex: 1;
    min-width: 80px;
    transition: border-color 0.1s;
    margin-bottom: 0;
}
.koha-form .k-sfs .ksf input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,0.1); }

/* MARC View */
.marc-view { display: none; padding: 6px 12px; }
.marc-view .marc-line {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    padding: 3px 6px;
    border-bottom: 1px solid var(--border);
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}
.marc-view .marc-line:nth-child(even) { background: #fafafa; }
.marc-view .marc-tag { color: var(--primary); font-weight: 700; }
.marc-view .marc-sub { color: #059669; }

/* OPAC View */
.opac-view { display: none; padding: 16px 20px; }
.opac-view .opac-frame-merged {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    font-size: 0.92rem;
    line-height: 1.7;
    max-width: 750px;
    margin: 0 auto;
}

/* Card View */
.card-view { display: none; padding: 12px 16px; }
.card-view .opac-box {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    font-size: 0.88rem;
    line-height: 1.7;
}

/* Helper Popup */
.hlp-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 1000; }
.hlp-popup {
    display: none; position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    max-width: 460px; width: 90%;
    max-height: 70vh; overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.hlp-popup .hlp-c h4 { color: var(--primary); margin-bottom: 8px; font-size: 0.92rem; }
.hlp-popup .hlp-c { font-size: 0.88rem; line-height: 1.5; color: var(--text); }
.hlp-popup .btn-close {
    margin-top: 10px; padding: 6px 20px;
    background: var(--primary); color: var(--white);
    border: none; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.82rem; font-family: var(--font);
}
.hlp-popup .btn-close:hover { background: var(--primary-dark); }

/* Practice Intro Popup */
#practiceIntroOv { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 600; align-items: center; justify-content: center; }
#practiceIntroOv.active { display: flex; }
.practice-intro-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    max-width: 420px; width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.practice-intro-box h3 { font-size: 1rem; color: var(--success); margin-bottom: 10px; }
.practice-intro-box p { font-size: 0.88rem; color: var(--text); line-height: 1.5; margin-bottom: 12px; }
.practice-intro-box ul { font-size: 0.85rem; color: var(--text-muted); padding-left: 20px; margin-bottom: 16px; line-height: 1.6; }
.practice-intro-box .pi-btns { display: flex; align-items: center; justify-content: space-between; }
.practice-intro-box .pi-btns label { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.practice-intro-box .pi-btns label input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; }
.practice-intro-box .pi-btns .btn { width: auto; padding: 6px 20px; background: var(--success); color: var(--white); margin-top: 0; font-size: 0.82rem; }
.practice-intro-box .pi-btns .btn:hover { background: #059669; }

/* Setup Overlay */
#setupOv { display: flex; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; align-items: center; justify-content: center; }
#setupOv .setup-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px 35px;
    max-width: 360px; width: 90%;
    text-align: center;
}
#setupOv .setup-box h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: 4px; }
#setupOv .setup-box p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
#setupOv .setup-box select {
    width: 100px; padding: 8px; text-align: center;
    font-size: 1.05rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-family: var(--font);
    margin-bottom: 14px; cursor: pointer;
}
#setupOv .setup-box select:focus { outline: none; border-color: var(--primary); }
#setupOv .setup-box .btn-go {
    padding: 8px 30px; background: var(--primary); color: var(--white);
    border: none; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.85rem; font-weight: 600; font-family: var(--font);
}
#setupOv .setup-box .btn-go:hover { background: var(--primary-dark); }

/* Results Overlay */
#resultsOv { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; overflow-y: auto; padding: 20px; }
#resultsOv.active { display: flex; align-items: flex-start; justify-content: center; }
#resultsOv .res-box {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 25px 30px;
    max-width: 700px; width: 100%; margin-top: 25px;
}
#resultsOv .res-box h2 { font-size: 1rem; color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: 6px; margin-bottom: 10px; }
#resultsOv .res-box .rsum { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 12px; }
#resultsOv .res-box .rbook {
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px;
}
#resultsOv .res-box .rbook .rh { font-weight: 700; font-size: 0.78rem; color: var(--primary); margin-bottom: 4px; }
#resultsOv .res-box .btn-rclose {
    margin-top: 10px; padding: 6px 22px; background: var(--primary); color: var(--white);
    border: none; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font); font-size: 0.8rem;
}
#resultsOv .res-box .btn-rclose:hover { background: var(--primary-dark); }
#resultsOv .res-box .btn-rclose.secondary { background: var(--text-muted); }
#resultsOv .res-box .btn-rclose.secondary:hover { background: #475569; }

/* Audit table */
.audit-table-merged { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-top: 4px; }
.audit-table-merged th { background: #1e293b; color: var(--white); padding: 8px 12px; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px; }
.audit-table-merged td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* LOD Crosscheck banner */
.lod-banner { background: #f0f9ff; border: 1px solid #bae6fd; padding: 12px 15px; border-radius: 6px; margin-bottom: 10px; }
.lod-banner h4 { margin: 0 0 8px 0; color: #0369a1; font-size: 0.9rem; }
.lod-banner .lod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: 0.82rem; line-height: 1.4; }
.lod-banner .lod-grid .lod-label { color: #0ea5e9; display: block; margin-bottom: 2px; font-weight: 700; }
@media (max-width: 640px) { .lod-banner .lod-grid { grid-template-columns: 1fr; } }

/* Toast notification */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 6px 20px; border-radius: 6px; font-size: 0.78rem; z-index: 2000; display: none; }
#toast.show { display: block; animation: fadeUp 0.25s; }
@keyframes fadeUp { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Back navigation */
.back-nav-merged { margin: 8px 0 0 12px; }
.back-nav-merged a {
    text-decoration: none; color: var(--text-muted); font-size: 0.75rem; font-weight: bold;
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--white); padding: 5px 12px; border-radius: 4px;
    border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.back-nav-merged a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

/* Responsive */
@media (max-width: 860px) {
    .app-container.merge-layout { grid-template-columns: 1fr; }
    .left-pane { max-height: 50vh; }
    .right-pane .phead .vgroup button { padding: 3px 8px; font-size: 0.7rem; }
    .koha-form .k-sfs { padding-left: 30px; }
    .back-nav-merged { margin: 4px 0 0 6px; }
}



@media (max-width: 768px) {
    .koha-form .k-sfs { padding-left: 0; }
    .koha-form .k-top { flex-wrap: wrap; }
    .koha-form .k-fieldname { min-width: 100%; order: -1; margin-bottom: 2px; }
}

@media (max-width: 768px) {
    .koha-form .k-top { flex-wrap: wrap; position: relative; }
    .koha-form .k-top .ksf-first { display: block; width: 100%; margin-top: 4px; padding-top: 4px; border-top: 1px dashed #e2e8f0; }
    .koha-form .k-top .ksf-first input { width: 100%; }
    .koha-form .k-sfs { padding-left: 0; margin-top: 4px; }
    .koha-form .k-sfs .ksf { display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
    .koha-form .k-sfs .ksf input { flex: 1; min-width: 0; }
    .koha-form .k-sfs .ksf-label { min-width: 22px; }
    .koha-form .k-fieldname { min-width: 100%; order: -1; margin-bottom: 2px; font-size: 0.78rem; }
}
  
/* ===== 21. ADMIN BUTTONS + INPUT VARIANTS ===== */  
.btn-save { background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem; padding: 8px 16px; font-family: var(--font); font-weight: 600; }  
.btn-save:hover { background: var(--primary-dark); }  
.btn-cancel { background: #64748b; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem; padding: 8px 16px; font-family: var(--font); font-weight: 600; }  
.btn-cancel:hover { background: #475569; }  
.btn-edit { background: #f59e0b; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.78rem; padding: 4px 10px; font-family: var(--font); font-weight: 500; }  
.btn-edit:hover { background: #d97706; }  
.btn-delete { background: var(--danger); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.78rem; padding: 4px 10px; font-family: var(--font); font-weight: 500; }  
.btn-delete:hover { background: #dc2626; }  
.edit-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; font-family: var(--font); box-sizing: border-box; }  
.edit-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }  
.edit-textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; font-family: var(--font); resize: vertical; min-height: 80px; box-sizing: border-box; }  
.edit-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); } 
