/* AlmaMate AI Speaking Agent — agent.css */

:root {
    --alma-color: #0057FF;
    --alma-dark:  #0041cc;
    --alma-light: #e8f0ff;
}

/* ── Wrapper ── */
#alma-agent-wrapper {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* ── FAB ── */
#alma-agent-fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--alma-color);
    border: none;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0 6px 24px rgba(0,87,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#alma-agent-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0,87,255,0.55);
}

/* ── Agent Window ── */
#alma-agent-window {
    width: 340px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
    flex-direction: column;
    overflow: hidden;
    animation: almaUp 0.28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes almaUp {
    from { opacity:0; transform:translateY(30px) scale(0.96); }
    to   { opacity:1; transform:translateY(0)   scale(1); }
}

/* ── Header ── */
#alma-agent-header {
    background: var(--alma-color);
    color: #fff;
    padding: 22px 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.alma-agent-avatar-wrap {
    margin-bottom: 10px;
}
#alma-agent-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    position: relative;
}
.alma-avatar-ring {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    animation: almaPulse 2.5s ease-in-out infinite;
}
@keyframes almaPulse {
    0%,100% { transform: scale(1);    opacity: 0.7; }
    50%      { transform: scale(1.12); opacity: 0.3; }
}
#alma-agent-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}
#alma-agent-subtitle {
    font-size: 12px;
    opacity: 0.8;
}
#alma-agent-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
#alma-agent-close:hover { background: rgba(255,255,255,0.35); }

/* ── Body / Transcript ── */
#alma-agent-body {
    padding: 14px 16px 8px;
    flex: 1;
    min-height: 120px;
    max-height: 180px;
    overflow-y: auto;
    background: #f7f8fc;
    border-bottom: 1px solid #eee;
}
#alma-agent-body::-webkit-scrollbar { width: 3px; }
#alma-agent-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

#alma-status-text {
    font-size: 13px;
    color: #888;
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

/* Transcript lines */
#alma-transcript-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alma-transcript-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: almaFadeIn 0.2s ease;
}
@keyframes almaFadeIn {
    from { opacity:0; transform:translateY(4px); }
    to   { opacity:1; transform:translateY(0); }
}
.alma-who {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.alma-said {
    font-size: 13px;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 90%;
}
.alma-from-user .alma-who  { color: var(--alma-color); align-self: flex-end; }
.alma-from-user .alma-said {
    background: var(--alma-color);
    color: #fff;
    border-radius: 12px 12px 4px 12px;
    align-self: flex-end;
}
.alma-from-bot .alma-who  { color: #666; }
.alma-from-bot .alma-said {
    background: #fff;
    color: #222;
    border-radius: 12px 12px 12px 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── Voice Visualizer ── */
#alma-visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 44px;
    padding: 8px 0;
    background: #fff;
}
.alma-bar {
    width: 5px;
    height: 6px;
    background: var(--alma-color);
    border-radius: 3px;
    opacity: 0.3;
    transition: height 0.1s ease;
}
#alma-visualizer.active .alma-bar {
    opacity: 1;
}

/* ── Mic Controls ── */
#alma-agent-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 16px 10px;
    background: #fff;
}
#alma-mic-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--alma-color);
    border: none;
    cursor: pointer;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,87,255,0.35);
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}
#alma-mic-btn:hover {
    transform: scale(1.06);
}
#alma-mic-btn.alma-listening {
    background: #e53935;
    box-shadow: 0 0 0 8px rgba(229,57,53,0.2), 0 4px 16px rgba(229,57,53,0.4);
    animation: almaMicPulse 1s ease-in-out infinite;
}
#alma-mic-btn.alma-thinking {
    background: #f59f00;
    box-shadow: 0 4px 16px rgba(245,159,0,0.4);
}
#alma-mic-btn.alma-speaking {
    background: #2e7d32;
    box-shadow: 0 0 0 8px rgba(46,125,50,0.18), 0 4px 16px rgba(46,125,50,0.35);
    animation: almaMicPulse 0.8s ease-in-out infinite;
}
@keyframes almaMicPulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
#alma-mic-label {
    font-size: 12px;
    color: #888;
}

/* ── Text Fallback ── */
#alma-text-fallback {
    display: flex;
    gap: 8px;
    padding: 10px 14px 14px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}
#alma-text-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
#alma-text-input:focus { border-color: var(--alma-color); }
#alma-text-send {
    background: var(--alma-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
#alma-text-send:hover { background: var(--alma-dark); }

/* ── Mobile ── */
@media (max-width: 480px) {
    #alma-agent-window {
        width: calc(100vw - 24px);
    }
    #alma-agent-wrapper {
        bottom: 16px;
        right: 12px;
    }
}
