/* ═══════════════════════════════════════════════════════════════════ */
/* YUMI FRONTEND - ESTILOS (SEM APIS EXPOSTAS)                       */
/* ═══════════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: transparent;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    -webkit-app-region: drag;
    user-select: none;
}

.bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, #0a0a0a 60%, #000 100%);
    border-radius: 0;
    border: 2px solid #00ff8830;
    z-index: 0;
}

/* ── ÁREA DO VTUBER/AVATAR ── */
.vtuber-area {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-content {
    width: 420px;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.sound-waves {
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 136, 0.15);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.sound-waves.active {
    opacity: 1;
    animation: waveExpand 1.5s ease-out infinite;
}

@keyframes waveExpand {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ── TÍTULO ── */
.YUMI-title {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 5vw, 36px);
    letter-spacing: clamp(12px, 3vw, 20px);
    color: #00ff88;
    text-shadow: 0 0 30px #00ff88, 0 0 60px #00ff88;
    text-indent: 20px;
    opacity: 1;
    pointer-events: none;
    -webkit-app-region: drag;
}

/* ── STATUS ── */
.status-text {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 8px;
    color: #00ff88;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 24px;
    border-radius: 30px;
    backdrop-filter: blur(8px);
    border: 2px solid rgba(0, 255, 136, 0.3);
    text-shadow: 0 0 10px #00ff88;
}

/* ── TEXTO FALADO ── */
.spoken-text {
    position: absolute;
    bottom: 220px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 18px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 85%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.15), transparent);
    padding: 10px 30px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.4);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.spoken-text.visible { opacity: 1; }

/* ── CONTROLES TOPO ── */
.controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.35s;
    -webkit-app-region: no-drag;
}

body:hover .controls { opacity: 1; }

.btn-ctrl {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.15s;
    -webkit-app-region: no-drag;
    background: transparent;
    outline: none;
}

.btn-ctrl:hover { transform: scale(1.4); }

/* ── DOCK INFERIOR ── */
.btn-bar {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 50px;
    border: 2px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    -webkit-app-region: no-drag;
}

body:hover .btn-bar { opacity: 1; }

.icon-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s;
    -webkit-app-region: no-drag;
    pointer-events: all;
    outline: none;
    border: none;
}

.icon-btn:hover {
    background: rgba(0, 255, 136, 0.25);
    transform: translateY(-5px) scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.5);
}

.icon-btn svg {
    width: 28px;
    height: 28px;
    fill: #00ff88;
    filter: drop-shadow(0 0 4px #00ff88);
    pointer-events: none;
}

.icon-btn.muted { background: rgba(255, 59, 59, 0.25); }
.icon-btn.muted svg { fill: #ff3b3b; filter: drop-shadow(0 0 4px #ff3b3b); }
.icon-btn.ended { background: rgba(255, 59, 59, 0.25); }
.icon-btn.ended svg { fill: #ff3b3b; filter: drop-shadow(0 0 4px #ff3b3b); }
.icon-btn.screen-on { background: rgba(255, 189, 46, 0.25); }
.icon-btn.screen-on svg { fill: #ffbd2e; filter: drop-shadow(0 0 4px #ffbd2e); }
.icon-btn.cam-on { background: rgba(255, 95, 87, 0.25); }
.icon-btn.cam-on svg { fill: #ff5f57; filter: drop-shadow(0 0 4px #ff5f57); }
.icon-btn.chat-open { background: rgba(0, 255, 136, 0.25); }

/* ── CHAT BOX ── */
#chatBox {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 400px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    -webkit-app-region: no-drag;
}

#chatBox.open { max-height: 60px; opacity: 1; }

#chatInput {
    flex: 1;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00ff8860;
    border-radius: 25px;
    padding: 12px 24px;
    color: #00ff88;
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    -webkit-app-region: no-drag;
}

#chatInput::placeholder { color: #00ff8850; }
#chatInput:focus { border-color: #00ff88; }

#chatSend {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #00ff8860;
    background: rgba(0, 255, 136, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-app-region: no-drag;
    flex-shrink: 0;
}

#chatSend:hover {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
    transform: scale(1.1);
}

#chatSend svg {
    width: 20px;
    height: 20px;
    fill: #00ff88;
    pointer-events: none;
}

/* ── CÂMERA ── */
#cameraWrap {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 30;
    width: 180px;
    height: 135px;
    border-radius: 15px;
    border: 3px solid #00ff8860;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
    display: none;
    -webkit-app-region: no-drag;
}

