/* AI Voice Assistant - Floating Button Styles */

.ai-voice-button {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00A651 0%, #00d46a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 8px 24px rgba(0, 166, 81, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: floatButton 3s ease-in-out infinite;
}

.ai-voice-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 166, 81, 0.6);
}

.ai-voice-button:active {
    transform: scale(0.95);
}

.ai-voice-button i {
    font-size: 24px;
    color: white;
    z-index: 2;
    transition: all 0.3s ease;
}

/* Voice Ripple Effect - Animated when speaking */
.voice-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 166, 81, 0.4) 0%, transparent 70%);
    animation: rippleEffect 1.5s ease-out infinite;
    display: none;
    will-change: transform, opacity;
}

@keyframes rippleEffect {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Floating Animation */
@keyframes floatButton {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* Speaking State */
.ai-voice-button.speaking {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
    animation: pulse 1s ease-in-out infinite;
}

.ai-voice-button.speaking .voice-ripple {
    display: block;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Paused State */
.ai-voice-button.paused {
    background: linear-gradient(135deg, #ffa502 0%, #ffb733 100%);
    box-shadow: 0 8px 24px rgba(255, 165, 2, 0.4);
}

/* Idle State (default) */
.ai-voice-button.idle {
    background: linear-gradient(135deg, #00A651 0%, #00d46a 100%);
}

/* Dark Mode Support */
html.dark-mode .ai-voice-button,
body.dark-mode .ai-voice-button {
    box-shadow: 0 8px 24px rgba(0, 255, 135, 0.3);
}

html.dark-mode .ai-voice-button.speaking,
body.dark-mode .ai-voice-button.speaking {
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.5);
}

html.dark-mode .ai-voice-button.paused,
body.dark-mode .ai-voice-button.paused {
    box-shadow: 0 8px 24px rgba(255, 165, 2, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-voice-button {
        bottom: 90px;
        right: 15px;
        width: 56px;
        height: 56px;
    }

    .ai-voice-button i {
        font-size: 22px;
    }
}

/* Accessibility - Focus state */
.ai-voice-button:focus {
    outline: 3px solid rgba(0, 166, 81, 0.5);
    outline-offset: 3px;
}

/* Loading state (optional) */
.ai-voice-button.loading {
    background: linear-gradient(135deg, #64b5f6 0%, #42a5f5 100%);
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Tooltip on hover */
.ai-voice-button::before {
    content: attr(title);
    position: absolute;
    right: 70px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.ai-voice-button:hover::before {
    opacity: 1;
}

/* Glowing effect when speaking */
.ai-voice-button.speaking::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    filter: none;
    background: rgba(0, 166, 81, 0.3);
    z-index: -1;
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
}

/* --- AI FOCUS HIGHLIGHT (Now controlled by JS V4.5 Premium Engine) --- */

/* --- INTERACTIVE GLASS POPUP (FUTURISTIC & PREMIUM) --- */
.ai-voice-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: aiFadeIn 0.4s ease-out;
}

.ai-voice-popup {
    background: #ffffff;
    border-radius: 32px;
    padding: 45px 35px;
    width: 92%;
    max-width: 400px;
    text-align: center;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: aiPopUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
}

.ai-nursery-about {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Glassy Ambient Glow */
.ai-voice-popup::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(0, 166, 81, 0.15) 0%, transparent 70%);
    filter: none;
    z-index: -1;
}

.ai-voice-popup-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 24px;
    /* Squircle style */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 36px;
    color: #166534;
    box-shadow:
        0 10px 25px -5px rgba(22, 101, 52, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    animation: aiFloatIcon 4s ease-in-out infinite;
}

.ai-voice-popup-title {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

.ai-voice-popup-text {
    font-size: 16px;
    color: #475569;
    margin-bottom: 35px;
    line-height: 1.6;
    font-weight: 400;
}

.ai-voice-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.ai-btn-option {
    padding: 16px 24px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Poppins', sans-serif;
    flex: 1;
}

.ai-btn-yes {
    background: #00A651;
    color: white;
    padding: 13px 24px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    box-shadow: 0 10px 20px -5px rgba(0, 166, 81, 0.4);
}

.ai-btn-yes:hover {
    background: #008037;
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(0, 166, 81, 0.6);
}

.ai-btn-no {
    background: #f1f5f9;
    color: #64748b;
    padding: 10px 30px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
}

.ai-btn-no:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Animations */
@keyframes aiFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes aiPopUp {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes aiFloatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes rotateBg {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

html.dark-mode .ai-voice-popup {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

html.dark-mode .ai-voice-popup-title {
    color: #f8fafc;
}

html.dark-mode .ai-voice-popup-text {
    color: #94a3b8;
}

html.dark-mode .ai-btn-no {
    background: #1e293b;
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.05);
}

html.dark-mode .ai-btn-no:hover {
    background: #334155;
    color: #f8fafc;
}

html.dark-mode .ai-voice-popup-icon {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    color: #34d399;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

html.dark-mode .ai-focus-highlight {
    background: rgba(31, 41, 55, 0.95);
    border-color: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2), 0 10px 25px rgba(0, 0, 0, 0.4);
}

html.dark-mode h1.ai-focus-highlight,
html.dark-mode span.ai-focus-highlight {
    background: #065f46;
    color: #fff !important;
}

html.dark-mode .ai-voice-popup-title {
    color: #f9fafb;
}

html.dark-mode .ai-voice-popup-text {
    color: #d1d5db;
}

html.dark-mode .ai-voice-popup-icon {
    background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
    color: #34d399;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

html.dark-mode .ai-btn-no {
    background: #374151;
    color: #9ca3af;
}