/* ══════════════════════════════════════════════════════════════
   AGENT STUDIO — editor de scene (v2)
   ══════════════════════════════════════════════════════════════ */
.agent-core.agent-editor {
    width: min(1080px, 95vw);
    max-height: 92vh;
    overflow-y: auto;
    text-align: left;
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.agent-editor .ae-top { display: flex; align-items: center; gap: 12px; }
.agent-editor h2 { font-family: 'Fraunces', serif; }

/* Selector de mod */
.ae-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ae-mode {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 11px 13px; border-radius: 14px; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); font-family: inherit; text-align: left;
    transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
}
.ae-mode i { font-size: 0.9rem; margin-bottom: 2px; }
.ae-mode span { font-size: 0.82rem; font-weight: 800; color: var(--text-primary); }
.ae-mode small { font-size: 0.6rem; color: var(--text-faint); line-height: 1.2; }
.ae-mode:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.ae-mode.active { background: var(--accent-dim); border-color: var(--accent-border); }
.ae-mode.active i, .ae-mode.active span { color: var(--accent); }

/* Bara de parametri */
.ae-params {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
    padding: 10px; border-radius: 14px; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
}
.ae-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; }
.ae-field label, .ae-col-title {
    font-size: 0.55rem; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-faint);
}
.ae-sel {
    background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-primary); padding: 8px 30px 8px 12px; font-size: 0.74rem; font-weight: 600;
    font-family: inherit; outline: none; cursor: pointer; width: 100%;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    color-scheme: dark; /* lista nativă devine dark, în stilul aplicației */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2365d69e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.ae-sel:hover { border-color: var(--border-strong); }
