/* ============================================
   Conference Page Styles
   3-column layout: Video | Editor | Chat
   ============================================ */

.conference-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conference-container {
    display: grid;
    grid-template-columns: 220px 1fr 350px;
    height: calc(100vh - 60px);
    overflow: hidden;
    transition: grid-template-columns 0.25s ease;
}

.conference-container.left-collapsed {
    grid-template-columns: 48px 1fr 350px;
}

/* ============================================
   LEFT PANEL - Video/Participants
   ============================================ */

.conference-left {
    background: #1a1a1a;
    border-right: 1px solid #2b2b2b;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: min-width 0.25s ease;
}

.conference-left.conf-left-collapsed .video-panel {
    display: none;
}

.conference-left.conf-left-collapsed .conf-left-panel-toggle-wrapper {
    width: 100%;
}

.conf-left-panel-toggle-wrapper {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translate(50%, -50%);
    z-index: 10;
}

.conference-left.conf-left-collapsed .conf-left-panel-toggle-wrapper {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.conf-left-panel-toggle-btn {
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.conference-left.conf-left-collapsed .conf-left-panel-toggle-btn .bi-chevron-left {
    display: none;
}

.conference-left.conf-left-collapsed .conf-left-panel-toggle-btn::after {
    content: ">";
    font-size: 1rem;
    font-weight: bold;
}

.conference-left:not(.conf-left-collapsed) .conf-left-panel-toggle-btn::after {
    display: none;
}

.video-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.video-panel-header {
    color: #ddd;
    font-size: var(--font-size-section-title);
    font-weight: 600;
    padding: 12px 15px;
    border-bottom: 1px solid #2b2b2b;
    background: #0f0f0f;
}

.participants-list {
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.participant-item {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    transition: background 0.2s;
}

.participant-item:hover {
    background: #333;
}

.participant-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.participant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1446A0, #1976D2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    transition: transform 0.2s;
}

.participant-item:hover .participant-avatar {
    transform: scale(1.1);
}

.participant-name {
    color: #fff;
    font-weight: 600;
    font-size: var(--font-size-section-title);
    text-align: center;
}

.participant-status {
    color: #4caf50;
    font-size: var(--font-size-label);
    text-align: center;
    transition: color 0.3s;
}

.participant-status.typing {
    color: #ff9800;
    font-style: italic;
    animation: typing-pulse 1.5s infinite;
}

.conf-session-timer-text {
    font-size: var(--font-size-secondary);
    color: #666;
    margin-right: 12px;
}

@keyframes typing-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* ============================================
   CENTER PANEL - SQL Editor
   ============================================ */

.conference-center {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Кнопка аудио */
#conf-audio-btn.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

#conf-audio-btn.active:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: var(--font-size-secondary);
    color: #666;
}

.connection-status {
    font-size: var(--font-size-label);
    padding: 4px 8px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    font-weight: 500;
}

.connection-status.status-connected {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.connection-status.status-disconnected {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.connection-status.status-reconnecting {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.connection-status.status-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.conference-room-name {
    font-weight: 600;
    color: #333;
}

.conference-participants-count {
    color: #666;
}

.editor-area {
    display: grid;
    grid-template-rows: 1fr 200px;
    gap: 12px;
    padding: 12px;
    height: 100%;
    overflow: hidden;
}

.code-editor-wrapper {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Стили для dash-ace редактора */
.code-editor-wrapper .ace_editor {
    height: 100% !important;
    width: 100% !important;
}

/* SQL подсветка синтаксиса - дополнительные стили */
.ace_keyword {
    color: #0000ff !important;
    font-weight: bold;
}

.ace_string {
    color: #a31515 !important;
}

.ace_comment {
    color: #008000 !important;
    font-style: italic;
}

/* Удаленные курсоры других пользователей */
.remote-cursor {
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0.5;
    }
}

.remote-cursor-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.results-panel {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    max-height: 320px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.results-panel.result-card {
    max-height: 320px;
}

.results-body {
    max-height: 260px;
    overflow: auto;
}

.results-body-table {
    padding: 8px;
    overflow: auto;
}

.conf-results-table {
    border-collapse: collapse;
    font-size: var(--font-size-secondary);
    width: 100%;
}

.conf-results-table th,
.conf-results-table td {
    border: 1px solid #dee2e6;
    padding: 6px 10px;
    text-align: left;
}

.conf-results-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.conf-results-meta {
    font-size: var(--font-size-label);
    color: #6c757d;
    padding: 6px 0 0;
    margin-top: 6px;
    border-top: 1px solid #eee;
}

.conf-result-error {
    padding: 12px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    background: #f8d7da;
    color: #721c24;
}

.conf-result-error-icon {
    margin-right: 8px;
}

.conf-result-error-text {
    margin: 8px 0 0;
    font-size: var(--font-size-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    font-size: var(--font-size-secondary);
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.results-label {
    color: #333;
}

.exec-time {
    color: #666;
    font-weight: normal;
}

.results-body:not(.results-body-table) {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: var(--font-size-body);
    padding: 12px;
    margin: 0;
    background: #fff;
    color: #333;
}

/* ============================================
   RIGHT PANEL - Chat
   ============================================ */

.conference-right {
    background: white;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

.conference-right.chat-collapsed {
    width: 50px;
    min-width: 50px;
}

.conference-right.chat-collapsed .conf-right-tabs,
.conference-right.chat-collapsed .conf-right-content {
    display: none !important;
}

.conf-right-header {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    flex-shrink: 0;
}

.conf-right-tabs .btn {
    font-size: var(--font-size-section-title);
}

.conf-right-tab-btn.active,
.conf-right-tab-btn:not(.btn-outline-primary) {
    font-weight: 600;
}

.conf-right-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.conf-right-tab-panel {
    min-height: 0;
}

.conf-right-tab-panel .chat-messages {
    flex: 1;
    min-height: 0;
}

.conf-right-tab-panel .chat-input {
    flex-shrink: 0;
    border-top: 1px solid #e9ecef;
    padding: 12px;
    background: #fff;
}

/* Right panel: Schema tab uses SchemaViewerComponent (test_executor.css) */
#conf-schema-panel {
    padding: 12px;
    overflow: auto;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.chat-title {
    font-weight: 600;
    font-size: var(--font-size-section-title);
    color: #333;
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-toggle-btn:hover {
    background: #e9ecef;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1446A0, #1976D2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-label);
    font-weight: 600;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-label);
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    color: #333;
}

.message-time {
    color: #999;
}

.message-bubble {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: var(--font-size-body);
    line-height: 1.4;
    color: #333;
    white-space: pre-wrap;  /* Сохраняет переносы строк и пробелы */
    word-wrap: break-word;  /* Разрывает длинные слова */
    overflow-wrap: break-word;  /* Для лучшей совместимости */
}

.chat-input {
    border-top: 1px solid #e9ecef;
    padding: 12px;
    background: white;
}

.chat-input textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-size-body);
    line-height: 1.5;
}

.chat-input textarea:focus {
    border-color: #1446A0;
    box-shadow: 0 0 0 0.2rem rgba(20, 70, 160, 0.25);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .conference-container {
        grid-template-columns: 180px 1fr 300px;
    }
}

@media (max-width: 992px) {
    .conference-container {
        grid-template-columns: 1fr;
        grid-template-rows: 150px 1fr 250px;
    }
    
    .conference-left {
        border-right: none;
        border-bottom: 1px solid #2b2b2b;
    }
    
    .conference-right {
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
    
    .participants-list {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .editor-area {
        grid-template-rows: 1fr 150px;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

.participants-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.results-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.participants-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chat-messages::-webkit-scrollbar-track,
.results-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.participants-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb,
.results-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.participants-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.results-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ============================================
   Utility Classes
   ============================================ */

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: #1446A0 !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

