
/* ============================================
   ATLAS AI PAGE WIDGET — Floating Bottom Right
   ============================================ */
#atlas-page-widget {
    position: fixed;
    bottom: 0;
    right: 30px;
    z-index: 9000;
}
#atlas-page-transcript {
    display: none;
    width: 264px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
 border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
    padding: 0 12px 10px 12px;
    margin-top: 10px;
    margin-bottom: 15px;
}
#atlas-page-transcript.active {
    display: block;
}
#atlas-page-transcript-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
}
#atlas-page-transcript .atlas-line-who {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 2px;
}
#atlas-page-transcript .atlas-line-text {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
}
#atlas-page-transcript .atlas-line-atlas .atlas-line-who { color: #2c5770; }
#atlas-page-transcript .atlas-line-user  .atlas-line-who { color: #888; }

#atlas-page-panel {
    background: linear-gradient(135deg, #2c5770 0%, #1b3b4f 100%);
    border-radius: 12px 12px 0 0;
    padding: 10px 10px 12px 10px;
    width: 150px;
    box-shadow: 0 -3px 18px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#atlas-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
#atlas-page-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
#atlas-page-title svg {
    stroke: white;
    flex-shrink: 0;
}
#atlas-page-mic-icon.listening {
    animation: atlas-ear-pulse 1.4s ease-in-out infinite;
}
@keyframes atlas-ear-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.0); }
}
#atlas-page-toggle-wrap {
    position: relative;
    display: inline-block;
    width: 33px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}
#atlas-page-toggle {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
#atlas-page-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.22);
    border-radius: 18px;
    transition: background 0.2s;
    cursor: pointer;
}
#atlas-page-toggle-slider::before {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    left: 2.5px;
    top: 2.5px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
#atlas-page-toggle:checked + #atlas-page-toggle-slider {
    background: #4CAF50;
}
#atlas-page-toggle:checked + #atlas-page-toggle-slider::before {
    transform: translateX(14px);
}
#atlas-page-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 14px;
}
#atlas-page-dots-inner span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
}
#atlas-page-dots.active #atlas-page-dots-inner span {
    background: rgba(255,255,255,0.75);
    animation: atlas-dot-bounce 1.2s ease-in-out infinite;
}
#atlas-page-dots.active #atlas-page-dots-inner span:nth-child(1) { animation-delay: 0s; }
#atlas-page-dots.active #atlas-page-dots-inner span:nth-child(2) { animation-delay: 0.2s; }
#atlas-page-dots.active #atlas-page-dots-inner span:nth-child(3) { animation-delay: 0.4s; }
@keyframes atlas-dot-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.45; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

#atlas-page-hint { font-size: 12px; opacity: 0.6; white-space: nowrap; display: none; flex: 1; color: white; }
    #atlas-page-dots.active:not(.speaking) #atlas-page-hint { display: block; }
#atlas-page-dots-inner { display: flex; gap: 4px; position: relative; top: 2px; right: 5px; }
    #atlas-page-dots.active:not(.speaking):not(.started) { justify-content: space-between; }
    #atlas-page-dots.active.started #atlas-page-hint { display: none; }

/* -- Atlas Voice Control Widget ---------------------------- */

#atlas-voice-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Montserrat', sans-serif;
    pointer-events: none;
}

#atlas-transcript {
    width: 300px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
    margin-bottom: 0;
    pointer-events: none;
}

#atlas-voice-widget.atlas-open #atlas-transcript {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 10px;
    pointer-events: auto;
}

#atlas-transcript-inner {
    background: rgba(15, 28, 44, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: none;
}

#atlas-transcript-inner::-webkit-scrollbar { display: none; }

.atlas-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: atlasLineFadeIn 0.35s ease forwards;
    opacity: 0;
}

