/* Panoul „Asistent AI" din editorul Node-RED.
   Culorile vin din variabilele temei, ca panoul să urmeze light/dark. */

.panou-ai {
    position: fixed;
    z-index: 100;
    width: 380px;
    height: 520px;
    min-width: 300px;
    min-height: 220px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    resize: both;
    overflow: hidden;
    background: var(--red-ui-primary-background, #fff);
    color: var(--red-ui-primary-text-color, #1c1f23);
    border: 1px solid var(--red-ui-primary-border-color, #b7b7b7);
    border-radius: 6px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
    font-family: var(--red-ui-primary-font, sans-serif);
    font-size: 13px;
}
.panou-ai.pliat { height: auto !important; resize: none; }
.panou-ai.pliat .panou-ai-corp { display: none; }

.panou-ai-cap {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    background: var(--red-ui-secondary-background, #f3f3f3);
    border-bottom: 1px solid var(--red-ui-secondary-border-color, #ddd);
    cursor: move;
    user-select: none;
    flex: 0 0 auto;
}
.panou-ai-titlu { font-weight: 600; flex: 1; }
.panou-ai-cap button {
    background: none; border: 0; cursor: pointer; padding: 2px 6px;
    color: var(--red-ui-secondary-text-color, #777); font-size: 14px; line-height: 1;
}
.panou-ai-cap button:hover { color: var(--red-ui-primary-text-color, #000); }

.panou-ai-corp { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* Fila de discuție: aceleași reguli, dar nume propriu — altfel s-ar confunda
   cu învelișul, care poartă aceeași clasă. */
.panou-ai-discutie { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.panou-ai-model {
    padding: 10px; border-bottom: 1px solid var(--red-ui-secondary-border-color, #ddd);
    flex: 0 0 auto;
}
.panou-ai-schimba {
    width: 100%; padding: 7px 12px; cursor: pointer; font: inherit; font-weight: 600;
    border-radius: 4px;
    background: var(--red-ui-workspace-button-background, #f6f6f6);
    color: var(--red-ui-workspace-button-color, #333);
    border: 1px solid var(--red-ui-form-input-border-color, #ccc);
}
.panou-ai-schimba:hover { background: var(--red-ui-workspace-button-background-hover, #efefef); }
.panou-ai-model-nume {
    margin-top: 7px; text-align: center; font-size: 12px; word-break: break-all;
    color: var(--red-ui-secondary-text-color, #777);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.panou-ai-context {
    padding: 6px 10px; font-size: 11px;
    color: var(--red-ui-tertiary-text-color, #999);
    border-bottom: 1px solid var(--red-ui-secondary-border-color, #ddd);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 0 0 auto;
}

.panou-ai-mesaje { flex: 1 1 auto; overflow-y: auto; padding: 10px; min-height: 0; }
.panou-ai-mesaj { margin-bottom: 12px; }
.panou-ai-mesaj .cine {
    font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
    color: var(--red-ui-tertiary-text-color, #999); margin-bottom: 3px;
}
.panou-ai-mesaj .text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.panou-ai-mesaj.eu .text {
    background: var(--red-ui-secondary-background, #f3f3f3);
    padding: 6px 9px; border-radius: 5px;
}
.panou-ai-mesaj.eroare .text { color: var(--red-ui-border-color-error, #c00); }
.panou-ai-mesaj .nota { font-size: 11px; color: var(--red-ui-border-color-warning, #b58900); margin-top: 5px; }

.panou-ai-propunere {
    margin-top: 8px; padding: 8px; border-radius: 5px;
    border: 1px solid var(--red-ui-secondary-border-color, #ddd);
    background: var(--red-ui-secondary-background, #f8f8f8);
}
.panou-ai-propunere .rezumat { font-size: 12px; margin-bottom: 7px; }
.panou-ai-propunere .butoane { display: flex; gap: 6px; flex-wrap: wrap; }
.panou-ai-propunere button {
    font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; border-radius: 4px;
    background: var(--red-ui-workspace-button-background, #f6f6f6);
    color: var(--red-ui-workspace-button-color, #333);
    border: 1px solid var(--red-ui-form-input-border-color, #ccc);
}
.panou-ai-propunere pre {
    margin: 7px 0 0; max-height: 200px; overflow: auto; font-size: 11px;
    background: var(--red-ui-clipboard-textarea-background, #fbfbfb);
    border: 1px solid var(--red-ui-secondary-border-color, #ddd);
    border-radius: 4px; padding: 7px;
}

.panou-ai-intrare {
    display: flex; gap: 6px; padding: 8px;
    border-top: 1px solid var(--red-ui-secondary-border-color, #ddd);
    flex: 0 0 auto;
}
.panou-ai-intrare textarea {
    flex: 1; resize: none; height: 54px; padding: 6px 8px; font: inherit; border-radius: 4px;
    background: var(--red-ui-form-input-background, #fff);
    color: var(--red-ui-form-text-color, #000);
    border: 1px solid var(--red-ui-form-input-border-color, #ccc);
}
.panou-ai-intrare button {
    align-self: stretch; padding: 0 14px; cursor: pointer; font: inherit; font-weight: 600;
    border-radius: 4px;
    background: var(--red-ui-workspace-button-background, #f6f6f6);
    color: var(--red-ui-workspace-button-color, #333);
    border: 1px solid var(--red-ui-form-input-border-color, #ccc);
}
.panou-ai-intrare button:disabled { opacity: .5; cursor: default; }

.panou-ai-deschide {
    position: fixed; z-index: 100; right: 16px; bottom: 16px;
    padding: 9px 15px; cursor: pointer; font-weight: 600; border-radius: 20px;
    background: var(--red-ui-deploy-button-background, #8f0000);
    color: var(--red-ui-deploy-button-color, #eee);
    border: 1px solid var(--red-ui-deploy-button-border-color, #6e0000);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

.panou-ai-valul {
    position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center;
}
.panou-ai-valul .cadru {
    width: min(1100px, 92vw); height: min(760px, 88vh);
    display: flex; flex-direction: column; border-radius: 8px; overflow: hidden;
    background: var(--red-ui-primary-background, #fff);
}
.panou-ai-valul .bara {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--red-ui-secondary-background, #f3f3f3);
    border-bottom: 1px solid var(--red-ui-secondary-border-color, #ddd);
}
.panou-ai-valul .bara span { flex: 1; font-weight: 600; }
.panou-ai-valul .bara a, .panou-ai-valul .bara button {
    font: inherit; font-size: 12px; cursor: pointer; text-decoration: none;
    color: var(--red-ui-secondary-text-color, #777); background: none; border: 0;
}
.panou-ai-valul iframe { flex: 1; border: 0; width: 100%; }

/* --- comutatorul de file din panou --- */
.panou-ai-file {
    display: flex; gap: 4px; padding: 7px 10px 0; flex: 0 0 auto;
}
.panou-ai-file button {
    flex: 1; padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer;
    border-radius: 4px 4px 0 0;
    background: transparent;
    color: var(--red-ui-secondary-text-color, #777);
    border: 1px solid transparent; border-bottom: 0;
}
.panou-ai-file button.activ {
    background: var(--red-ui-secondary-background, #f3f3f3);
    color: var(--red-ui-primary-text-color, #000);
    border-color: var(--red-ui-secondary-border-color, #ddd);
    font-weight: 600;
}

/* --- fila de stare --- */
.panou-ai-stare { flex: 1 1 auto; overflow-y: auto; padding: 10px; min-height: 0; }
.panou-ai-stare .antet {
    font-size: 11px; color: var(--red-ui-tertiary-text-color, #999); margin-bottom: 9px;
}
.stare-card {
    border: 1px solid var(--red-ui-secondary-border-color, #ddd);
    border-radius: 5px; padding: 8px 10px; margin-bottom: 7px;
    background: var(--red-ui-secondary-background, #fafafa);
}
.stare-card .sus { display: flex; align-items: baseline; gap: 8px; }
.stare-card .nume { flex: 1; font-size: 12px; font-weight: 600; }
.stare-card .valoare { font-size: 16px; font-weight: 700; }
.stare-card .detaliu {
    font-size: 11px; color: var(--red-ui-secondary-text-color, #777); margin-top: 3px;
}
.stare-bara {
    height: 4px; border-radius: 2px; margin-top: 6px; overflow: hidden;
    background: var(--red-ui-primary-background, #fff);
    border: 1px solid var(--red-ui-secondary-border-color, #ddd);
}
.stare-bara > i { display: block; height: 100%; background: var(--red-ui-border-color-success, #3a3); }
.stare-bara.atentie > i { background: var(--red-ui-border-color-warning, #e0a800); }
.stare-bara.rau > i { background: var(--red-ui-border-color-error, #c00); }

.panou-ai-stare h4 {
    margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--red-ui-tertiary-text-color, #999); font-weight: 700;
}
.stare-tabel { width: 100%; border-collapse: collapse; font-size: 11px; }
.stare-tabel th {
    text-align: left; font-weight: 600; padding: 3px 5px;
    color: var(--red-ui-tertiary-text-color, #999);
    border-bottom: 1px solid var(--red-ui-secondary-border-color, #ddd);
}
.stare-tabel td {
    padding: 3px 5px; border-bottom: 1px solid var(--red-ui-secondary-border-color, #eee);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;
}
.stare-tabel .bine { color: var(--red-ui-border-color-success, #3a3); }
.stare-tabel .rau { color: var(--red-ui-border-color-error, #c00); }
.stare-gol { font-size: 11px; color: var(--red-ui-tertiary-text-color, #999); padding: 6px 0; }
.stare-sfat {
    font-size: 11px; padding: 6px 8px; border-radius: 4px; margin-bottom: 5px;
    background: var(--red-ui-secondary-background, #f6f6f6);
    border-left: 3px solid var(--red-ui-border-color-warning, #e0a800);
}
.stare-sfat.bine { border-left-color: var(--red-ui-border-color-success, #3a3); }

.panou-ai-propunere button.periculos {
    border-color: var(--red-ui-border-color-error, #c00);
    color: var(--red-ui-border-color-error, #c00);
}
