/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
.content {
    max-width: 1366px;
    margin: 0 auto;
    padding: 160px 20px 40px; /* ← было 100px, стало 160px (шапка + крошки) */
}

.content h1 {
    color: darkslategray;
    font-size: 26px;
    margin-bottom: 5px;
}


/* ============================================================
   БЛИК (бегущая строка в шапке)
   — 5 фраз + 5 звёздочек, распределены по всей ширине
   — анимация блика едет поверх текста
   ============================================================ */
   .shine-text {
    font-size: 12px;
    font-weight: 800;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
    
    /* Растягиваем на всю ширину и распределяем элементы */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    
    text-shadow: 0 0 30px rgba(100, 200, 255, 0.1);
}

/* Элементы внутри (фразы и звёздочки) */
.shine-text .shine-item {
    white-space: nowrap; /* запрещаем перенос внутри фразы */
}

/* Псевдоэлемент для блика — оставляем как был */
.shine-text::after {
    content: '';
    position: absolute;
    top: -20%;
    left: -100%;
    width: 25%;
    height: 140%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.8) 40%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-85deg);
    animation: shine-smooth 7s ease-in-out infinite;
    filter: blur(1px);
    pointer-events: none; /* чтобы блик не перехватывал клики */
}

@keyframes shine-smooth {
    10% { opacity: 1; }
    45% { left: 100%; opacity: 1; }
    50% { left: 100%; opacity: 0; }
    55% { left: 100%; opacity: 1; }
}


/* ============================================================
   СТАТЬЯ (обтекание + риторический текст)
   ============================================================ */
.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

.article .image-wrapper {
    float: left;
    margin: 7px 20px 10px 0;
}

.article .image-wrapper img {
    opacity: 0.65;
    transition: opacity 0.3s ease;
}

.article .image-wrapper a:hover img {
    opacity: 1;
}

.article .main-text {
    text-align: justify;
}

.autocad-text {
    margin-top: 10px;
    overflow: hidden;
    display: block;
    font-family: 'IBM Plex Mono', 'Consolas', 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.1px;
    color: #1a202c;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    line-height: 1.15;
    max-width: 100%;
    box-sizing: border-box;
    text-align: justify;
    text-align-last: left;
    word-break: break-word;
    hyphens: auto;
}

.autocad-text .line {
    display: block;
    padding: 3px 0;
}

/* ===== СТИЛИ ДЛЯ ЧАТА ===== */
#chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: inherit;
}

/* Кнопка открытия */
#chat-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2b6cb0 0%, #1a4f7a 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(43,108,176,0.4);
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: chatPulse 2s infinite;
}

#chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(43,108,176,0.6);
    animation: none;
}

#chat-toggle-btn.chat-active {
    display: none;
}

@keyframes chatPulse {
    0% { box-shadow: 0 0 0 0 rgba(43, 108, 176, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(43, 108, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 108, 176, 0); }
}

/* Окно чата */
#chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 360px;
    height: 420px; /* ← УМЕНЬШИЛИ высоту (было 500px) */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#chat-window.chat-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Шапка */
.chat-header {
    background: #f0f7ff;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    font-weight: 700;
    color: #1a202c;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    background: #38a169;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(56,161,105,0.3);
}

#chat-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #718096;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#chat-close-btn:hover {
    color: #e74c3c;
}

/* Тело чата */
.chat-body {
    flex-grow: 0; /* ← УБРАЛИ растягивание */
    flex-shrink: 1;
    flex-basis: auto;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px; /* Минимальная высота для сообщений */
    max-height: 180px; /* Максимальная высота, чтобы не растягивать окно */
}

.chat-message {
    display: flex;
    width: 100%;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    justify-content: flex-end;
}

.bot-message .chat-bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 13px;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.user-message .chat-bubble {
    background: #2b6cb0;
    color: #fff;
    border-bottom-right-radius: 2px;
    font-size: 14px;
    max-width: 85%;
}

/* Форма */
.chat-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chat-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.chat-input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.chat-input-group input:focus, .chat-textarea-wrapper textarea:focus {
    outline: none;
    border-color: #2b6cb0;
}

/* Обертка для textarea и кнопки */
.chat-textarea-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

/* Само поле ввода (textarea) */
.chat-textarea-wrapper textarea {
    width: 100%;
    padding: 10px 48px 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
    height: 80px; /* Оптимальная высота, не растягивает окно */
    line-height: 1.4;
}

/* Кнопка отправки в правом нижнем углу */
#chat-submit-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: #2b6cb0;
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#chat-submit-btn:hover {
    background: #1a4f7a;
}

/* Всплывающая подсказка */
#chat-submit-btn::after {
    content: "Отправить (Shift+Enter)";
    position: absolute;
    bottom: 40px;
    right: 0;
    background: #1a202c;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#chat-submit-btn:hover::after {
    opacity: 1;
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 10px;
        right: 10px;
    }
    #chat-widget {
        bottom: 20px;
        right: 20px;
    }
}