* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Calibri', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* LEFT PANEL - Translated Files */
.left-panel {
    width: 50%;
    background: white;
    border-right: 2px solid #ddd;
    display: flex;
    flex-direction: column;
}

/* RIGHT PANEL - Upload Form */
.right-panel {
    width: 50%;
    background: white;
    overflow-y: auto;
    padding: 20px 30px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #2c3e50;
    color: white;
    border-bottom: 3px solid #1a252f;
}

.panel-header h2 {
    font-size: 24px;
}

.refresh-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

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

/* Filter Bar */
.filter-bar {
    padding: 10px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 10px;
}

.filter-bar input,
.filter-bar select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
    background: white;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: #3498db;
}

.bulk-actions {
    padding: 15px 30px;
    background: #ecf0f1;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 10px;
}

.btn-download,
.btn-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-download {
    background: #27ae60;
    color: white;
}

.btn-download:hover {
    background: #229954;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.files-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
}

.loading {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

.project-group {
    margin-bottom: 30px;
}

.project-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    padding: 10px;
    background: #ecf0f1;
    border-left: 4px solid #3498db;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-group {
    margin-left: 20px;
    margin-bottom: 15px;
}

.topic-title {
    font-size: 16px;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 5px 0 5px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.2s;
}

.file-item:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.file-item input[type="checkbox"] {
    margin-right: 15px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 12px;
    color: #7f8c8d;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-actions a {
    padding: 6px 12px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.3s;
}

.file-actions a:hover {
    background: #2980b9;
}

/* FORM STYLING */
#translation-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 12px;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

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

.btn-submit:active {
    transform: scale(0.98);
}

.info-box {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 20px;
    border-radius: 5px;
}

.info-box h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.info-box ul {
    list-style-position: inside;
    color: #34495e;
}

.info-box ul li {
    margin-bottom: 8px;
    padding-left: 10px;
}

/* TOAST CUSTOMIZATION */
.toast {
    opacity: 0.95 !important;
}

.toast-success {
    background-color: #27ae60 !important;
}

.toast-error {
    background-color: #e74c3c !important;
}

.toast-info {
    background-color: #3498db !important;
}

.toast-warning {
    background-color: #f39c12 !important;
}

/* Scrollbar styling */
.files-container::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    width: 10px;
}

.files-container::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.files-container::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.files-container::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        height: 50vh;
    }
}

/* Icon Buttons */
.icon-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: all 0.3s;
    color: #2c3e50;
}

.icon-btn:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.icon-btn i {
    font-size: 16px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-download-file {
    background: #27ae60;
    color: white;
}

.btn-download-file:hover {
    background: #229954;
    color: white;
}

.btn-delete-file {
    background: #e74c3c;
    color: white;
}

.btn-delete-file:hover {
    background: #c0392b;
    color: white;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

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

/* Hide/Unhide buttons */
.btn-hide-item {
    color: white !important;
    font-size: 11px;
    padding: 2px 7px;
    background: #aab0b7 !important;
    border-radius: 3px;
    transition: background 0.2s;
    flex-shrink: 0;
    line-height: 1.6;
}

.btn-hide-item:hover {
    background: #e74c3c !important;
    color: white !important;
}

.btn-unhide {
    color: #27ae60;
}

.btn-unhide:hover {
    color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.1) !important;
}

/* Hidden items list in modal */
.hidden-section-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    margin: 12px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ecf0f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hidden-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 6px;
    background: #f8f9fa;
}

.hidden-item span {
    color: #34495e;
    font-size: 14px;
}

/* Hidden project/topic styles */
.project-group.hidden,
.topic-group.hidden,
.file-item.hidden {
    display: none;
}

/* Show-hidden mode: dimmed appearance for hidden items */
.project-group.is-hidden,
.topic-group.is-hidden {
    opacity: 0.6;
    border-left: 3px solid #e67e22;
}

.project-group.is-hidden .project-title,
.topic-group.is-hidden .topic-title {
    background: #fdf3e7;
}

