/* ==========================================================================
   RED STUDIO – ai/redai-producer.css
   Oberflaeche von "Mit RedAI produzieren". Praefix: rai-

   Eigene Datei, weil plugins.css bereits zu viele Zustaendigkeiten traegt.
   Benutzt ausschliesslich die vorhandenen Gestaltungsmarken aus design.css
   (--rw-*), damit die Flaeche wie der Rest des Studios aussieht.
   ========================================================================== */

/* ── Knopf in der Kopfleiste ─────────────────────────────────────────────── */
.rs-btn.rai-open {
    border-color: var(--rw-line-p);
    background: linear-gradient(180deg, rgba(152, 10, 10, .34), rgba(152, 10, 10, .16));
    color: #fff;
    font-weight: 700;
}
.rs-btn.rai-open:hover { background: linear-gradient(180deg, rgba(209, 20, 20, .5), rgba(152, 10, 10, .26)); }
.rs-btn.rai-open .rai-eye {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--rw-primary-hi); margin-right: 7px; vertical-align: middle;
    box-shadow: var(--rw-glow-p);
}

/* ── Ueberlagerung ───────────────────────────────────────────────────────── */
.rai-overlay {
    position: fixed; inset: 0; z-index: 12000;
    display: none; align-items: center; justify-content: center;
    padding: 28px;
    background: rgba(4, 5, 8, .74);
    backdrop-filter: blur(7px);
}
.rai-overlay.is-open { display: flex; }

.rai-box {
    width: 100%; max-width: 720px; max-height: 88vh;
    display: flex; flex-direction: column;
    border: 1px solid var(--rw-stroke-2); border-radius: var(--rw-r);
    background: linear-gradient(180deg, var(--rw-panel-2), var(--rw-panel));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .62), 0 0 0 1px rgba(152, 10, 10, .18);
    overflow: hidden;
    animation: rai-rise .2s var(--rw-ease);
}
@keyframes rai-rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rai-box { animation: none; } }

