/**
 * AI Voice Assistant - Clean Minimal Template
 * Version: 3.1.0
 * One-on-one conversation focused design
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.page-template-template-ai-voice-assistant {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* ========================================
   BRIGHTIQ-STYLE ANIMATED BACKGROUND
   ======================================== */

.aiva-immersive-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.aiva-animated-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 30s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Gradient Orbs - BrightIQ Style */
.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: floatOrb 25s ease-in-out infinite;
    pointer-events: none;
}

.gradient-orb.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgb(102, 126, 234) 0%, rgba(0, 0, 0, 0) 70%);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.gradient-orb.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgb(240, 147, 251) 0%, rgba(0, 0, 0, 0) 70%);
    bottom: -200px;
    right: -200px;
    animation-delay: 5s;
}

.gradient-orb.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgb(118, 75, 162) 0%, rgba(0, 0, 0, 0) 70%);
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    animation-delay: 10s;
}

@keyframes floatOrb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, 50px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 80px) scale(0.95);
    }
    75% {
        transform: translate(70px, -40px) scale(1.05);
    }
}

/* Twinkling Stars */
.aiva-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
    animation: twinkle 3s ease-in-out infinite;
    opacity: 0;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* Floating School Icons */
.aiva-school-icon {
    position: absolute;
    font-size: 48px;
    opacity: 0.5;
    pointer-events: none;
    animation: floatIcon 20s ease-in-out infinite;
    z-index: 3;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

@keyframes floatIcon {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.5;
    }
    25% {
        transform: translate(30px, -40px) rotate(5deg);
        opacity: 0.7;
    }
    50% {
        transform: translate(-20px, -80px) rotate(-5deg);
        opacity: 0.4;
    }
    75% {
        transform: translate(40px, -40px) rotate(3deg);
        opacity: 0.6;
    }
}

/* ========================================
   START SCREEN
   ======================================== */

.aiva-start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.aiva-start-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.aiva-start-content {
    text-align: center;
    color: white;
    max-width: 600px;
    padding: 0 20px;
}

.aiva-start-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.aiva-start-content p {
    font-size: 1.25rem;
    margin-bottom: 40px;
    opacity: 0.95;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.aiva-start-button {
    width: 220px;
    height: 220px;
    background: linear-gradient(135deg, #ff0080 0%, #7928ca 100%);
    border: 3px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(255, 0, 128, 0.4), 0 0 0 0 rgba(255, 255, 255, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: pulseButton 2s ease-in-out infinite;
}

@keyframes pulseButton {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 20px 60px rgba(255, 0, 128, 0.4), 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 25px 70px rgba(255, 0, 128, 0.6), 0 0 0 20px rgba(255, 255, 255, 0);
    }
}

.aiva-start-button:hover {
    transform: scale(1.08);
    box-shadow: 0 25px 70px rgba(255, 0, 128, 0.6);
    animation: none;
}

.aiva-start-button:active {
    transform: scale(0.95);
}

.aiva-start-button svg {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

/* ========================================
   CONVERSATION INTERFACE - CENTER TEXT
   ======================================== */

.aiva-conversation-interface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 10;
}

.aiva-conversation-interface.active {
    display: block;
}

/* Center Text Display */
.aiva-center-text-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    text-align: center;
    z-index: 15;
    display: flex;
    flex-direction: column;
}

.aiva-ai-text {
    font-size: 2.5rem;
    font-weight: 300;
    color: white;
    line-height: 1.6;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: fadeInText 0.5s ease forwards;
    padding: 50px 60px 40px 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(80vh - 20px);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Custom scrollbar for AI text */
.aiva-ai-text::-webkit-scrollbar {
    width: 8px;
}

.aiva-ai-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.aiva-ai-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.aiva-ai-text::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Close button for AI text */
.aiva-text-close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.aiva-text-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.aiva-close-icon {
    color: white;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    display: block;
}

.aiva-ai-text p {
    margin-bottom: 1.2em;
    font-size: 2rem;
}

.aiva-ai-text p:last-child {
    margin-bottom: 0;
}

.aiva-ai-text ul,
.aiva-ai-text ol {
    margin: 1em 0;
    padding-left: 2em;
    text-align: left;
    font-size: 1.8rem;
}

.aiva-ai-text ol {
    list-style-type: decimal;
    counter-reset: item;
}

.aiva-ai-text ul {
    list-style-type: disc;
}

.aiva-ai-text li {
    margin-bottom: 0.6em;
    line-height: 1.5;
}

.aiva-ai-text li:last-child {
    margin-bottom: 0;
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   DONE SPEAKING BUTTON
   ======================================== */

.aiva-done-button {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    
    display: flex;
    align-items: center;
    gap: 12px;
    
    padding: 18px 36px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    
    cursor: pointer;
    transition: all 0.3s ease;
    
    box-shadow: 0 8px 32px rgba(240, 87, 108, 0.4),
                0 0 0 0 rgba(240, 87, 108, 0.7);
    
    animation: donePulse 2s ease-in-out infinite;
}

.aiva-done-button:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 12px 40px rgba(240, 87, 108, 0.6),
                0 0 0 8px rgba(240, 87, 108, 0.2);
}

.aiva-done-button:active {
    transform: translateX(-50%) scale(0.98);
}

.aiva-done-button svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

@keyframes donePulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(240, 87, 108, 0.4),
                    0 0 0 0 rgba(240, 87, 108, 0.7);
    }
    50% {
        box-shadow: 0 8px 32px rgba(240, 87, 108, 0.4),
                    0 0 0 12px rgba(240, 87, 108, 0);
    }
}