.hidden-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e67e22;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-header .icon-btn {
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.panel-header .icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Active state for the show-hidden toggle button */
.panel-header .icon-btn.active {
    background: #e67e22;
    color: white;
}

.panel-header .icon-btn.active:hover {
    background: #cf6d17;
    color: white;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
    cursor: pointer;
}

/* File Select */
.file-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.file-select optgroup {
    font-weight: bold;
    color: #2c3e50;
}

.file-select option {
    padding: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #2c3e50;
    color: white;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.modal-header h3 i {
    margin-right: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Log Viewer */
.log-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.btn-refresh {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

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

.btn-refresh i {
    margin-right: 5px;
}

#log-lines {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.log-content {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 400px;
    overflow-y: auto;
}

.log-info {
    color: #95a5a6;
    margin-bottom: 10px;
    font-size: 12px;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.log-entry {
    padding: 8px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    line-height: 1.5;
}

.log-success {
    border-left: 3px solid #27ae60;
}

.log-error {
    border-left: 3px solid #e74c3c;
}

.log-warning {
    border-left: 3px solid #f39c12;
}

.log-content .loading,
.log-content .error,
.log-content .empty {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
}

.log-content .error {
    color: #e74c3c;
}

/* Icons in buttons */
.btn-download i,
.btn-delete i,
.btn-submit i {
    margin-right: 8px;
}

/* Info box icons */
.info-box h3 i {
    margin-right: 8px;
    color: #3498db;
}

/* Scrollbar for log content */
.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #34495e;
}

.log-content::-webkit-scrollbar-thumb {
    background: #7f8c8d;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* ─── Language Multi-Select (form) ──────────────────────────────────────────── */

.lang-multiselect {
    position: relative;
    width: 100%;
}

.lang-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    background: white;
    min-height: 46px;
    gap: 8px;
    transition: border-color 0.2s;
    user-select: none;
}

.lang-multiselect-trigger:hover {
    border-color: #3498db;
}

#lang-selected-display {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    min-height: 22px;
}

.lang-placeholder {
    color: #aaa;
    font-size: 14px;
}

.lang-tag {
    display: inline-flex;
    align-items: center;
    background: #3498db;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-weight: 500;
}

.lang-tag-more {
    background: #7f8c8d;
}

#lang-arrow {
    color: #7f8c8d;
    font-size: 12px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

#lang-arrow.open {
    transform: rotate(180deg);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #3498db;
    border-radius: 5px;
    z-index: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lang-dropdown.open {
    display: block;
}

.lang-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #ecf0f1;
}

.lang-search-wrap i {
    color: #bbb;
    font-size: 13px;
}

.lang-search-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: #333;
    background: transparent;
}

.lang-select-all-row {
    border-bottom: 1px solid #ecf0f1;
    background: #fafbfc;
}

.lang-select-all-item {
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

.lang-options-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}

.lang-options-list::-webkit-scrollbar { width: 6px; }
.lang-options-list::-webkit-scrollbar-track { background: #f1f1f1; }
.lang-options-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.lang-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    font-weight: normal;
    transition: background 0.1s;
    margin: 0;
}

.lang-option-item:hover {
    background: #f0f7ff;
}

.lang-option-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    accent-color: #3498db;
}

/* ─── Document Group (file list) ────────────────────────────────────────────── */

.doc-group {
    margin: 8px 0 8px 20px;
    border: 1px solid #dde3ea;
    border-radius: 6px;
    overflow: hidden;
}

.doc-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #eaf1fb;
    border-bottom: 1px solid #dde3ea;
}

.doc-icon {
    color: #2b5fc9;
    font-size: 15px;
    flex-shrink: 0;
}

.doc-group-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: #1e3a5f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-lang-badge {
    background: #2b5fc9;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Language Tabs (file list) ──────────────────────────────────────────────── */

.lang-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 10px 6px;
    background: #f0f4f8;
    border-top: 1px solid #e0e7ee;
    border-bottom: 1px solid #e0e7ee;
    margin-bottom: 4px;
}

.lang-tab {
    padding: 4px 12px;
    border: 1px solid #c5d5e8;
    border-radius: 20px;
    background: white;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.lang-tab:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f0f7ff;
}

.lang-tab.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   LINK EDITOR PAGE
   ═══════════════════════════════════════════════════════════════ */

/* Override right-panel padding/scroll for the link editor */
.link-editor-layout .right-panel {
    padding: 0;
    overflow: hidden;
}

/* Header: back-button + title row */
.header-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-btn {
    font-size: 13px;
    opacity: 0.85;
}

.back-btn:hover {
    opacity: 1;
}

/* Inline language selector inside panel header */
.lang-select-inline {
    height: 30px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    max-width: 160px;
}

.lang-select-inline option {
    background: #2c3e50;
    color: #ecf0f1;
}

/* Full-height resizable textarea */
.content-editor {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    padding: 20px 24px;
    font-family: 'Calibri', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: #2c3e50;
    background: #fff;
    overflow-y: auto;
}

.content-editor::placeholder {
    color: #bbb;
    line-height: 1.7;
}

/* Word / char count bar */
.editor-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e8e8e8;
    font-size: 11px;
    color: #999;
}

.footer-sep {
    color: #ddd;
}

