:root {
/* Colors */
--primary-color: #3a5a9f;
--secondary-bg: #f5f7fa;
--white: #ffffff;
--dark-text: #333333;
--border-color: #ddd;
--light-gray: #e8e8e8;
--code-bg: #f4f4f4;
--code-text: #d73a49;
--link-color: #0366d6;
}

/* Виджет консультанта - изолированные стили */
#consultant-widget {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
position: fixed;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
z-index: 999999;
}

/* 3D Neutron Button */
#consultant-widget-button {
width: 100px;
height: 100px;
border: none;
cursor: pointer;
position: relative;
background: transparent;
transition: transform 0.3s ease;
}

#consultant-widget-button:hover {
transform: scale(1.2);
}

/* 3D Scene */
.neutron-scene {
width: 100%;
height: 100%;
position: relative;
perspective: 500px;
}

.neutron-container {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
animation: rotateNeutron 4s linear infinite;
}

#consultant-widget-button:hover .neutron-container {
animation: rotateNeutronFast 2s linear infinite;
}

@keyframes rotateNeutron {
0% {
transform: rotateX(0deg) rotateY(0deg);
}
100% {
transform: rotateX(360deg) rotateY(360deg);
}
}

@keyframes rotateNeutronFast {
0% {
transform: rotateX(0deg) rotateY(0deg);
}
100% {
transform: rotateX(360deg) rotateY(360deg);
}
}

/* Core */
.neutron-core {
position: absolute;
top: 50%;
left: 50%;
width: 40px;
height: 40px;
background: radial-gradient(circle, var(--white) 0%, #4a7ac9 50%, var(--primary-color) 100%);
border-radius: 50%;
transform: translate(-50%, -50%);
box-shadow: 
0 0 20px rgba(58, 90, 159, 0.6),
0 0 40px rgba(58, 90, 159, 0.4),
inset 0 0 15px rgba(255, 255, 255, 0.8);
z-index: 10;
animation: corePulse 3s ease-in-out infinite;
}

@keyframes corePulse {
0%, 100% {
box-shadow: 
0 0 20px rgba(58, 90, 159, 0.6),
0 0 40px rgba(58, 90, 159, 0.4),
inset 0 0 15px rgba(255, 255, 255, 0.8);
}
50% {
box-shadow: 
0 0 30px rgba(58, 90, 159, 0.8),
0 0 60px rgba(58, 90, 159, 0.5),
0 0 80px rgba(45, 70, 128, 0.3),
inset 0 0 20px rgba(255, 255, 255, 0.9);
}
}

#consultant-widget-button:hover .neutron-core {
box-shadow: 
0 0 30px rgba(58, 90, 159, 0.9),
0 0 60px rgba(58, 90, 159, 0.6),
0 0 90px rgba(45, 70, 128, 0.4),
inset 0 0 20px rgba(255, 255, 255, 1);
animation: none;
}

/* Orbits */
.neutron-orbit {
position: absolute;
top: 50%;
left: 50%;
transform-style: preserve-3d;
}

.orbit-ring {
width: 90px;
height: 90px;
border: 2px solid rgba(58, 90, 159, 0.4);
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 0 8px rgba(58, 90, 159, 0.3);
}

.neutron-orbit:nth-child(2) {
transform: translate(-50%, -50%) rotateY(60deg);
}

.neutron-orbit:nth-child(2) .orbit-ring {
border-color: rgba(45, 70, 128, 0.4);
box-shadow: 0 0 8px rgba(45, 70, 128, 0.3);
}

.neutron-orbit:nth-child(3) {
transform: translate(-50%, -50%) rotateY(120deg);
}

.neutron-orbit:nth-child(3) .orbit-ring {
border-color: rgba(3, 102, 214, 0.4);
box-shadow: 0 0 8px rgba(3, 102, 214, 0.3);
}

/* Particles on orbits */
.orbit-particle {
position: absolute;
width: 10px;
height: 10px;
background: radial-gradient(circle, var(--white), var(--primary-color));
border-radius: 50%;
top: 50%;
left: 50%;
box-shadow: 0 0 12px rgba(58, 90, 159, 0.6);
}

