/* ============================================
   LAYOUT STYLES
   Стили layout: center-content, particleSphere, controls, status
   ============================================ */
/* Center Content - Sphere */
.center-content {
    flex: 1;
    position: relative;
    display: flex !important; /* Принудительно показываем */
    align-items: center; /* Центрируем по вертикали */
    justify-content: center; /* Центрируем по горизонтали */
    overflow: visible !important; /* Изменено на visible для видимости сферы */
    background: none;
    height: 100%;
    width: 100%;
    z-index: 1; /* Below menu and chat */
    visibility: visible !important;
    opacity: 1 !important;
}

/* При сворачивании чата на десктопе - центрируем сферу и текст */
@media (min-width: 801px) {
    /* Когда чат свернут, центрируем center-content (он находится перед chat-wrapper в DOM) */
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized ~ .center-content,
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized + .center-content {
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Центрируем сферу при сворачивании чата (уже центрирована, но убеждаемся) */
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized ~ .center-content #particleSphere,
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized + .center-content #particleSphere {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    /* Центрируем нижний текст при сворачивании чата */
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized ~ .center-content .controls,
    body:not(:has(.center-content:has(.tool-card))) .chat-wrapper.minimized + .center-content .controls {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    /* Альтернативный подход: если center-content находится перед chat-wrapper, используем предыдущий sibling selector */
    body:not(:has(.center-content:has(.tool-card))) .center-content:has(~ .chat-wrapper.minimized) {
        align-items: center !important;
        justify-content: center !important;
    }
    
    body:not(:has(.center-content:has(.tool-card))) .center-content:has(~ .chat-wrapper.minimized) #particleSphere {
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    body:not(:has(.center-content:has(.tool-card))) .center-content:has(~ .chat-wrapper.minimized) .controls {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* Assistant View - обертка для сферы */
/* КРИТИЧНО: Должна быть видна сразу при загрузке страницы */
.assistant-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: flex !important; /* Принудительно показываем сразу */
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 20 !important;
    pointer-events: auto !important;
    background: transparent;
}

/* Canvas for particle sphere - interactive */
/* КРИТИЧНО: Canvas должен быть видим сразу при загрузке страницы */
#particleSphere {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Начальные размеры устанавливаем сразу для мгновенного отображения */
    width: 700px !important;
    height: 700px !important;
    display: block !important; /* Принудительно показываем сразу */
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer !important;
    z-index: 21 !important; /* Выше assistant-view */
    background: transparent;
    pointer-events: auto !important;
    /* Сохраняем соотношение сторон 1:1 для круглой сферы */
    aspect-ratio: 1;
    /* Убеждаемся что canvas виден сразу при загрузке */
    min-width: 700px;
    min-height: 700px;
    /* Opacity transitions managed via JS to prevent distortions */
    will-change: opacity, transform; /* Optimization for smooth transitions */
}

#particleSphere:hover {
    opacity: 0.95;
}

/* UI controls */
.controls {
    position: absolute;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 10;
    pointer-events: none; /* Don't block clicks on sphere */
}

/* Button hidden */
.control-btn {
    display: none;
}

/* Status text - main control element */
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(74, 74, 74, 0.7);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-normal);
    font-family: var(--font-primary);
    text-align: center;
    min-height: var(--spacing-2xl);
    padding: var(--spacing-md) var(--spacing-2xl);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-3xl);
    transition: all var(--transition-slow);
    animation: softPulse 3s ease-in-out infinite;
    background-clip: padding-box; /* Important for correct gradient display */
    white-space: nowrap;
    min-width: max-content;
    pointer-events: none;
}

/* Soft pulse to attract attention */
@keyframes softPulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

/* Animation for active state - "thinking" text effect */
.status.listening {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.12) 50%, 
        rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    background-position: -200% 0;
    animation: thinkingGlow 2s ease-in-out infinite;
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

@keyframes thinkingGlow {
    0% {
        background-position: -200% 0;
        color: rgba(255, 255, 255, 0.7);
    }
    50% {
        background-position: 200% 0;
        color: rgba(255, 255, 255, 0.85);
    }
    100% {
        background-position: -200% 0;
        color: rgba(255, 255, 255, 0.7);
    }
}

/* Light theme styles for status text */
body.light-theme .status {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .status.listening {
    background: linear-gradient(90deg, 
        rgba(0, 0, 0, 0.05) 0%, 
        rgba(0, 0, 0, 0.12) 50%, 
        rgba(0, 0, 0, 0.05) 100%);
    background-size: 200% 100%;
    background-position: -200% 0;
    animation: thinkingGlowLight 2s ease-in-out infinite;
    color: rgba(0, 0, 0, 0.8);
    border-color: rgba(0, 0, 0, 0.15);
}

@keyframes thinkingGlowLight {
    0% {
        background-position: -200% 0;
        color: rgba(0, 0, 0, 0.7);
    }
    50% {
        background-position: 200% 0;
        color: rgba(0, 0, 0, 0.85);
    }
    100% {
        background-position: -200% 0;
        color: rgba(0, 0, 0, 0.7);
    }
}

/* Chat styles moved to css/chat.css */



/* Back button icon styles */
.back-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1) opacity(0.8);
}