/* Links-found badge in preview header */
.links-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    transition: background 0.25s, color 0.25s;
}

.links-badge.has-links {
    background: #27ae60;
    color: #fff;
}

/* ── Full-width link mapper bar ─────────────────────────────── */
.link-editor-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

/* The editors row fills whatever height is left after the mapper bar */
.link-editor-wrapper .container.link-editor-layout {
    flex: 1;
    min-height: 80vh;
    height: auto;
}

.link-mapper-bar {
    flex-shrink: 0;
    width: 100%;
    background: #f4f6f8;
    border-bottom: 2px solid #dde1e4;
}

/* Main horizontal row */
.mapper-bar-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 20px;
    flex-wrap: wrap;
}

.mapper-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Action buttons in the mapper bar (View JSON, Sample) */
.btn-bar-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    color: #555;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-bar-action:hover {
    background: #eaf0fb;
    border-color: #3498db;
    color: #2980b9;
}

.btn-bar-action.active {
    background: #3498db;
    border-color: #2980b9;
    color: #fff;
}

.btn-bar-action i {
    font-size: 11px;
}

/* ── Current / active mapper viewer panel ──────────────────── */
.current-json-panel {
    border-top: 1px solid #e4e7ea;
    background: #1e2a35;
}

.current-json-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 16px;
    background: #16202b;
    flex-wrap: wrap;
    gap: 8px;
}

.current-json-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #7f8c8d;
}

.current-json-title i {
    color: #3498db;
    font-size: 12px;
}

.current-json-title strong {
    color: #a8d8b9;
    font-weight: 600;
}

.current-json-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-load-to-editor {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.4);
    color: #5dade2;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-load-to-editor:hover {
    background: rgba(52, 152, 219, 0.35);
    color: #aed6f1;
}

.current-json-pre {
    max-height: 260px;
    overflow-y: auto;
}

/* Tab content row (upload file row / paste row) */
.mapper-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px 10px;
    border-top: 1px solid #e4e7ea;
    background: #fff;
}

/* Paste row: textarea fills available width */
.mapper-paste-row {
    align-items: flex-start;
    gap: 10px;
}

.mapper-paste-row .json-paste-area {
    flex: 1;
    max-width: 700px;
    height: 72px;
}

.mapper-paste-row .paste-actions {
    flex-shrink: 0;
}

/* Status row (kept for element reuse) */
.base-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 8px;
}

.base-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.base-file-icon-wrap {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #e3f2fd;
    color: #2196f3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.base-file-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.base-file-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.base-file-name {
    font-size: 12px;
    color: #34495e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

/* Mode tabs (inline in the bar) */
.mapper-tabs {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.mapper-tab {
    padding: 6px 14px;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.mapper-tab:first-child {
    border-radius: 4px 0 0 4px;
}

.mapper-tab:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.mapper-tab.active {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
}

.mapper-tab:not(.active):hover {
    background: #ecf0f1;
    color: #333;
}

/* Tab content areas */
.mapper-tab-content {
    padding: 6px 16px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-choose-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #3498db;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    user-select: none;
    flex-shrink: 0;
}

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

.upload-file-label {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Paste tab */
#mapper-paste-content {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.json-paste-area {
    width: 100%;
    height: 90px;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    color: #2c3e50;
    background: #fff;
}

.json-paste-area:focus {
    border-color: #3498db;
}

.json-paste-area.paste-success {
    border-color: #27ae60;
    background: #f0faf4;
}

.json-paste-area.paste-error {
    border-color: #e74c3c;
    background: #fff5f5;
}

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

.btn-apply-json {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-apply-json:hover {
    background: #219a52;
}

.btn-save-default {
    background: #2980b9;
}

.btn-save-default:hover {
    background: #2471a3;
}

.paste-hint {
    font-size: 12px;
    font-weight: 500;
}

/* Sample section */
/* btn-show-sample now reuses .btn-bar-action; keep i colour override */
.btn-show-sample i {
    color: #f39c12 !important;
}

.sample-json {
    border-top: 1px solid #e0e0e0;
    background: #1e2a35;
}

.sample-json-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #16202b;
}

.sample-json-header span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7f8c8d;
    font-weight: 600;
}

.btn-copy-sample {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #bdc3c7;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-copy-sample:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.sample-code {
    margin: 0;
    padding: 12px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.65;
    color: #a8d8b9;
    overflow-x: auto;
    white-space: pre;
}

.btn-danger-icon {
    color: #e74c3c !important;
}

.btn-danger-icon:hover {
    background: #fdecea !important;
}

/* Middle action column between the two editors */
.editor-middle-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 44px;
    flex-shrink: 0;
    background: #f0f2f5;
    border-left: 1px solid #dde3ea;
    border-right: 1px solid #dde3ea;
    padding: 12px 0;
}

.mid-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: #2c3e50;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.mid-btn:hover {
    background: #2980b9;
    color: #fff;
    box-shadow: 0 2px 6px rgba(41,128,185,0.35);
}