.neutron-orbit:nth-child(1) .orbit-particle:nth-child(2) {
transform: translate(-50%, -50%) translateY(-45px);
}

.neutron-orbit:nth-child(1) .orbit-particle:nth-child(3) {
transform: translate(-50%, -50%) translateX(45px);
}

.neutron-orbit:nth-child(1) .orbit-particle:nth-child(4) {
transform: translate(-50%, -50%) translateY(45px);
}

.neutron-orbit:nth-child(1) .orbit-particle:nth-child(5) {
transform: translate(-50%, -50%) translateX(-45px);
}

.neutron-orbit:nth-child(2) .orbit-particle:nth-child(2) {
transform: translate(-50%, -50%) translateY(-45px);
background: radial-gradient(circle, var(--white), #2d4680);
box-shadow: 0 0 12px rgba(45, 70, 128, 0.6);
}

.neutron-orbit:nth-child(2) .orbit-particle:nth-child(3) {
transform: translate(-50%, -50%) translateX(45px);
background: radial-gradient(circle, var(--white), #2d4680);
box-shadow: 0 0 12px rgba(45, 70, 128, 0.6);
}

.neutron-orbit:nth-child(2) .orbit-particle:nth-child(4) {
transform: translate(-50%, -50%) translateY(45px);
background: radial-gradient(circle, var(--white), #2d4680);
box-shadow: 0 0 12px rgba(45, 70, 128, 0.6);
}

.neutron-orbit:nth-child(2) .orbit-particle:nth-child(5) {
transform: translate(-50%, -50%) translateX(-45px);
background: radial-gradient(circle, var(--white), #2d4680);
box-shadow: 0 0 12px rgba(45, 70, 128, 0.6);
}

.neutron-orbit:nth-child(3) .orbit-particle:nth-child(2) {
transform: translate(-50%, -50%) translateY(-45px);
background: radial-gradient(circle, var(--white), var(--link-color));
box-shadow: 0 0 12px rgba(3, 102, 214, 0.6);
}

.neutron-orbit:nth-child(3) .orbit-particle:nth-child(3) {
transform: translate(-50%, -50%) translateX(45px);
background: radial-gradient(circle, var(--white), var(--link-color));
box-shadow: 0 0 12px rgba(3, 102, 214, 0.6);
}

.neutron-orbit:nth-child(3) .orbit-particle:nth-child(4) {
transform: translate(-50%, -50%) translateY(45px);
background: radial-gradient(circle, var(--white), var(--link-color));
box-shadow: 0 0 12px rgba(3, 102, 214, 0.6);
}

.neutron-orbit:nth-child(3) .orbit-particle:nth-child(5) {
transform: translate(-50%, -50%) translateX(-45px);
background: radial-gradient(circle, var(--white), var(--link-color));
box-shadow: 0 0 12px rgba(3, 102, 214, 0.6);
}

/* Индикатор уведомлений */
#consultant-widget-button.has-notification::after {
content: '';
position: absolute;
top: 5px;
right: 5px;
width: 12px;
height: 12px;
background: #ff4444;
border-radius: 50%;
border: 2px solid var(--white);
display: block;
z-index: 100;
box-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
animation: notificationPulse 1.5s ease-in-out infinite;
}

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

/* Модальное окно чата */
#consultant-widget-modal {
position: fixed;
bottom: 140px;
left: 50%;
transform: translateX(-50%);
width: 800px;
height: 600px;
max-height: calc(100vh - 160px);
background: var(--white);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
display: none;
flex-direction: column;
overflow: hidden;
z-index: 999998;
animation: slideUp 0.3s ease;
}

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

#consultant-widget-modal.active {
display: flex;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
#consultant-widget-modal {
width: calc(100vw - 40px);
height: calc(100vh - 160px);
bottom: 140px;
left: 50%;
transform: translateX(-50%);
}
#consultant-widget {
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
#consultant-widget-button {
width: 70px;
height: 70px;
}
.neutron-core {
width: 28px;
height: 28px;
}
.orbit-ring {
width: 65px;
height: 65px;
}
.orbit-particle {
width: 6px;
height: 6px;
}
.neutron-orbit:nth-child(1) .orbit-particle:nth-child(2),
.neutron-orbit:nth-child(1) .orbit-particle:nth-child(4),
.neutron-orbit:nth-child(2) .orbit-particle:nth-child(2),
.neutron-orbit:nth-child(2) .orbit-particle:nth-child(4),
.neutron-orbit:nth-child(3) .orbit-particle:nth-child(2),
.neutron-orbit:nth-child(3) .orbit-particle:nth-child(4) {
transform: translate(-50%, -50%) translateY(-32px);
}
.neutron-orbit:nth-child(1) .orbit-particle:nth-child(3),
.neutron-orbit:nth-child(1) .orbit-particle:nth-child(5),
.neutron-orbit:nth-child(2) .orbit-particle:nth-child(3),
.neutron-orbit:nth-child(2) .orbit-particle:nth-child(5),
.neutron-orbit:nth-child(3) .orbit-particle:nth-child(3),
.neutron-orbit:nth-child(3) .orbit-particle:nth-child(5) {
transform: translate(-50%, -50%) translateX(32px);
}
}

