:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --accent: #0ea5e9;
    --bg-page: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.07);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden; /* Locks viewport; only middle workspace scrolls */
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* ================= FIXED TOP HEADER & NAVIGATION ================= */
.site-header {
    flex-shrink: 0;
    height: 60px;
    background: linear-gradient(90deg, #1e1b4b 0%, #312e81 60%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.15);
    z-index: 50;
    display: flex;
    align-items: center;
}

.nav-bar {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
}

.brand-text {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.main-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.main-nav a.active {
    background: #ffffff;
    color: var(--primary-dark);
    font-weight: 600;
}

/* ================= SCROLLABLE MIDDLE WORKSPACE ================= */
.content-area {
    flex: 1;
    overflow-y: scroll; /* Reserves scrollbar width permanently so layout never shifts */
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 36px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .content-area {
        grid-template-columns: 1fr;
    }
}

.card, .guide-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 28px 32px;
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-header h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-main);
}

.card-header p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ================= ALERTS ================= */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-icon {
    font-size: 17px;
    font-weight: 700;
}

.alert.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ================= UPLOAD DROPZONE ================= */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    position: relative;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: #eef2ff;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.dropzone-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: #e0e7ff;
    color: var(--primary);
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.dropzone-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
}

.dropzone-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.file-badge {
    display: none;
    margin-top: 12px;
    padding: 5px 14px;
    background: #ffffff;
    border: 1px solid #c7d2fe;
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
}

/* ================= FORMS & INPUTS ================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

label .req {
    color: #e11d48;
}

input[type="text"], .form-select {
    width: 100%;
    padding: 9px 13px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

code {
    background: #f1f5f9;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 11.5px;
    color: #334155;
}

.checkbox-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 11px 14px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 500;
}

.checkbox-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.btn-submit {
    margin-top: 20px;
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

.btn-submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

/* ================= SIDEBAR GUIDE ================= */
.guide-card {
    padding: 22px;
}

.guide-card h3 {
    font-size: 15.5px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-dark);
}

.guide-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-list li {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 12px;
    border-left: 3px solid #c7d2fe;
}

.guide-list li strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 2px;
}

/* ================= IDIOM SPLITTER WORKSPACE ================= */
.splitter-layout {
    grid-template-columns: 300px 1fr !important;
}

@media (max-width: 900px) {
    .splitter-layout {
        grid-template-columns: 1fr !important;
    }
}

.splitter-sidebar {
    padding: 18px;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.form-select {
    font-size: 13.5px;
    font-weight: 600;
}

.btn-new-idiom {
    display: block;
    text-align: center;
    background: #eef2ff;
    color: var(--primary-dark);
    border: 1px solid #c7d2fe;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-new-idiom:hover {
    background: #e0e7ff;
}

.idiom-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.badge-count {
    background: #f1f5f9;
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.idiom-nav-list {
    list-style: none;
    max-height: 460px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.idiom-nav-list li.empty-list {
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px 4px;
}

.idiom-nav-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 13.5px;
    transition: background 0.15s;
}

.idiom-nav-list a:hover {
    background: #f1f5f9;
}

.idiom-nav-list a.active {
    background: #eef2ff;
    color: var(--primary-dark);
    font-weight: 600;
}

.item-num {
    color: var(--text-muted);
    font-size: 12px;
    min-width: 24px;
}

.splitter-workspace {
    min-height: 480px; /* Keeps card height consistent across all 5 tabs */
}

.workspace-header {
    margin-bottom: 18px;
}

.workspace-header h1 {
    font-size: 20px;
    font-weight: 700;
}

.workspace-header p {
    font-size: 13px;
color: var(--text-muted);
}
/* Tab Bar & Panels */
.tab-bar {
display: flex;
gap: 4px;
border-bottom: 2px solid var(--border);
margin-bottom: 22px;
flex-wrap: wrap;
}
.tab-btn {
background: transparent;
border: none;
padding: 10px 18px;
font-size: 14px;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
border-bottom: 2px solid transparent;
margin-bottom: -2px;
transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover {
color: var(--text-main);
}
.tab-btn.active {
color: #2563eb;
border-bottom-color: #2563eb;
}
.tab-panel {
display: none;
}
.tab-panel.active {
display: block;
}
/* Marker & Content Textareas */
.marker-textarea {
width: 100%;
padding: 12px 14px;
border: 1px solid #cbd5e1;
border-radius: 8px;
font-size: 14px;
font-family: inherit;
line-height: 1.55;
color: var(--text-main);
background: #f8fafc;
resize: vertical;
transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.marker-textarea:focus {
outline: none;
background: #ffffff;
border-color: #2563eb;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.mono-box {
font-family: Consolas, "Courier New", monospace;
font-size: 13.5px;
}
.panel-actions {
margin-top: 20px;
display: flex;
justify-content: flex-end;
}
.btn-primary-sm {
background: #2563eb;
color: #ffffff;
border: none;
padding: 10px 20px;
font-size: 14px;
font-weight: 600;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
transition: background 0.2s, transform 0.15s;
}
.btn-primary-sm:hover {
background: #1d4ed8;
transform: translateY(-1px);
}
/* ================= FIXED BOTTOM FOOTER ================= */
.site-footer {
flex-shrink: 0;
height: 52px;
background: #0f172a;
color: #94a3b8;
padding: 0 24px;
display: flex;
align-items: center;
z-index: 50;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.footer-inner {
max-width: 1320px;
width: 100%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 12px;
font-size: 13px;
}
.footer-brand strong {
color: #e2e8f0;
}
.footer-links {
display: flex;
gap: 20px;
}
.footer-links a {
color: #cbd5e1;
text-decoration: none;
transition: color 0.2s;
}
.footer-links a:hover {
color: #ffffff;
}

.single-workspace {
    grid-template-columns: 1fr !important;
}

.workspace-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.book-picker {
    min-width: 280px;
}