.aiva-user-prompt {
    font-size: 1.5rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-style: italic;
}

/* Real-time Listening Text */
.aiva-listening-text {
    font-size: 2rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: pulseListening 1.5s ease-in-out infinite;
    padding: 30px;
    background: rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulseListening {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* AI Status Indicator */
.aiva-ai-status {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    padding: 15px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.aiva-status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s ease-in-out infinite;
}

.aiva-status-icon.listening {
    background: #3b82f6;
    box-shadow: 0 0 10px #3b82f6;
}

.aiva-status-icon.speaking {
    background: #8b5cf6;
    box-shadow: 0 0 10px #8b5cf6;
}

.aiva-status-icon.processing {
    background: #f59e0b;
    box-shadow: 0 0 10px #f59e0b;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.aiva-status-text {
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet and below */
@media (max-width: 768px) {
    .aiva-start-content h1 {
        font-size: 2rem;
    }

    .aiva-start-content p {
        font-size: 1rem;
    }

    .aiva-start-button {
        width: 180px;
        height: 180px;
    }

    .aiva-start-button svg {
        width: 50px;
        height: 50px;
    }

    .gradient-orb.orb-1 {
        width: 300px;
        height: 300px;
    }

    .gradient-orb.orb-2 {
        width: 250px;
        height: 250px;
    }

    .gradient-orb.orb-3 {
        width: 200px;
        height: 200px;
    }

    .aiva-ai-text {
        font-size: 1.4rem;
        padding: 45px 50px 25px 20px;
        line-height: 1.7;
        max-height: calc(75vh - 20px);
        overflow-x: hidden;
    }
    
    .aiva-text-close-button {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
    
    .aiva-close-icon {
        font-size: 18px;
    }
    
    .aiva-ai-text p {
        font-size: 1.4rem;
        margin-bottom: 1em;
    }
    
    .aiva-ai-text ul,
    .aiva-ai-text ol {
        font-size: 1.3rem;
        padding-left: 1.5em;
    }
    
    .aiva-ai-text li {
        margin-bottom: 0.7em;
    }

    .aiva-user-prompt {
        font-size: 1.1rem;
    }
    
    .aiva-listening-text {
        font-size: 1.4rem;
        padding: 20px;
    }

    .aiva-center-text-display {
        width: 90%;
    }

    .aiva-ai-status {
        top: 15px;
        right: 15px;
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .aiva-status-text {
        font-size: 0.85rem;
    }

    .aiva-school-icon {
        font-size: 36px;
    }
    
    .aiva-done-button {
        bottom: 30px;
        padding: 15px 28px;
        font-size: 1rem;
    }
    
    .aiva-done-button svg {
        width: 20px;
        height: 20px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .aiva-start-content h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .aiva-start-content p {
        font-size: 0.95rem;
        margin-bottom: 30px;
    }

    .aiva-start-button {
        width: 150px;
        height: 150px;
    }

    .aiva-start-button svg {
        width: 40px;
        height: 40px;
    }
    
    .aiva-ai-text {
        font-size: 1.1rem;
        padding: 40px 45px 20px 15px;
        line-height: 1.8;
        border-radius: 20px;
        max-height: calc(70vh - 20px);
        overflow-x: hidden;
    }
    
    .aiva-text-close-button {
        width: 30px;
        height: 30px;
        top: 8px;
        right: 8px;
    }
    
    .aiva-close-icon {
        font-size: 16px;
    }
    
    .aiva-ai-text p {
        font-size: 1.1rem;
        margin-bottom: 1em;
    }
    
    .aiva-ai-text ul,
    .aiva-ai-text ol {
        font-size: 1rem;
        padding-left: 1.2em;
        margin: 0.8em 0;
    }
    
    .aiva-ai-text li {
        margin-bottom: 0.6em;
        line-height: 1.6;
    }
    
    .aiva-user-prompt {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .aiva-listening-text {
        font-size: 1.1rem;
        padding: 15px;
        min-height: 80px;
        border-radius: 20px;
    }
    
    .aiva-center-text-display {
        width: 95%;
        max-width: none;
    }
    
    .aiva-ai-status {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        gap: 8px;
    }
    
    .aiva-status-icon {
        width: 10px;
        height: 10px;
    }
    
    .aiva-status-text {
        font-size: 0.8rem;
    }
    
    .aiva-done-button {
        bottom: 20px;
        padding: 12px 24px;
        font-size: 0.95rem;
        gap: 8px;
    }
    
    .aiva-done-button svg {
        width: 18px;
        height: 18px;
    }
    
    .gradient-orb.orb-1 {
        width: 250px;
        height: 250px;
    }

    .gradient-orb.orb-2 {
        width: 200px;
        height: 200px;
    }

    .gradient-orb.orb-3 {
        width: 150px;
        height: 150px;
    }
    
    .aiva-school-icon {
        font-size: 28px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .aiva-start-content h1 {
        font-size: 1.5rem;
    }
    
    .aiva-ai-text {
        font-size: 1rem;
        padding: 35px 40px 15px 12px;
        overflow-x: hidden;
    }
    
    .aiva-ai-text p {
        font-size: 1rem;
    }
    
    .aiva-ai-text ul,
    .aiva-ai-text ol {
        font-size: 0.95rem;
    }
    
    .aiva-done-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}
