/* css/live.css */

/* Pagrindiniai kintamieji ir stiliai */
body {
    --editor-font-size: 14px; /* Kintamasis šrifto dydžiui */
}

.live-editor-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.editor-header-title {
    font-size: 1.2em;
    font-weight: bold;
}

.editor-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-greeting {
    margin-right: 15px;
}

.header-icon-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-editor {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s ease;
}

.btn-editor.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

.btn-editor.btn-return {
    background-color: var(--accent-red);
    color: white;
}

.btn-editor.icon-btn {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    padding: 8px;
}

.btn-editor:hover {
    opacity: 0.8;
}

.editor-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    min-width: 200px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.file-tree {
    margin-bottom: 15px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.file-item:hover {
    background-color: var(--bg-surface-hover);
    transform: scale(1.02);
}

.file-item.active {
    background-color: var(--accent-blue);
    color: white;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item:hover .file-actions,
.file-item.active .file-actions {
    opacity: 1;
}

.file-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    color: inherit;
}

.file-actions button:hover {
    opacity: 0.7;
}

.project-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-actions .btn {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

.code-editor-container {
    flex: 1;
    overflow: hidden;
}

.cm-editor {
    height: 100%;
    font-size: var(--editor-font-size); /* Naudojame CSS kintamąjį */
}

.preview-pane {
    width: 50%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-main);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.output-header h3 {
    margin: 0;
    font-size: 1em;
}

.output-tools {
    display: flex;
    gap: 10px;
}

.tool-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.tool-button:hover {
    color: var(--accent-blue);
}

.output-wrapper {
    flex: 1;
    overflow: hidden;
}

#output-frame {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
}

/* Iššokančių langų (overlay) stiliai */
.tool-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    flex-direction: column;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.tool-overlay.active {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    z-index: 1001; /* Turi būti aukščiau už kitus elementus */
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-surface-hover);
    border-bottom: 1px solid var(--border-color);
    cursor: move;
}

.tool-header span {
    font-weight: bold;
    font-size: 1.1em;
}

.tool-header button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-primary);
}

.tool-header button:hover {
    color: var(--accent-red);
}

.tool-output {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

/* Konsolės ir Inspektoriaus specifiniai stiliai */
.console-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
}

#console-pane .tool-header {
    padding: 5px 15px; /* Sumažinam header aukštį konsolei */
}

.console-controls input,
.console-controls select,
.console-controls button {
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.console-controls button {
    border: none;
    cursor: pointer;
}

.console-output {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background-color: var(--bg-main);
    border-radius: 0 0 4px 4px;
    padding: 10px;
    height: 100%;
    overflow-y: auto;
}

.console-entry {
    padding: 3px 0;
    border-bottom: 1px solid var(--border-color-translucent);
    white-space: pre-wrap;
    word-break: break-word;
}

.console-entry.log-error {
    color: var(--accent-red);
}
.console-entry.log-warn {
    color: var(--accent-yellow);
}
.console-entry.log-result {
    color: var(--accent-green);
}

/* Išsaugotų projektų stiliai */
.saved-projects-search input {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.saved-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: var(--bg-surface-hover);
}

.saved-project-actions {
    display: flex;
    gap: 5px;
}

.saved-project-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    color: white;
}
.saved-project-actions .load-project-btn { background-color: var(--accent-blue); }
.saved-project-actions .edit-project-btn { background-color: var(--accent-yellow); }
.saved-project-actions .delete-project-btn { background-color: var(--accent-red); }

/* Nustatymų ir išsaugojimo formų stiliai */
.save-project-form, .settings-output {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.save-project-form input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-main);
    color: var(--text-primary);
}
.save-project-actions, .settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.setting-item label { font-weight: bold; }
.setting-item input[type="number"], .setting-item select {
    width: 100px; padding: 5px; border: 1px solid var(--border-color); border-radius: 4px;
    background-color: var(--bg-main); color: var(--text-primary);
}
.setting-item input[type="checkbox"] { width: 18px; height: 18px; }


/* Bendri mygtukų stiliai */
.btn {
    padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer;
    font-size: 0.9em; display: inline-flex; align-items: center; gap: 5px;
    transition: opacity 0.2s ease;
}
.btn-primary { background-color: var(--accent-blue); color: white; }
.btn-secondary { background-color: var(--bg-surface-hover); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-sm { padding: 5px 10px; font-size: 0.8em; }
.btn:hover { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Bendradarbiavimo stiliai */
.collab-users { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.collab-user { padding: 5px; background-color: var(--bg-surface-hover); border-radius: 4px; font-size: 0.9em; }
.collab-user:before { content: "•"; color: var(--accent-green); margin-right: 5px; }

/* Responsyvumas */
@media (max-width: 768px) {
    .editor-layout { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); }
    .preview-pane { width: 100%; }
    .tool-overlay { width: 95%; max-height: 90vh; }
    .editor-header-right .user-greeting { display: none; }
}