.rai-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--rw-stroke);
    background: linear-gradient(180deg, rgba(152, 10, 10, .16), transparent);
}
.rai-mark {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    border: 1px solid var(--rw-line-p);
    background: radial-gradient(circle at 50% 45%, rgba(209, 20, 20, .55), rgba(152, 10, 10, .1) 62%);
}
.rai-mark i { display: block; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: var(--rw-glow-p); }
.rai-title { flex: 1; min-width: 0; }
.rai-title b { display: block; font-size: 15px; font-weight: 800; letter-spacing: .3px; color: var(--rw-text); }
.rai-title span { display: block; font-size: 11.5px; color: var(--rw-muted); margin-top: 1px; }
.rai-x {
    border: none; background: transparent; color: var(--rw-muted);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.rai-x:hover { color: #fff; background: rgba(255, 255, 255, .07); }

.rai-body { padding: 20px; overflow-y: auto; }

/* ── Eingabe ─────────────────────────────────────────────────────────────── */
.rai-q { font-size: 16px; font-weight: 700; color: var(--rw-text); margin: 0 0 12px; }
.rai-input {
    width: 100%; min-height: 96px; resize: vertical;
    padding: 13px 15px; border-radius: var(--rw-r-sm);
    border: 1px solid var(--rw-stroke-2); background: var(--rw-inset);
    color: var(--rw-text); font-family: var(--rw-font); font-size: 14.5px; line-height: 1.55;
    outline: none; transition: border-color .16s, box-shadow .16s;
}
.rai-input:focus { border-color: var(--rw-line-p); box-shadow: 0 0 0 3px rgba(152, 10, 10, .16); }
.rai-input::placeholder { color: var(--rw-dim); }

.rai-examples { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; }
.rai-ex {
    border: 1px solid var(--rw-stroke); background: var(--rw-glass-2);
    color: var(--rw-muted); font-size: 12px; font-family: inherit;
    padding: 6px 11px; border-radius: 20px; cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.rai-ex:hover { color: #fff; border-color: var(--rw-line-s); background: rgba(171, 39, 232, .14); }

/* ── Expertenbereich ─────────────────────────────────────────────────────── */
.rai-more { margin-top: 16px; border-top: 1px solid var(--rw-stroke); padding-top: 12px; }
.rai-more > summary {
    cursor: pointer; list-style: none; font-size: 12.5px; color: var(--rw-muted);
    display: inline-flex; align-items: center; gap: 7px; user-select: none;
}
.rai-more > summary::-webkit-details-marker { display: none; }
.rai-more > summary::before { content: '+'; font-family: var(--rw-mono); color: var(--rw-primary-hi); }
.rai-more[open] > summary::before { content: '–'; }
.rai-more > summary:hover { color: var(--rw-text); }

.rai-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.rai-field { display: flex; flex-direction: column; gap: 5px; }
.rai-field label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--rw-dim); font-family: var(--rw-mono); }
.rai-field input, .rai-field select {
    background: var(--rw-inset); border: 1px solid var(--rw-stroke-2); color: var(--rw-text);
    border-radius: 7px; padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none;
}
.rai-field input:focus, .rai-field select:focus { border-color: var(--rw-line-p); }

/* ── Fusszeile ───────────────────────────────────────────────────────────── */
.rai-foot {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-top: 1px solid var(--rw-stroke); background: rgba(0, 0, 0, .22);
}
.rai-foot-hint { flex: 1; min-width: 0; font-size: 11.5px; color: var(--rw-dim); }
.rai-go {
    border: 1px solid var(--rw-line-p); border-radius: 9px; cursor: pointer;
    background: linear-gradient(180deg, var(--rw-primary-hi), var(--rw-primary));
    color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 800;
    padding: 10px 22px; letter-spacing: .3px;
    transition: filter .15s, opacity .15s;
}
.rai-go:hover:not(:disabled) { filter: brightness(1.14); }
.rai-go:disabled { opacity: .45; cursor: not-allowed; }

/* ── Fortschritt ─────────────────────────────────────────────────────────── */
.rai-steps { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 0; }
.rai-step {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 2px; font-size: 13px; color: var(--rw-muted);
    border-bottom: 1px solid var(--rw-stroke);
}
.rai-step:last-child { border-bottom: none; }
.rai-step-dot {
    width: 8px; height: 8px; border-radius: 50%; flex: none;
    background: var(--rw-dim);
}
.rai-step.is-active { color: var(--rw-text); }
.rai-step.is-active .rai-step-dot { background: var(--rw-primary-hi); box-shadow: var(--rw-glow-p); animation: rai-pulse 1.1s infinite; }
.rai-step.is-done .rai-step-dot { background: #3fbf7f; }
@keyframes rai-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rai-step.is-active .rai-step-dot { animation: none; } }

.rai-note { font-size: 12.5px; color: var(--rw-muted); line-height: 1.6; margin: 14px 0 0; }
.rai-error {
    border-left: 3px solid var(--rw-primary-hi); background: rgba(152, 10, 10, .12);
    padding: 11px 14px; border-radius: 0 7px 7px 0; font-size: 13px; color: #ffd7d7; margin: 4px 0 0;
}
.rai-warn {
    border-left: 3px solid #d8a23a; background: rgba(216, 162, 58, .1);
    padding: 10px 13px; border-radius: 0 7px 7px 0; font-size: 12.5px; color: #f0d9a8; margin: 12px 0 0;
}
.rai-warn ul { margin: 6px 0 0; padding-left: 18px; }

/* ── Ergebnis ────────────────────────────────────────────────────────────── */
.rai-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 4px 0 16px; }
.rai-stat {
    border: 1px solid var(--rw-stroke); border-radius: var(--rw-r-sm);
    background: var(--rw-glass-2); padding: 12px 14px;
}
.rai-stat b { display: block; font-size: 21px; font-weight: 800; color: var(--rw-text); font-family: var(--rw-mono); }
.rai-stat span { display: block; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--rw-dim); margin-top: 3px; }
.rai-tracklist { display: flex; flex-wrap: wrap; gap: 6px; }
.rai-chip {
    font-size: 11.5px; padding: 4px 10px; border-radius: 20px;
    border: 1px solid var(--rw-stroke-2); background: var(--rw-glass); color: var(--rw-text);
}
.rai-chip i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.rai-variants { margin-top: 14px; }
.rai-variants-title { margin: 0 0 7px; font-size: 11px; color: var(--rw-dim); letter-spacing: .08em; text-transform: uppercase; }
.rai-variant-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.rai-variant {
    border: 1px solid var(--rw-line-s); border-radius: 20px; cursor: pointer;
    background: rgba(171, 39, 232, .12); color: var(--rw-text);
    padding: 6px 11px; font: 12px var(--rw-font);
}
.rai-variant:hover { background: rgba(171, 39, 232, .24); color: #fff; }

/* ── Debug (nur Super-Admin) ─────────────────────────────────────────────── */
.rai-debug { margin-top: 16px; border-top: 1px solid var(--rw-stroke); padding-top: 12px; }
.rai-debug > summary { cursor: pointer; font-size: 11.5px; color: var(--rw-dim); font-family: var(--rw-mono); }
.rai-debug pre {
    max-height: 260px; overflow: auto; margin: 10px 0 0;
    background: var(--rw-inset); border: 1px solid var(--rw-stroke); border-radius: 7px;
    padding: 11px 13px; font-family: var(--rw-mono); font-size: 11px; line-height: 1.55; color: #9fb0c8;
}
.rai-debug-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rai-debug-row button {
    border: 1px solid var(--rw-stroke-2); background: var(--rw-glass-2); color: var(--rw-muted);
    border-radius: 7px; padding: 6px 11px; font-size: 11.5px; font-family: inherit; cursor: pointer;
}
.rai-debug-row button:hover { color: #fff; border-color: var(--rw-line-s); }

@media (max-width: 620px) {
    .rai-overlay { padding: 0; align-items: stretch; }
    .rai-box { max-width: none; max-height: none; height:100dvh; border-radius: 0; border: none; }
    .rai-head{ padding:max(12px,env(safe-area-inset-top)) 14px 12px; }
    .rai-x{ min-width:44px; min-height:44px; }
    .rai-body{ padding:16px 14px; overscroll-behavior:contain; }
    .rai-fields{ grid-template-columns:1fr; }
    .rai-field input,.rai-field select{ min-height:44px; font-size:16px; }
    .rai-input{ min-height:128px; font-size:16px; }
    .rai-ex{ min-height:40px; }
    .rai-foot{ padding:10px 14px max(10px,env(safe-area-inset-bottom)); }
    .rai-foot-hint{ display:none; }
    .rai-go{ width:100%; min-height:48px; justify-content:center; }
}