/* Scrollable preview area */
.link-editor-right {
    display: flex;
    flex-direction: column;
}

.link-editor-layout .left-panel {
    display: flex;
    flex-direction: column;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Empty / loading states */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
    text-align: center;
    gap: 14px;
    padding: 40px 20px;
}

.preview-empty i {
    font-size: 52px;
    opacity: 0.35;
}

.preview-empty p {
    max-width: 280px;
    line-height: 1.65;
    font-size: 13px;
}

.preview-content .loading {
    color: #aaa;
    font-style: italic;
    font-size: 13px;
    padding: 20px 0;
}

.preview-content .preview-error {
    color: #e74c3c;
    font-size: 13px;
    padding: 16px 0;
}

/* Rendered paragraphs */
.preview-content p {
    margin-bottom: 14px;
    line-height: 1.75;
    font-size: 14px;
    color: #2c3e50;
}

/* Highlighted detected links */
.detected-link {
    color: #2980b9;
    text-decoration: none;
    font-weight: bold;
    padding: 0;
    border-radius: 3px;
    background: none;
    transition: background 0.15s, color 0.15s;
}

.detected-link:hover {
    background: #2980b9;
    color: #fff;
    text-decoration: none;
}

/* Flash animation for copy buttons */
@keyframes btn-flash-anim {
    0%   { background: rgba(39, 174, 96, 0.35); }
    100% { background: transparent; }
}

.btn-flash {
    animation: btn-flash-anim 0.6s ease-out;
}

/* ── Source Content Panel ─────────────────────────────────────────── */
.source-content-panel {
    border-top: 1px solid #e4e7ea;
    background: #fff;
    padding: 12px 20px 14px;
}

.source-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.source-panel-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #7f8c8d;
}

.source-panel-title i {
    color: #3498db;
    font-size: 12px;
}

.source-links-count {
    margin-left: auto;
    font-size: 11px;
    color: #27ae60;
    font-weight: 600;
}

