/* ============================================
   OPT PROTEN ASSISTANT STYLES
   Версия 1.0
   ============================================ */

/* Основные переменные */
:root {
    --primary-color: #1a73e8;
    --primary-dark: #0d47a1;
    --secondary-color: #34a853;
    --accent-color: #fbbc05;
    --danger-color: #ea4335;
    --light-color: #f8f9fa;
    --dark-color: #202124;
    --gray-color: #5f6368;
    --border-color: #dadce0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

/* Виджет ассистента (для встраивания в сайт) */
#optproten-assistant {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px var(--shadow-color);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

/* Состояния виджета */
#optproten-assistant.minimized {
    height: 60px;
    width: 60px;
    border-radius: 50%;
    overflow: hidden;
}

#optproten-assistant.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Шапка виджета */
.assistant-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.assistant-header:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.assistant-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-color);
}

.assistant-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.assistant-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary-color);
}

.status-dot.online {
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--gray-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.assistant-controls {
    display: flex;
    gap: 8px;
}

.assistant-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.assistant-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Область чата */
.assistant-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--light-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Сообщения */
.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.2);
}

.user-message::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 0;
    border: 6px solid transparent;
    border-left-color: var(--primary-color);
    border-top-color: var(--primary-color);
}

.assistant-message {
    align-self: flex-start;
    background: white;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px var(--shadow-color);
}

.assistant-message::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    border: 6px solid transparent;
    border-right-color: white;
    border-top-color: white;
}

/* Сообщения с кодом/артикулами */
.message-code {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Приветственное сообщение */
.welcome-message {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.welcome-message p {
    margin: 0 0 10px 0;
}

.welcome-message ul {
    margin: 10px 0;
    padding-left: 20px;
}

.welcome-message li {
    margin-bottom: 8px;
    color: var(--gray-color);
}

/* Быстрые вопросы */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 20px;
}

.quick-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Поле ввода */
.assistant-input-area {
    border-top: 1px solid var(--border-color);
    background: white;
    padding: 16px 20px;
}

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

#assistantInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#assistantInput:focus {
    border-color: var(--primary-color);
}

#assistantInput::placeholder {
    color: var(--gray-color);
}

#sendButton {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

#sendButton:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#sendButton:disabled {
    background: var(--gray-color);
    cursor: not-allowed;
    transform: none;
}

/* Подсказки */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.suggestion {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--gray-color);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Индикатор печатания */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    align-self: flex-start;
    max-width: 100px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gray-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Футер */
.assistant-footer {
    font-size: 11px;
    color: var(--gray-color);
    text-align: center;
    margin-top: 8px;
}

.assistant-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.assistant-footer a:hover {
    text-decoration: underline;
}

/* Нотификации */
.assistant-notification {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: 0 4px 16px var(--shadow-color);
    max-width: 320px;
    animation: slideIn 0.3s ease;
    z-index: 9999;
    border-left: 4px solid var(--primary-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notification-title {
    font-weight: 600;
    color: var(--dark-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-color);
}

.notification-content {
    color: var(--gray-color);
    font-size: 14px;
}

/* Standalone версия (для отдельной страницы) */
.assistant-standalone {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.assistant-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px var(--shadow-color);
    overflow: hidden;
}

.btn-clear {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Адаптивность */
@media (max-width: 768px) {
    #optproten-assistant {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .assistant-standalone {
        margin: 0;
        padding: 0;
    }
    
    .assistant-container {
        border-radius: 0;
        min-height: 100vh;
    }
}

@media (max-width: 480px) {
    .quick-questions {
        padding: 0 16px;
    }
    
    .quick-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .assistant-input-area {
        padding: 12px 16px;
    }
}

/* Скроллбар */
.assistant-chat::-webkit-scrollbar {
    width: 6px;
}

.assistant-chat::-webkit-scrollbar-track {
    background: transparent;
}

.assistant-chat::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.assistant-chat::-webkit-scrollbar-thumb:hover {
    background: var(--gray-color);
}

/* Анимация загрузки */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