.ae-sel:focus { border-color: var(--accent-border); }
.ae-sel option { background: #0d0d1a; color: var(--text-primary); }
html.light .ae-sel { color-scheme: light; }
html.light .ae-sel option { background: #fff; color: #1a1a2e; }
.ae-toggle {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 9px 12px; border-radius: 10px; font-size: 0.72rem; color: var(--text-primary);
    background: rgba(101,214,158,0.05); border: 1px solid rgba(101,214,158,0.18); white-space: nowrap;
}

/* Panou de control per mod */
.ae-control:empty { display: none; }
.ae-control {
    padding: 14px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 10px;
}
.ae-control textarea {
    width: 100%; background: var(--bg-base); border: 1px solid var(--border); border-radius: 12px;
    color: var(--text-primary); padding: 11px 13px; font-size: 0.82rem; font-family: inherit;
    outline: none; resize: vertical; min-height: 60px; line-height: 1.5;
}
.ae-control textarea:focus { border-color: var(--accent-border); }
.ae-ctl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ae-btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 12px;
    font-weight: 800; font-size: 0.78rem; cursor: pointer; font-family: inherit; border: none;
    transition: all 0.2s; white-space: nowrap;
}
.ae-btn-primary { background: linear-gradient(135deg,#3ecf8e,#65d69e,#4ade80); color: #072215; }
.ae-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -10px rgba(101,214,158,0.5); }
.ae-btn-ghost { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); }
.ae-btn-ghost:hover { border-color: var(--border-strong); }
.ae-btn-indigo { background: var(--indigo-dim); border: 1px solid var(--indigo-border); color: #a5a8ff; }
.ae-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Dropzone poze (mod images) */
.ae-dropzone {
    border: 1.5px dashed var(--indigo-border); border-radius: 12px; padding: 18px;
    text-align: center; cursor: pointer; color: #a5a8ff; font-size: 0.78rem; font-weight: 700;
    background: rgba(99,102,241,0.04); transition: all 0.2s;
}
.ae-dropzone:hover { background: rgba(99,102,241,0.09); }

/* Lista de scene */
.ae-scenes { display: flex; flex-direction: column; gap: 10px; }
.ae-scene {
    display: grid; grid-template-columns: 30px 1fr 1fr; gap: 12px; position: relative;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 12px 12px 14px;
    animation: fadeInUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
.ae-scene.busy { border-color: var(--indigo-border); }
.ae-scene.done { border-color: var(--accent-border); }
.ae-scene-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ae-scene-num {
    width: 26px; height: 26px; border-radius: 8px; background: var(--indigo-dim);
    border: 1px solid var(--indigo-border); color: #a5a8ff; font-family: 'JetBrains Mono', monospace;
    font-weight: 800; font-size: 0.74rem; display: flex; align-items: center; justify-content: center;
}
.ae-scene-del {
    width: 24px; height: 24px; border-radius: 7px; cursor: pointer; border: 1px solid var(--border);
    background: rgba(255,255,255,0.03); color: var(--text-faint); font-size: 0.65rem; transition: all 0.2s;
}
.ae-scene-del:hover { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.3); color: #fca5a5; }
.ae-col { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ae-col-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ae-col-title i { color: var(--accent); margin-right: 4px; }
.ae-col.video .ae-col-title i { color: #a5a8ff; }
.ae-pt {
    width: 100%; background: var(--bg-base); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-primary); padding: 9px 11px; font-size: 0.76rem; font-family: inherit;
    outline: none; resize: vertical; min-height: 70px; line-height: 1.45;
}
.ae-pt:focus { border-color: var(--accent-border); }
/* Loading: animație shimmer pe textarea cât scrie agentul promptul */
.ae-pt.loading {
    color: transparent; pointer-events: none; border-color: var(--accent-border);
    background-image: linear-gradient(90deg, rgba(101,214,158,0.04) 0%, rgba(101,214,158,0.16) 50%, rgba(101,214,158,0.04) 100%);
    background-size: 200% 100%; animation: aePromptShimmer 1.4s ease-in-out infinite;
}
.ae-pt.loading::placeholder { color: transparent; }
@keyframes aePromptShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.ae-thumb {
    width: 100%; aspect-ratio: 9/16; max-height: 420px; border-radius: 10px; overflow: hidden; position: relative;
    background: rgba(255,255,255,0.03); border: 1px solid var(--border); margin: 0 auto;
    display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 0.66rem;
}
.ae-thumb img, .ae-thumb video { width: 100%; height: 100%; object-fit: cover; }
.ae-thumb.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 100%); background-size: 200% 100%; animation: shimmer 1.8s ease-in-out infinite; }
.ae-cell-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ae-mini {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 8px; border-radius: 9px; font-size: 0.68rem; font-weight: 700; cursor: pointer;
    font-family: inherit; border: 1px solid var(--border); background: rgba(255,255,255,0.03);
    color: var(--text-muted); transition: all 0.18s; white-space: nowrap;
}
.ae-mini:hover { border-color: var(--border-strong); color: var(--text-primary); }
.ae-mini.gen { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent); }
.ae-mini.gen.video { background: var(--indigo-dim); border-color: var(--indigo-border); color: #a5a8ff; }
.ae-mini:disabled { opacity: 0.45; cursor: not-allowed; }
.ae-mini.icononly { flex: 0 0 auto; width: 34px; }

/* Adauga scena */
.ae-addrow {
    width: 100%; padding: 11px; border-radius: 12px; cursor: pointer; font-family: inherit;
    font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
    background: rgba(255,255,255,0.02); border: 1.5px dashed var(--border-strong);
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s;
}
.ae-addrow:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }

/* Bara de jos */
.ae-footer-actions {
    position: sticky; bottom: -18px; display: flex; align-items: center; gap: 12px;
    padding: 12px 2px 2px; background: linear-gradient(to top, var(--bg-elevated) 60%, transparent);
    margin: 0 -2px;
}
.ae-status { flex: 1; font-size: 0.74rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.ae-produce {
    display: inline-flex; align-items: center; gap: 9px; padding: 13px 26px; border-radius: 14px;
    border: none; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 0.86rem; color: #072215;
    background: linear-gradient(135deg,#3ecf8e,#65d69e,#4ade80); background-size: 200% 200%;
    animation: genGrad 4s ease infinite; box-shadow: 0 14px 30px -10px rgba(101,214,158,0.4); transition: all 0.25s;
}
.ae-produce:hover { transform: translateY(-1px); box-shadow: 0 18px 36px -10px rgba(101,214,158,0.55); }
.ae-produce:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Light mode */
html.light .ae-pt, html.light .ae-control textarea { background: rgba(255,255,255,0.9); }
html.light .ae-thumb { background: rgba(0,0,0,0.03); }

/* Chat conversațional */
.ae-chat { display: flex; flex-direction: column; gap: 8px; }
.ae-chat-thread {
    flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; padding: 12px;
    background: rgba(12,14,22,0.55);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 8px;
    box-shadow: 0 18px 50px -22px rgba(0,0,0,0.7);
    animation: aeThreadIn 0.16s ease both;
}
html.light .ae-chat-thread { background: rgba(255,255,255,0.55); }
@keyframes aeThreadIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ae-chat-msg {
    max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: 0.8rem; line-height: 1.45;
    white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; min-width: 0; flex: 0 0 auto;
    animation: fadeInUp 0.3s ease both;
}
.ae-chat-msg.user { align-self: flex-end; background: var(--accent-dim); border: 1px solid var(--accent-border); color: var(--text-primary); border-bottom-right-radius: 4px; }
.ae-chat-msg.agent { align-self: flex-start; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text-primary); border-bottom-left-radius: 4px; }
.ae-chat-msg.thinking { color: var(--text-muted); font-style: italic; }
.ae-chat-input {
    display: flex; gap: 8px; align-items: flex-end;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
    padding: 7px 7px 7px 4px; transition: all 0.22s;
}
.ae-chat-input:focus-within {
    border-color: var(--accent-border); background: rgba(101,214,158,0.03);
    box-shadow: 0 0 0 3px rgba(101,214,158,0.06), 0 0 26px rgba(101,214,158,0.06);
}
.ae-chat-input textarea {
    flex: 1; background: transparent; border: none; color: var(--text-primary);
    padding: 9px 10px; font-size: 0.84rem; font-family: inherit;
    outline: none; resize: none; min-height: 26px; max-height: 140px; line-height: 1.5;
}
.ae-chat-input textarea::placeholder { color: var(--text-faint); }
html.light .ae-chat-input { background: rgba(255,255,255,0.9); }

/* Dropdown custom în stil Viralio (înlocuiește lista nativă urâtă) */
.ae-dd { position: relative; width: 100%; }
.ae-dd-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-primary); padding: 9px 12px; font-size: 0.74rem; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: all 0.2s; text-align: left;
}
.ae-dd-btn:hover { border-color: var(--border-strong); }
.ae-dd-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-dd-btn > i { color: var(--accent); font-size: 0.62rem; transition: transform 0.2s; flex: 0 0 auto; }
.ae-dd.open .ae-dd-btn { border-color: var(--accent-border); background: var(--accent-dim); }
.ae-dd.open .ae-dd-btn > i { transform: rotate(180deg); }
.ae-dd-menu {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
    background: rgba(13,13,26,0.98); border: 1px solid var(--border-strong); border-radius: 12px;
    box-shadow: 0 22px 44px -14px rgba(0,0,0,0.75); padding: 5px; max-height: 240px; overflow-y: auto;
    display: none; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    animation: fadeInUp 0.16s ease both;
}
.ae-dd.open .ae-dd-menu { display: block; }
.ae-dd-item {
    padding: 9px 11px; border-radius: 9px; font-size: 0.74rem; font-weight: 600; color: var(--text-muted);
    cursor: pointer; transition: all 0.12s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ae-dd-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.ae-dd-item.active { background: var(--accent-dim); color: var(--accent); }
html.light .ae-dd-menu { background: rgba(255,255,255,0.98); }
html.light .ae-dd-item:hover { background: rgba(0,0,0,0.05); }

/* Label mic pentru casetele de descriere din scenă */
.ae-mini-label {
    font-size: 0.55rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-faint); display: flex; align-items: center; gap: 5px;
}
.ae-mini-label i { color: var(--accent); font-size: 0.6rem; }
.ae-col.video .ae-mini-label i { color: #a5a8ff; }
/* Caseta de descriere = același format ca promptul, dar mai joasă */
.ae-desc { min-height: 48px; }
.ae-prompt-label { font-size: 0.55rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-top: 2px; }
.ae-chat-send {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px; cursor: pointer; border: none;
    background: linear-gradient(135deg,#3ecf8e,#65d69e,#4ade80); color: #072215; font-size: 0.95rem;
    transition: all 0.2s;
}
.ae-chat-send:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(101,214,158,0.5); }
.ae-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toolbar scenariu */
.ae-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
    padding: 10px; border-radius: 14px; background: rgba(255,255,255,0.02); border: 1px solid var(--border);
}
.ae-toolbar .ae-btn { align-self: flex-end; }
.ae-toolbar .ae-btn-primary { margin-left: auto; }