.page-container {
display: flex;
flex-direction: column;
height: 100%;
}

/* Header */
.header {
background-color: var(--primary-color);
color: var(--white);
padding: 16px;
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
z-index: 10;
position: relative;
}

.header-logo {
background: var(--white);
color: var(--primary-color);
padding: 6px 12px;
border-radius: 6px;
font-weight: bold;
font-size: 14px;
flex-shrink: 0;
}

.header-text {
flex: 1;
}

.header-text h1 {
color: #fff;
font-size: 18px;
font-weight: bold;
margin: 0;
line-height: 1.2;
text-shadow: 0 1px 3px rgba(20, 30, 60, 0.09);
}

.header-text p {
color: #fff;
font-size: 12px;
font-weight: normal;
opacity: 0.95;
margin: 4px 0 0 0;
text-shadow: 0 1px 2px rgba(20, 30, 60, 0.07);
}

/* Кнопка закрытия */
.btn-close-widget {
position: absolute;
top: 12px;
right: 12px;
width: 32px;
height: 32px;
border: none;
background: rgba(255, 255, 255, 0.2);
color: var(--white);
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
line-height: 1;
transition: all 0.2s;
}

.btn-close-widget:hover {
background: rgba(255, 255, 255, 0.3);
transform: rotate(90deg);
}

@media (max-width: 768px) {
.header-text h1 { font-size: 16px; }
.header-text p { font-size: 11px; }
.header { padding: 12px; }
.header-logo { padding: 5px 10px; font-size: 12px; }
}

/* Main Content */
.main-content {
flex: 1;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
padding: 0;
background-color: var(--white);
position: relative;
}

.chat-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background: var(--white);
overflow: hidden;
position: relative;
}

/* Background with camera icon */
.chat-background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.08;
z-index: 0;
pointer-events: none;
}

.camera-icon {
font-size: 120px;
color: var(--primary-color);
animation: floatCamera 6s ease-in-out infinite;
}

@keyframes floatCamera {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-20px); }
}

.chat-messages {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 10px;
position: relative;
z-index: 1;
}

.message {
display: flex;
width: 100%;
}

.message-user {
justify-content: flex-end;
}

.message-bot {
justify-content: flex-start;
}