.source-panel-body {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.source-input-wrap {
    flex: 0 0 50%;
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Quill editor inside source panel */
.source-input-wrap .ql-toolbar.ql-snow {
    padding: 3px 6px;
    border-color: #d0d0d0;
    border-radius: 4px 4px 0 0;
    background: #fafafa;
}

.source-input-wrap .ql-container.ql-snow {
    border-color: #d0d0d0;
    border-radius: 0 0 4px 4px;
    font-size: 13px;
}

.source-input-wrap .ql-editor {
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px 10px;
    line-height: 1.5;
}

.source-input-wrap .ql-editor.ql-blank::before {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
}

/* Raw HTML textarea that shows when source-toggle is active */
.source-view-raw {
    width: 100%;
    min-height: 120px;
    max-height: 150px;
    resize: vertical;
    border-color: #d0d0d0;
    border-radius: 4px;
    font-size: 11px;
}

.source-input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-analyze-source {
    background: #2ecc71 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
}

.btn-analyze-source:hover {
    background: #27ae60 !important;
}

/* Analysis output panel */
.source-analysis-output {
    flex: 1;
    min-height: 60px;
    max-height: 190px;
    overflow-y: auto;
    font-size: 11px;
}

.source-analysis-hint {
    color: #aaa;
    font-style: italic;
    line-height: 1.5;
}

.source-analysis-summary {
    font-size: 11px;
    color: #555;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
    line-height: 1.5;
}

.source-para-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.source-para-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 5px 8px;
    border-radius: 4px;
    background: #f0f7ff;
    border: 1px solid #bde0f5;
}

.source-para-num {
    flex-shrink: 0;
    min-width: 30px;
    height: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3498db;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.source-para-links {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.source-para-preview {
    font-size: 10px;
    color: #aaa;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.source-link-item {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.source-link-anchor {
    font-weight: 600;
    color: #2c3e50;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-link-arrow {
    color: #ccc;
    font-size: 10px;
    flex-shrink: 0;
}

.source-link-url {
    color: #3498db;
    font-size: 10px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-link-tag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
}

.source-link-tag.matched {
    background: #d5f5e3;
    color: #1a7a3e;
    border: 1px solid #a9dfbf;
}

.source-link-tag.custom {
    background: #fef9e7;
    color: #9a7d0a;
    border: 1px solid #f9e79f;
}

/* Mini badge on the Source Content button */
.source-badge-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #2ecc71;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 3px;
    vertical-align: middle;
}

.btn-bar-action.has-source {
    border-color: #27ae60;
    color: #1a7a3e;
    background: #eafaf1;
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 1024px) {
    .link-editor-layout {
        flex-direction: column;
    }

    .link-editor-layout .left-panel,
    .link-editor-layout .right-panel {
        width: 100%;
        height: 50vh;
    }
}

/* ═══════════════════════════════════════════════════════════════
   QUILL WYSIWYG EDITORS
   ═══════════════════════════════════════════════════════════════ */

/* HTML source view textarea */
.source-view {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 16px 20px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #2c3e50;
    background: #f8f9fa;
    border: none;
    border-top: 2px solid #e0e0e0;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

/* Outer mount point — Quill injects .ql-toolbar + .ql-container inside */
.quill-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

/* Toolbar */
.quill-pane .ql-toolbar.ql-snow {
    flex-shrink: 0;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    background: #f8f9fa;
    padding: 6px 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    flex-wrap: wrap;
    line-height: 1.6;
}

/* Scrollable content area */
.quill-pane .ql-container.ql-snow {
    flex: 1;
    border: none;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
}

/* Editable area */
.quill-pane .ql-editor {
    padding: 20px 24px;
    line-height: 1.75;
    color: #000000;
    min-height: 100%;
    font-family: 'Calibri', 'Segoe UI', Arial, sans-serif;
    font-size: 11pt;
}

/* Calibri font class applied by Quill when user selects it from the toolbar */
.ql-font-calibri {
    font-family: 'Calibri', 'Segoe UI', Arial, sans-serif;
}

/* Font picker: show Calibri label in the toolbar dropdown */
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=calibri]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=calibri]::before {
    content: 'Calibri';
    font-family: 'Calibri', 'Segoe UI', Arial, sans-serif;
}

.quill-pane .ql-editor p,
.quill-pane .ql-editor li,
.quill-pane .ql-editor span {
    font-size: inherit;
}

.quill-pane .ql-editor.ql-blank::before {
    color: #bbb;
    font-style: normal;
    left: 24px;
}

/* Detected links inside the right preview editor.
   Quill strips class="detected-link" from <a> tags on re-render,
   so we target all <a href> elements as a fallback. */
#editor-right .ql-editor a[href],
#editor-right .ql-editor .detected-link {
    color: #2980b9 !important;
    font-weight: bold !important;
    background: none;
    text-decoration: underline !important;
    cursor: pointer;
}

#editor-right .ql-editor a[href]:hover,
#editor-right .ql-editor .detected-link:hover {
    background: #2980b9 !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Loading overlay on the right editor */
.quill-pane.quill-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 10;
}

.quill-pane.quill-loading::before {
    content: '\f110'; /* fa-spinner codepoint */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    color: #3498db;
    z-index: 11;
    animation: fa-spin 0.8s linear infinite;
}

@keyframes fa-spin {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ─── Conflict Resolution Modal ──────────────────────────────────────────── */

.conflict-modal-content {
    max-width: 680px;
    width: 92%;
}

.conflict-intro {
    margin-bottom: 16px;
    color: #555;
    font-size: 13.5px;
    line-height: 1.5;
}

.conflict-row {
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fafbfc;
}

.conflict-phrase-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.conflict-phrase-label {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}

.conflict-unresolved-badge {
    font-size: 11px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 2px 8px;
    white-space: nowrap;
}

.conflict-unresolved-badge.hidden {
    display: none;
}

.conflict-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conflict-option-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border: 1.5px solid #d1d8e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    font-size: 13px;
}

.conflict-option-btn:hover {
    border-color: #3498db;
    background: #eaf4fd;
}

.conflict-option-btn.selected {
    border-color: #27ae60;
    background: #eafaf1;
}

.conflict-lang-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 22px;
    background: #2c3e50;
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.conflict-option-btn.selected .conflict-lang-badge {
    background: #27ae60;
}

.conflict-lang-name {
    font-weight: 600;
    color: #34495e;
    min-width: 90px;
    flex-shrink: 0;
}

.conflict-url {
    color: #2980b9;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conflict-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e8ecf0;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.btn-conflict-cancel {
    padding: 8px 18px;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    font-size: 13.5px;
    transition: border-color 0.15s, color 0.15s;
}

.btn-conflict-cancel:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-conflict-apply {
    padding: 8px 22px;
    border: none;
    border-radius: 6px;
    background: #27ae60;
    color: #fff;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: background 0.15s;
}

.btn-conflict-apply:hover {
    background: #219a52;
}
