/* pages.css — общие блоки страниц: форма загрузки, история, проекты, бейджи */

.upload-form {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 32px;
}
#fileInput {
    width: 100%;
    margin-bottom: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}
.monologue-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    flex-wrap: wrap;
    max-width: 100%;
}
.monologue-label input {
    margin: 0;
}
.monologue-label span {
    display: inline-block;
}
.monologue-label .info-icon {
    margin-left: 4px;
    display: inline-flex; /* сохраняем flex, чтобы "i" был по центру круга (иначе .monologue-label span даёт inline-block) */
}
.monologue-label::after {
    content: '';
    flex-basis: 100%;
    height: 0;
}

#uploadStatus {
    margin-top: 12px;
    min-height: 20px;
    font-size: 14px;
}
#uploadStatus .status-error {
    color: #d32f2f;
}
#uploadStatus .status-success {
    color: #2e7d32;
}

#historySection,
#historyContainer {
    width: 100%;
}
.history-item {
    background: #fafafa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}
.history-info {
    flex: 1;
    min-width: 0;
}
.history-filename {
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-all;
}
.history-date {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}
.history-actions {
    display: flex;
    gap: 8px;
}
.history-link,
.delete-btn {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.history-link {
    background: #e6f0ff;
    color: #007aff;
}
.delete-btn {
    background: #ffe6e6;
    color: #d32f2f;
    border: none;
    cursor: pointer;
}
.delete-btn:hover {
    background: #ffd6d6;
}
.history-name {
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-all;
}
.history-filename-small {
    color: #666;
    font-size: 13px;
    font-style: italic;
}

.protocol-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #28a745 !important;
    color: white !important;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
}
.monologue-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #007bff !important;
    color: white !important;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
}
.project-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #6f42c1 !important;
    color: white !important;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
    cursor: pointer;
}
.project-badge:hover {
    opacity: 0.85;
}
.project-badge-link {
    display: inline-block;
    padding: 2px 10px;
    background: #6f42c1;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}
.project-badge-link:hover {
    opacity: 0.85;
}

/* Main layout (index) */
.main-layout {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    gap: 24px;
    align-items: start;
}

/* Правая колонка «Спикеры»: компактные карточки; полный список — в модальном окне */
#speakersSection {
    min-width: 0;
}
.speakers-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.speakers-card {
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.speakers-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.speakers-card-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    min-width: 0;
    word-break: break-word;
}
.speakers-card-count {
    flex-shrink: 0;
    background: #007aff;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}
.speakers-card-open-btn {
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #c7d2fe;
    background: #fff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
}
.speakers-card-open-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}
.speakers-modal-box {
    max-width: 520px;
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.speakers-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.speakers-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
    word-break: break-word;
    padding-right: 8px;
}
.speakers-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.speakers-modal-close:hover {
    background: #e5e7eb;
}
.speakers-modal-filter {
    margin: 12px 20px 0;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    width: calc(100% - 40px);
}
.speakers-modal-filter:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.speakers-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 20px 20px;
    -webkit-overflow-scrolling: touch;
}
.speakers-modal-loading,
.speakers-modal-error,
.speakers-modal-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}
.speakers-modal-error {
    color: #b91c1c;
}
.speakers-modal-row {
    display: block;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s, border-color 0.12s;
}
.speakers-modal-row:last-child {
    margin-bottom: 0;
}
.speakers-modal-row:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}
.speakers-modal-row-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #2563eb;
    line-height: 1.4;
    word-break: break-word;
}
.speakers-modal-row-meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
    word-break: break-all;
}

/* Projects panel */
.projects-panel {
    position: sticky;
    top: 24px;
}
.projects-panel h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
.projects-toggle {
    display: none;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.projects-content {
    display: block;
}
.project-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.project-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    font-size: 14px;
    color: #333;
}
.project-list-item:hover {
    background: #f0f0f0;
}
.project-list-item.active {
    background: #e6f0ff;
    border-color: #007aff;
    font-weight: 600;
}
.project-list-item .proj-count {
    background: #e0e0e0;
    color: #555;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}
.project-list-item.active .proj-count {
    background: #007aff;
    color: white;
}
.project-list-item .proj-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 6px;
}
.btn-all-transcriptions {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: #333;
    background: none;
    transition: all 0.15s;
}
.btn-all-transcriptions:hover {
    background: #f0f0f0;
}
.btn-all-transcriptions.active {
    background: #e6f0ff;
    border-color: #007aff;
    font-weight: 600;
}
.btn-create-project {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px dashed #bbb;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    text-align: center;
    transition: all 0.15s;
}
.btn-create-project:hover {
    border-color: #007aff;
    color: #007aff;
    background: #f5f9ff;
}
.project-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 4px;
}
.project-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    color: #999;
    border-radius: 3px;
    line-height: 1;
}
.project-actions button:hover {
    background: #e0e0e0;
    color: #333;
}

/* Project option in upload form */
.project-option {
    margin: 12px 0;
}
.project-toggle-btn {
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px dashed #bbb;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.15s;
}
.project-toggle-btn:hover {
    border-color: #007aff;
    color: #007aff;
    background: #f5f9ff;
}
.project-toggle-btn.active {
    border-color: #007aff;
    color: #007aff;
    background: #f5f9ff;
    border-style: solid;
}
.project-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 8px;
}
.existing-project-field {
    display: none;
}
.existing-project-field.visible {
    display: block;
}

.debug-mode-btn {
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#toggleRefreshBtn {
    background: #6c757d;
    color: white;
    border: none;
}
.debug-btn-on {
    background: #28a745;
}
.debug-btn-off {
    background: #6c757d;
}

/* ---- Responsive: index/main-layout ---- */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 220px 1fr;
    }
    .main-layout #speakersSection {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .upload-form {
        padding: 18px;
        margin-bottom: 24px;
    }
    .submit-btn {
        width: 100%;
    }
    .main-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .main-layout #projectsSection {
        order: 0;
    }
    .main-layout #historySection {
        order: 1;
    }
    .main-layout #speakersSection {
        display: none;
    }
    .projects-panel {
        position: static;
    }
    #speakersSection {
        position: static !important;
    }
    .projects-toggle {
        display: block;
        margin-bottom: 10px;
    }
    .projects-content {
        display: none;
    }
    .projects-panel.open .projects-content {
        display: block;
    }
    .history-item {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }
    .history-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .upload-form {
        padding: 16px;
    }
    .history-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .history-link,
    .delete-btn {
        display: block;
        width: 100%;
        text-align: center;
    }
}