/* Cadrane: descriere per scenă */
.ae-desc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ae-desc-grid:empty { display: none; }
.ae-desc-card {
    display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px;
    background: var(--bg-card); border: 1px solid var(--border);
}
.ae-desc-head { display: flex; align-items: center; gap: 8px; }
.ae-desc-num {
    width: 22px; height: 22px; border-radius: 7px; background: var(--accent-dim); border: 1px solid var(--accent-border);
    color: var(--accent); font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.ae-desc-title { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); }
.ae-desc-thumb { width: 100%; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.03); }
.ae-desc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ae-desc-card textarea {
    width: 100%; background: var(--bg-base); border: 1px solid var(--border); border-radius: 9px;
    color: var(--text-primary); padding: 8px 10px; font-size: 0.74rem; font-family: inherit;
    outline: none; resize: vertical; min-height: 56px; line-height: 1.4;
}
.ae-desc-card textarea:focus { border-color: var(--accent-border); }
.ae-desc-card .ae-mini { width: 100%; }

html.light .ae-chat-input textarea, html.light .ae-desc-card textarea { background: rgba(255,255,255,0.9); }

/* Responsive */
@media (max-width: 760px) {
    .ae-modes { grid-template-columns: 1fr; }
    .ae-scene { grid-template-columns: 26px 1fr; }
    .ae-scene .ae-col { grid-column: 2; }
}

