/* ═══════════════════════════════════════════════════════════════
   MAHA AGENT — Interface Agent Autonome Mahayawen
   ═══════════════════════════════════════════════════════════════ */

/* ── Overlay ───────────────────────────────────────────────────── */
.maha-agent-overlay {
    position: fixed; inset: 0; z-index: 2000000;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
.maha-agent-overlay.active { opacity: 1; }

/* ── Modal ──────────────────────────────────────────────────────── */
.maha-agent-modal {
    width: 96vw; height: 94vh; max-width: 1600px;
    background: var(--bg-primary, #0a0f0a);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    transform: scale(0.95); transition: transform 0.3s ease;
}
.maha-agent-overlay.active .maha-agent-modal { transform: scale(1); }

/* ── Header ────────────────────────────────────────────────────── */
.maha-agent-header {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.maha-agent-back {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none; color: var(--text-muted, #888);
    cursor: pointer; font-size: 13px; padding: 6px 10px;
    border-radius: 8px; transition: all 0.2s;
}
.maha-agent-back:hover { background: rgba(255,255,255,0.06); color: var(--text, #eee); }

.maha-agent-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 600; color: var(--text, #eee);
    flex: 1;
}
.maha-agent-title-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34,197,94,0.5);
    animation: maha-pulse 2s ease infinite;
}
@keyframes maha-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

.maha-agent-header-actions { display: flex; gap: 8px; }
.maha-agent-publish-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: none;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.maha-agent-publish-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ── Body ──────────────────────────────────────────────────────── */
.maha-agent-body {
    flex: 1; display: flex; overflow: hidden;
}

/* ── Preview (65%) ─────────────────────────────────────────────── */
.maha-agent-preview {
    flex: 0 0 65%; position: relative;
    background: #111;
    border-right: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}
.maha-agent-preview-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted, #666);
    font-size: 14px; text-align: center; gap: 16px;
}
.maha-agent-preview-empty-icon { opacity: 0.3; }
#maha-preview-frame {
    width: 100%; height: 100%; border: none;
    background: #fff;
}

/* ── Chat (35%) ────────────────────────────────────────────────── */
.maha-agent-chat {
    flex: 0 0 35%; display: flex; flex-direction: column;
    background: var(--bg-primary, #0a0f0a);
}

/* Messages */
.maha-agent-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}

/* Welcome */
.maha-welcome {
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    padding: 40px 20px 20px;
    gap: 12px;
}
.maha-welcome h3 {
    font-size: 18px; font-weight: 700;
    color: var(--text, #eee); margin: 0;
}
.maha-welcome p {
    font-size: 13px; color: var(--text-muted, #888);
    margin: 0; max-width: 300px;
}
.maha-welcome-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #b8963e);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800; color: #0a0f0a;
    position: relative;
}
.maha-avatar-glow {
    position: absolute; inset: -4px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(212,175,55,0.3), rgba(184,150,62,0.1));
    animation: maha-glow 3s ease infinite;
}
@keyframes maha-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Suggestions */
.maha-suggestions {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; max-width: 320px; margin-top: 12px;
}
.maha-suggestion {
    padding: 10px 14px; border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text, #eee); font-size: 13px;
    cursor: pointer; text-align: left;
    transition: all 0.2s;
}
.maha-suggestion:hover {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.3);
    transform: translateX(4px);
}

/* Messages */
.maha-msg { display: flex; gap: 8px; max-width: 100%; }
.maha-msg-user { justify-content: flex-end; }
.maha-msg-user .maha-msg-bubble {
    background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(184,150,62,0.1));
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 14px 14px 4px 14px;
    padding: 10px 14px; font-size: 13px;
    color: var(--text, #eee); max-width: 80%;
    word-wrap: break-word;
}
.maha-msg-assistant { align-items: flex-start; }
.maha-msg-avatar {
    width: 28px; height: 28px; min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #b8963e);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #0a0f0a;
}
.maha-msg-assistant .maha-msg-bubble {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px 14px 14px 14px;
    padding: 10px 14px; font-size: 13px;
    color: var(--text, #ddd); max-width: 85%;
    line-height: 1.5; word-wrap: break-word;
}

/* Activity feed */
.maha-activity {
    padding: 8px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(212,175,55,0.03);
    max-height: 140px; overflow-y: auto;
}
.maha-activity-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-muted, #888);
    margin-bottom: 6px;
}
.maha-activity-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #d4af37;
    animation: maha-pulse 1s ease infinite;
}
.maha-activity-steps {
    display: flex; flex-direction: column; gap: 3px;
}
.maha-step {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted, #999);
    padding: 2px 0;
    animation: maha-step-in 0.3s ease;
}
@keyframes maha-step-in {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}
.maha-step-icon { font-size: 13px; }

/* Inline suggestions */
.maha-suggestions-inline {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 4px 0;
}
.maha-suggestion-inline {
    padding: 6px 12px; border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted, #aaa); font-size: 12px;
    cursor: pointer; transition: all 0.2s;
}
.maha-suggestion-inline:hover {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.3);
    color: var(--text, #eee);
}

/* Input */
.maha-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.maha-input-row {
    display: flex; align-items: flex-end; gap: 8px;
}
.maha-input {
    flex: 1; padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; color: var(--text, #eee);
    font-size: 14px; font-family: inherit;
    resize: none; outline: none;
    transition: border-color 0.2s;
    max-height: 120px;
}
.maha-input:focus { border-color: rgba(212,175,55,0.4); }
.maha-input::placeholder { color: var(--text-muted, #555); }
.maha-input:disabled { opacity: 0.5; }

.maha-send {
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 10px; border: none;
    background: linear-gradient(135deg, #d4af37, #b8963e);
    color: #0a0f0a; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.maha-send:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.maha-send:disabled { opacity: 0.4; cursor: not-allowed; }
.maha-send.loading {
    background: rgba(212,175,55,0.3);
    animation: maha-pulse 1s ease infinite;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .maha-agent-modal { width: 100vw; height: 100vh; border-radius: 0; }
    .maha-agent-body { flex-direction: column; }
    .maha-agent-preview { flex: 0 0 50%; }
    .maha-agent-chat { flex: 0 0 50%; }
}
@media (max-width: 600px) {
    .maha-agent-preview { display: none; }
    .maha-agent-chat { flex: 1; }
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
.maha-agent-messages::-webkit-scrollbar,
.maha-activity::-webkit-scrollbar { width: 4px; }
.maha-agent-messages::-webkit-scrollbar-thumb,
.maha-activity::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1); border-radius: 4px;
}

/* ── Chat a GAUCHE, Preview a DROITE ──────────────────────────── */
.maha-agent-chat { order: 1; }
.maha-agent-preview { order: 2; }