#cameraWrap.active { display: block; }
#cameraVideo { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#cameraOverlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 12px;
    letter-spacing: 3px;
    color: #00ff88;
    text-align: center;
    font-weight: bold;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* 🧠 PAINEL DE COMPORTAMENTO DA IA (NOVO)                            */
/* ═══════════════════════════════════════════════════════════════════ */

#behaviorOverlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    -webkit-app-region: no-drag;
}

#behaviorOverlay.open { display: flex; }

#behaviorPanel {
    width: 600px;
    max-height: 90vh;
    background: linear-gradient(145deg, #0d0d0d 0%, #1a1a1a 100%);
    border: 2px solid #00ff8860;
    border-radius: 25px;
    box-shadow: 0 0 80px rgba(0, 255, 136, 0.3), inset 0 0 60px rgba(0, 255, 136, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: panelSlideIn 0.3s ease-out;
}

@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#behaviorHeader {
    padding: 25px 30px 20px;
    border-bottom: 2px solid #00ff8820;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 255, 136, 0.05);
}

#behaviorHeader span {
    font-size: 22px;
    letter-spacing: 6px;
    color: #00ff88;
    font-weight: bold;
    text-shadow: 0 0 20px #00ff88;
}

#behaviorClose {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 95, 87, 0.2);
    border: 2px solid rgba(255, 95, 87, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #ff5f57;
    transition: all 0.2s;
}

#behaviorClose:hover {
    background: rgba(255, 95, 87, 0.4);
    transform: scale(1.1) rotate(90deg);
}

#behaviorBody {
    flex: 1;
    overflow-y: auto;
    padding: 25px 30px;
    scrollbar-width: thin;
    scrollbar-color: #00ff8850 transparent;
}

.behavior-section {
    margin-bottom: 25px;
}

.behavior-label {
    font-size: 14px;
    color: #00ff88;
    margin-bottom: 10px;
    letter-spacing: 3px;
    font-weight: bold;
    text-transform: uppercase;
}

.behavior-input,
.behavior-select,
.behavior-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00ff8840;
    border-radius: 12px;
    padding: 14px 18px;
    color: #e0e0e0;
    font-family: 'Share Tech Mono', monospace;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
}

.behavior-input:focus,
.behavior-select:focus,
.behavior-textarea:focus {
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    background: rgba(0, 0, 0, 0.8);
}

.behavior-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300ff88' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

.behavior-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

.behavior-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Preview do comportamento */
.behavior-preview {
    background: rgba(0, 255, 136, 0.08);
    border: 2px dashed #00ff8860;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.behavior-preview-title {
    font-size: 14px;
    color: #00ff88;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: bold;
}

#behaviorPreviewText {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    font-family: 'Share Tech Mono', monospace;
    white-space: pre-wrap;
}

#behaviorFooter {
    padding: 20px 30px 25px;
    border-top: 2px solid #00ff8820;
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
}

.behavior-btn {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
}

.behavior-btn-save {
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.3), rgba(0, 255, 136, 0.1));
    border: 2px solid #00ff88;
    color: #00ff88;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.behavior-btn-save:hover {
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.5), rgba(0, 255, 136, 0.2));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.5);
}

.behavior-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
}

.behavior-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

#behaviorStatus {
    font-size: 14px;
    letter-spacing: 3px;
    text-align: center;
    color: #00ff88;
    padding: 10px 0 20px;
    min-height: 40px;
    font-weight: bold;
}

/* Toast */
#toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #00ff88;
    border-radius: 30px;
    padding: 15px 35px;
    color: #00ff88;
    font-size: 16px;
    letter-spacing: 3px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    font-weight: bold;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

#toast.show { opacity: 1; }
#toast.error { border-color: #ff5f57; color: #ff5f57; box-shadow: 0 0 30px rgba(255, 95, 87, 0.3); }