@keyframes atlasLineFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.atlas-line-who {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.atlas-line.atlas-line-atlas .atlas-line-who { color: #5bc8f5; }
.atlas-line.atlas-line-user  .atlas-line-who { color: #a0c4a8; }

.atlas-line-text {
    font-size: 13px;
    line-height: 1.5;
    font-weight: 400;
}

.atlas-line.atlas-line-atlas .atlas-line-text { color: #ffffff; }
.atlas-line.atlas-line-user  .atlas-line-text { color: #c8dfd0; }

#atlas-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 28, 44, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50px;
    padding: 8px 16px 8px 8px;
    pointer-events: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#atlas-voice-widget.atlas-connected #atlas-bar {
    border-color: rgba(100, 220, 140, 0.4);
    box-shadow: 0 4px 24px rgba(100, 220, 140, 0.1);
}

#atlas-voice-widget.atlas-speaking #atlas-bar {
    border-color: rgba(91, 200, 245, 0.5);
    box-shadow: 0 4px 28px rgba(91, 200, 245, 0.2);
}

#atlas-voice-widget.atlas-listening #atlas-bar {
    border-color: rgba(220, 80, 80, 0.5);
    box-shadow: 0 4px 28px rgba(220, 80, 80, 0.15);
}

#atlas-mic-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #2c5770;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
}

#atlas-mic-btn svg {
    width: 17px;
    height: 17px;
    display: block;
}

#atlas-mic-btn:hover { background: #3a6f8e; transform: scale(1.08); }

#atlas-voice-widget.atlas-connecting #atlas-mic-btn {
    background: #8e6abf;
    animation: atlasConnecting 1.2s linear infinite;
}

@keyframes atlasConnecting {
    0%   { box-shadow: 0 0 0 0    rgba(142,106,191,0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(142,106,191,0);   }
    100% { box-shadow: 0 0 0 0    rgba(142,106,191,0);   }
}

#atlas-voice-widget.atlas-connected #atlas-mic-btn {
    background: #2a7a4a;
}

#atlas-voice-widget.atlas-listening #atlas-mic-btn {
    background: #c0392b;
    animation: atlasMicPulse 0.9s ease-out infinite;
}

#atlas-voice-widget.atlas-speaking #atlas-mic-btn {
    background: #1a7fa8;
    animation: atlasMicPulse 1.6s ease-out infinite;
}

@keyframes atlasMicPulse {
    0%   { box-shadow: 0 0 0 0    rgba(91,200,245,0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(91,200,245,0);   }
    100% { box-shadow: 0 0 0 0    rgba(91,200,245,0);   }
}

#atlas-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

#atlas-name {
    font-size: 13px;
    font-weight: 700;
    color: #e8eef3;
    letter-spacing: 0.04em;
}

#atlas-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 14px;
}

#atlas-dots i {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4a8aaa;
    animation: atlasIdleDot 1.6s ease-in-out infinite;
    font-style: normal;
}

#atlas-dots i:nth-child(2) { animation-delay: 0.2s; }
#atlas-dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes atlasIdleDot {
    0%,80%,100% { opacity: 0.3; transform: scale(0.85); }
    40%          { opacity: 1;   transform: scale(1.15); }
}

#atlas-bars {
    display: none;
    align-items: center;
    gap: 3px;
    height: 16px;
}

#atlas-bars span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: #5bc8f5;
}

#atlas-bars span:nth-child(1) { height: 6px;  animation: atlasBar 0.8s ease-in-out infinite; }
#atlas-bars span:nth-child(2) { height: 12px; animation: atlasBar 0.8s ease-in-out infinite 0.15s; }
#atlas-bars span:nth-child(3) { height: 9px;  animation: atlasBar 0.8s ease-in-out infinite 0.1s; }
#atlas-bars span:nth-child(4) { height: 14px; animation: atlasBar 0.8s ease-in-out infinite 0.25s; }
#atlas-bars span:nth-child(5) { height: 7px;  animation: atlasBar 0.8s ease-in-out infinite 0.05s; }

@keyframes atlasBar {
    0%,100% { transform: scaleY(0.5); opacity: 0.6; }
    50%      { transform: scaleY(1.3); opacity: 1;   }
}

#atlas-voice-widget.atlas-speaking #atlas-dots { display: none; }
#atlas-voice-widget.atlas-speaking #atlas-bars { display: flex; }