.message-bubble {
max-width: 70%;
padding: 10px 15px;
border-radius: 18px;
font-size: 14px;
line-height: 1.5;
word-wrap: break-word;
animation: messageSlideIn 0.3s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.message-user .message-bubble {
background-color: var(--primary-color);
color: var(--white);
border-bottom-right-radius: 4px;
}

.message-bot .message-bubble {
background-color: var(--light-gray);
color: var(--dark-text);
border-bottom-left-radius: 4px;
}

/* Форматированный текст в сообщениях бота */
.message-bot .message-bubble p {
margin: 8px 0;
padding: 0;
}

.message-bot .message-bubble p:first-child {
margin-top: 0;
}

.message-bot .message-bubble p:last-child {
margin-bottom: 0;
}

/* Заголовки */
.message-bot .message-bubble h3 {
font-size: 16px;
font-weight: 600;
margin: 12px 0 6px 0;
color: var(--primary-color);
}

.message-bot .message-bubble h3:first-child {
margin-top: 0;
}

/* Списки */
.message-bot .message-bubble ul,
.message-bot .message-bubble ol {
margin: 8px 0 8px 20px;
padding: 0;
}

.message-bot .message-bubble li {
margin: 4px 0;
}

.message-bot .message-bubble ul > li:before {
content: "• ";
color: var(--primary-color);
font-weight: bold;
}

/* Жирный текст */
.message-bot .message-bubble strong {
font-weight: 600;
color: var(--primary-color);
}

/* Наклонный текст */
.message-bot .message-bubble em {
font-style: italic;
color: #666;
}

/* Ссылки */
.message-bot .message-bubble a {
color: var(--link-color);
text-decoration: none;
border-bottom: 1px solid var(--link-color);
}

.message-bot .message-bubble a:hover {
text-decoration: underline;
}

/* Код */
.message-bot .message-bubble code {
background-color: var(--code-bg);
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 12px;
color: var(--code-text);
}

.message-bot .message-bubble pre {
background-color: var(--code-bg);
border-left: 3px solid var(--primary-color);
padding: 8px 12px;
border-radius: 4px;
overflow-x: auto;
margin: 8px 0;
font-family: 'Courier New', monospace;
font-size: 12px;
}

.message-bot .message-bubble pre code {
background: none;
padding: 0;
color: var(--dark-text);
}

/* Цитаты */
.message-bot .message-bubble blockquote {
border-left: 3px solid #999;
margin: 8px 0;
padding-left: 12px;
color: #666;
font-style: italic;
}

/* Горизонтальная линия */
.message-bot .message-bubble hr {
border: none;
border-top: 1px solid #ddd;
margin: 12px 0;
}

/* Таблицы */
.message-bot .message-bubble table {
border-collapse: collapse;
width: 100%;
margin: 8px 0;
font-size: 13px;
}

.message-bot .message-bubble table th,
.message-bot .message-bubble table td {
border: 1px solid #ddd;
padding: 6px 8px;
text-align: left;
}

.message-bot .message-bubble table th {
background-color: #f4f4f4;
font-weight: 600;
color: var(--primary-color);
}

.message-bot .message-bubble table tr:nth-child(even) {
background-color: #f9f9f9;
}

/* Typing indicator */
.typing-indicator {
background-color: var(--light-gray);
display: flex;
align-items: center;
gap: 6px;
padding: 10px 15px;
}

.typing-indicator span {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #999;
animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}

@keyframes typingBounce {
0%, 60%, 100% { transform: translateY(0); }
30% { transform: translateY(-10px); }
}

.chat-input-container {
display: flex;
padding: 12px;
border-top: 1px solid var(--border-color);
gap: 8px;
align-items: center;
background: var(--white);
position: relative;
z-index: 1;
}

.chat-input {
flex: 1;
padding: 10px 15px;
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 14px;
outline: none;
font-family: inherit;
transition: border-color 0.2s;
}

.chat-input:focus {
border-color: var(--primary-color);
}

.btn-send-chat {
width: 40px;
height: 40px;
border: none;
background: var(--primary-color);
color: var(--white);
border-radius: 50%;
font-size: 18px;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}

.btn-send-chat:hover {
background: #2d4680;
transform: scale(1.05);
}

.btn-send-chat:active {
transform: scale(0.95);
}

/* Footer */
.footer {
background: var(--white);
border-top: 1px solid var(--border-color);
padding: 12px;
display: flex;
flex-direction: column;
gap: 8px;
align-items: center;
flex-shrink: 0;
z-index: 10;
}

.nav-buttons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
width: 100%;
}

.btn-nav {
padding: 10px 12px;
border: 1px solid var(--border-color);
background: var(--white);
border-radius: 20px;
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
color: var(--dark-text);
font-weight: 500;
text-align: center;
}

.btn-nav:hover {
background: var(--secondary-bg);
border-color: var(--primary-color);
}

.btn-nav:active {
transform: scale(0.98);
}

@media (max-width: 768px) {
.main-content { padding: 0; }
.chat-container { max-width: 100%; }
.nav-buttons { max-width: 100%; }
.message-bubble { max-width: 85%; }
.camera-icon { font-size: 80px; }
}