/* ══════════════════════════════════════════════════════════════
   STUDIO v6 — layout full-screen (bara sus / scene / dock jos)
   ══════════════════════════════════════════════════════════════ */
/* Fundal blurat + dot-grid subtil (stil Grok) */
#agent-modal { background: #0a0a0c !important; }
/* Background ca pe viralio.ro/claude — dot-field mint pe fundal #0a0a0c + glow discret sus-centru */
.agent-shell {
    position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; overflow: hidden;
    background-color: #0a0a0c;
    background-image:
        radial-gradient(60% 45% at 50% 0%, rgba(101,214,158,0.06), transparent 70%),
        radial-gradient(circle at center, rgba(101,214,158,0.14) 1.2px, transparent 1.6px);
    background-size: 100% 100%, 24px 24px;
    background-position: center top, center;
    background-repeat: no-repeat, repeat;
}

.ae-bar {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 20px; border-bottom: 1px solid var(--border);
    background: rgba(8,8,16,0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ae-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ae-bar-actions { display: flex; gap: 8px; }
.ae-icon-btn {
    width: 38px; height: 38px; border-radius: 11px; cursor: pointer; font-size: 0.9rem;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.ae-icon-btn:hover { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent); transform: scale(1.05); }

.ae-stage { flex: 1 1 auto; overflow: hidden; padding: 20px clamp(12px,4vw,48px) 180px; }
#ae-scenes.canvas { transform-origin: 0 0; will-change: transform; }
.ae-stage:not(.panning) #ae-scenes.canvas { transition: transform 0.08s ease-out; }
.ae-stage .ae-scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 1500px; margin: 0 auto; align-items: start; }
.ae-stage .ae-addrow { max-width: 1400px; margin: 16px auto 0; }

/* Dock cu adevărat plutitor (peste canvas, nu în flux) */
.ae-dock {
    position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
    width: min(1300px, calc(100% - 28px)); z-index: 20;
    padding: 12px 14px; border-radius: 24px; border: 1px solid var(--border-strong);
    background: rgba(12,12,22,0.94); backdrop-filter: blur(30px) saturate(1.2); -webkit-backdrop-filter: blur(30px) saturate(1.2);
    box-shadow: 0 30px 70px -18px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex; flex-direction: column; gap: 9px;
}
/* Glow-uri decorative mai discrete în agent (să nu pară o poză lângă dock) */
#agent-modal .agent-orb { opacity: 0.22; }
/* Dropdown-urile din dock se deschid ÎN SUS (dock-ul e jos pe ecran) */
.ae-dock .ae-dd-menu { top: auto; bottom: calc(100% + 6px); }
.ae-dock .ae-chat-input, .ae-dock .ae-chat-thread { max-width: 1400px; margin: 0 auto; width: 100%; }
.ae-dock .ae-chat-thread { max-height: 240px; }
/* Badge „nișă activă" pe butonul de nișe */
#ae-niche-btn.has-active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-border), 0 0 14px -4px var(--accent); }

/* Modal Nișe */
.ae-niche-modal { position: fixed; inset: 0; z-index: 100002; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(4,5,10,0.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.ae-niche-modal.show { display: flex; }
.ae-niche-card { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: rgba(14,14,22,0.98); border: 1px solid var(--border-strong); border-radius: 22px; padding: 22px; box-shadow: 0 40px 80px -16px rgba(0,0,0,0.8); }
.ae-niche-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ae-niche-head h3 { font-family: "Fraunces", serif; font-weight: 900; font-size: 1.25rem; color: #fff; margin: 0; display: flex; align-items: center; gap: 9px; }
.ae-niche-sub { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 16px; }
.ae-niche-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ae-niche-empty { font-size: 0.82rem; color: var(--text-faint); text-align: center; padding: 18px; border: 1px dashed var(--border); border-radius: 12px; }
.ae-niche-item { display: flex; align-items: center; justify-content: space-between; gap: 11px; padding: 12px 13px; border-radius: 13px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); cursor: pointer; transition: border-color 0.18s, background 0.18s, transform 0.12s; }
.ae-niche-item:hover { border-color: var(--accent-border); background: rgba(255,255,255,0.04); transform: translateY(-1px); }
.ae-niche-item.active { border-color: var(--accent-border); background: var(--accent-dim); }
.ae-niche-emoji { flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; border-radius: 11px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.ae-niche-item.active .ae-niche-emoji { background: var(--accent-dim); border-color: var(--accent-border); }
.ae-niche-soon { text-align: center; font-size: 0.76rem; color: var(--text-faint); padding: 12px; border: 1px dashed var(--border); border-radius: 12px; margin-top: 4px; }
.ae-niche-item-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ae-niche-item-main b { color: var(--text-primary); font-size: 0.86rem; }
.ae-niche-item-main span { color: var(--text-faint); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.ae-niche-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ae-niche-item-actions .ae-btn { padding: 7px 12px; font-size: 0.74rem; }
.ae-niche-item-actions .ae-icon-btn { width: 32px; height: 32px; font-size: 0.78rem; }
.ae-niche-clear { margin-top: 12px; width: 100%; background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 11px; padding: 9px; font-size: 0.78rem; cursor: pointer; transition: all 0.2s; }
.ae-niche-clear:hover { border-color: var(--danger, #f87171); color: var(--danger, #f87171); }

/* Linie cost + status (sub rândul de controale, ca să nu mai strice butoanele) */
.ae-cost-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1400px; margin: 0 auto; width: 100%; }
.ae-cost-line .ae-status { flex: 0 1 auto; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ae-cost-line:has(.ae-cost:empty):has(.ae-status:empty) { display: none; }
/* Bara de cost estimat (live) */
.ae-cost {
    font-size: 0.74rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
    padding: 2px 2px; flex-wrap: wrap; min-width: 0;
}
.ae-cost:empty { display: none; }
.ae-cost i.fa-coins { color: var(--gold, #f5c842); }
.ae-cost b { color: var(--text-primary); font-weight: 800; }
.ae-cost .ae-cost-break { color: var(--text-faint); }
.ae-cost .ae-cost-cont { color: var(--accent); }
.ae-dock-row { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 7px; max-width: 1400px; margin: 0 auto; width: 100%; }
.ae-dock-row > * { flex: 0 0 auto; }
.ae-dock-row .ae-dd { flex: 0 1 auto; min-width: 0; }
.ae-dock-row .ae-dd-btn { max-width: 170px; padding: 9px 12px; font-size: 0.72rem; }
.ae-dock-row .ae-btn { padding: 9px 13px; font-size: 0.74rem; }
.ae-dock-row .ae-toggle-sm { padding: 8px 11px; font-size: 0.7rem; }
.ae-dock-row .ae-status { flex: 0 0 auto; min-width: 0; }
.ae-dock-row .ae-status:empty { display: none; }
/* Pe ecran mic, dock-ul permite wrap (nu mai e canvas) */
@media (max-width: 980px) {
    .ae-dock-row { flex-wrap: wrap; }
}
.ae-sel-sm { width: auto !important; flex: 0 0 auto; min-width: 0; }
.ae-toggle-sm { padding: 8px 11px; flex: 0 0 auto; }
.ae-dock-row .ae-produce { margin-left: auto; padding: 11px 22px; }
.ae-dock-row .ae-status { flex: 0 0 auto; }

/* Scenă full-width — card cu contur */
.ae-scene2 {
    padding: 16px 18px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--bg-card);
    box-shadow: 0 10px 30px -18px rgba(0,0,0,0.6);
    animation: fadeInUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.ae-scene2:hover { border-color: var(--border-strong); }
.ae-scene2.done { border-color: var(--accent-border); }
.ae-scene2.dragging { opacity: 0.45; }
.ae-scene2.drag-over { border-color: var(--accent-border); box-shadow: 0 0 0 2px var(--accent-border); }
.ae-s2-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; cursor: grab; }
.ae-s2-head:active { cursor: grabbing; }
.ae-drag-hint { color: var(--text-faint); font-size: 0.7rem; }
.ae-s2-num {
    width: 28px; height: 28px; border-radius: 9px; background: var(--indigo-dim); border: 1px solid var(--indigo-border);
    color: #a5a8ff; font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.ae-s2-body { display: flex; align-items: flex-start; gap: 16px; }
.ae-media-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ae-arrow { flex: 0 0 auto; align-self: center; color: var(--text-faint); font-size: 1.3rem; padding-top: 60px; }

.ae-media {
    width: 100%; aspect-ratio: 9/16; max-height: 40vh; border-radius: 14px; overflow: hidden; position: relative;
    background: rgba(255,255,255,0.03); border: 1px solid var(--border); margin: 0 auto;
    display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 0.8rem;
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s, border-color 0.2s;
}
.ae-media img, .ae-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ae-media.has-media { cursor: pointer; }
.ae-media.has-media:hover { transform: scale(1.02) translateY(-3px); box-shadow: 0 26px 54px -18px rgba(0,0,0,0.75); border-color: var(--accent-border); z-index: 2; }
.ae-media .ae-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.22s; background: rgba(0,0,0,0.18); }
.ae-media.has-media:hover .ae-play { opacity: 1; }
.ae-play i { font-size: 2rem; color: #fff; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.7)); }
.ae-media.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 100%); background-size: 200% 100%; animation: shimmer 1.8s ease-in-out infinite; }

/* Loading vizibil pe box-ul de imagine/video (spinner + text, peste shimmer) */
.ae-media.loading { border-color: var(--accent-border); }
.ae-media .ae-load {
    position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px;
    background: rgba(8,10,16,0.42); backdrop-filter: blur(2px);
}
.ae-media .ae-load-spin {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid rgba(101,214,158,0.18); border-top-color: var(--accent);
    animation: aeSpin 0.7s linear infinite;
}
.ae-media .ae-load-txt { font-size: 0.74rem; color: var(--text-muted); letter-spacing: 0.2px; }
@keyframes aeSpin { to { transform: rotate(360deg); } }

/* X pentru scoaterea unei poze încărcate */
.ae-media-x {
    position: absolute; top: 7px; right: 7px; z-index: 4;
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10,10,14,0.72); border: 1px solid rgba(255,255,255,0.16);
    color: #fff; font-size: 0.8rem; opacity: 0; transition: all 0.18s;
}
.ae-media:hover .ae-media-x { opacity: 1; }
.ae-media-x:hover { background: var(--danger, #f87171); border-color: transparent; transform: scale(1.08); }

/* Lightbox */
#ae-lightbox {
    position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center;
    background: rgba(2,2,8,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    opacity: 0; transition: opacity 0.25s;
}
#ae-lightbox.show { display: flex; opacity: 1; }
.ae-lb-content { display: flex; align-items: center; justify-content: center; }
.ae-lb-content img, .ae-lb-content video { max-width: 92vw; max-height: 88vh; border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,0.8); }
.ae-lb-close {
    position: absolute; top: 20px; right: 24px; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; font-size: 1.15rem;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 2;
}
.ae-lb-close:hover { background: rgba(255,255,255,0.22); transform: scale(1.06); }

/* Responsive */
@media (max-width: 1100px) {
    .ae-stage .ae-scenes { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .ae-s2-body { flex-direction: column; }
    .ae-arrow { transform: rotate(90deg); padding: 0; align-self: center; }
    .ae-media { max-height: 64vh; }
    .ae-dock { width: calc(100% - 20px); margin-bottom: 12px; border-radius: 18px; }
    .ae-dock-row .ae-produce { margin-left: 0; }
}

/* Dropdown-uri compacte în dock-ul de jos */
.ae-dock-row .ae-dd { width: auto; }
.ae-dock-row .ae-dd-btn { width: auto; }

/* ══════════════════════════════════════════════════════════════
   STUDIO v7 — Canvas tip ComfyUI (noduri mutabile + fire)
   ══════════════════════════════════════════════════════════════ */
#ae-scenes.canvas { position: relative; display: block; max-width: none; margin: 0; min-width: 100%; }
#ae-scenes.canvas .ae-scene2 { position: absolute; width: 520px; margin: 0; z-index: 1; touch-action: none; }
#ae-scenes.canvas .ae-scene2.dragging { z-index: 100; box-shadow: 0 34px 80px -18px rgba(0,0,0,0.85); border-color: var(--accent-border); }
#ae-scenes.canvas .ae-s2-body { flex-direction: row; }
#ae-scenes.canvas .ae-arrow { transform: none; padding-top: 40px; }
#ae-scenes.canvas .ae-media { max-height: 230px; }
#ae-scenes.canvas .ae-s2-head { cursor: grab; }
#ae-scenes.canvas .ae-s2-head:active { cursor: grabbing; }

.ae-wires { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.ae-wire { fill: none; stroke: url(#aeWireGrad); stroke-width: 2.6; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(101,214,158,0.25)); }
.ae-wire-dot { fill: #65d69e; }

/* Stacked mode (telefon / tabletă) */
#ae-scenes.stacked { display: flex; flex-direction: column; gap: 16px; max-width: 600px; margin: 0 auto; }
#ae-scenes.stacked .ae-scene2 { width: 100%; position: static; }

/* Optimizare telefon */
@media (max-width: 980px) {
    .ae-stage { padding: 14px 10px 20px; }
    .ae-s2-body { flex-direction: column; }
    .ae-arrow { transform: rotate(90deg); padding: 0; align-self: center; }
    .ae-media { max-height: 72vh; }
    .ae-scene2 { padding: 14px; }
    .ae-bar { padding: 10px 14px; }
    .ae-brand h2 { font-size: 0.95rem; }
    .ae-dock { width: calc(100% - 16px); margin-bottom: 10px; padding: 10px; }
}

/* Rând de acțiuni în dock: [Generează] [titlu centrat] [Produce tot] */
.ae-dock-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; max-width: 1400px; margin: 2px auto 0; width: 100%; }
.ae-dock-actions .ae-produce { margin: 0; }
.ae-dock-title { text-align: center; font-family: "Fraunces", serif; font-weight: 900; font-size: 1.05rem; color: #fff; white-space: nowrap; display: flex; align-items: center; gap: 7px; justify-content: center; }
@media (max-width: 980px) {
    .ae-dock-actions { grid-template-columns: 1fr; gap: 8px; }
    .ae-dock-actions .ae-btn, .ae-dock-actions .ae-produce { justify-self: stretch !important; width: 100%; justify-content: center; }
    .ae-dock-title { order: -1; }
}

/* Pan canvas (trage de fundal) */
#ae-scenes.canvas { cursor: grab; }
.ae-stage.panning, .ae-stage.panning #ae-scenes.canvas { cursor: grabbing; }

/* Ascunde scrollbar-urile urâte ale stage-ului (navigare prin pan/wheel) */
.ae-stage { scrollbar-width: none; -ms-overflow-style: none; }
.ae-stage::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ── Chat extensibil ── */
.ae-chat-expand {
    flex: 0 0 auto; width: 40px; height: 44px; border-radius: 11px; cursor: pointer; align-self: flex-end;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.ae-chat-expand:hover { color: var(--accent); border-color: var(--accent-border); }
.ae-chat-expand.has-ref { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-border), 0 0 12px -4px var(--accent); }
.ae-ref-chip { display: flex; align-items: center; gap: 10px; max-width: 1400px; margin: 0 auto 8px; padding: 7px 9px; border-radius: 13px; border: 1px solid var(--accent-border); background: var(--accent-dim); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ae-ref-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 9px; flex-shrink: 0; border: 1px solid var(--accent-border); }
.ae-ref-chip span { flex: 1; min-width: 0; font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; }
.ae-ref-chip span b { color: var(--accent); }
.ae-ref-chip button { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,0.2); color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.ae-ref-chip button:hover { color: var(--danger, #f87171); border-color: var(--danger, #f87171); }
.ae-chat-input.expanded { box-shadow: 0 0 0 3px rgba(101,214,158,0.07); }
.ae-chat-input textarea { overflow-y: auto; }

/* ── Tutorial pas cu pas ── */
#ae-tut {
    position: fixed; inset: 0; z-index: 100001; display: none; align-items: center; justify-content: center;
    background: rgba(2,2,8,0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    opacity: 0; transition: opacity 0.25s;
}
#ae-tut.show { display: flex; opacity: 1; }
.ae-tut-card {
    position: relative; width: min(440px, 92vw);
    background: linear-gradient(160deg,#13131f,#0c0c18); border: 1px solid var(--border-strong);
    border-radius: 22px; padding: 28px 26px 22px; text-align: center;
    box-shadow: 0 40px 90px -20px rgba(0,0,0,0.85); animation: fadeInUp 0.3s ease both;
}
.ae-tut-x {
    position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-faint); cursor: pointer;
}
.ae-tut-x:hover { color: var(--text-primary); }
.ae-tut-icon {
    width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 16px;
    background: linear-gradient(135deg,#3ecf8e,#65d69e,#4ade80); display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #072215;
}
.ae-tut-card h3 { font-family: "Fraunces", serif; font-size: 1.3rem; font-weight: 900; color: #fff; margin: 0 0 8px; }
.ae-tut-card p { font-size: 0.86rem; color: var(--text-muted); line-height: 1.55; margin: 0 0 18px; min-height: 66px; }
.ae-tut-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.ae-tut-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); transition: all 0.2s; }
.ae-tut-dot.active { background: var(--accent); width: 20px; border-radius: 99px; }
.ae-tut-nav { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.ae-tut-nav .ae-btn { flex: 0 0 auto; }
