/* Дополнительные стили для чата */

/* Стили для предупреждений */
.rca-char-limit-warning {
    color: #f59e0b !important;
    font-weight: 600;
}

.rca-limit-warning {
    color: #f59e0b !important;
    font-weight: 600;
}

.rca-limit-exceeded {
    color: #ef4444 !important;
    font-weight: 600;
}

/* Анимации для сообщений */
.rca-message {
    animation: slideInUp 0.3s ease-out;
}

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

/* Стили для скроллбара */
.rca-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.rca-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.rca-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.rca-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Улучшенные стили для кнопки отправки */
.rca-send-button {
    position: relative;
    overflow: hidden;
}

.rca-send-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.rca-send-button:hover::before {
    width: 100%;
    height: 100%;
}

/* Стили для отключенного состояния */
.rca-message-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.rca-send-button:disabled {
    background: #d1d5db !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Улучшенные стили для индикатора печати */
.rca-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 60px;
    margin-bottom: 20px;
    border-bottom-left-radius: 4px;
}

.rca-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.rca-typing-dot:nth-child(1) { 
    animation-delay: -0.32s; 
}

.rca-typing-dot:nth-child(2) { 
    animation-delay: -0.16s; 
}

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

/* Стили для статуса */
.rca-status-indicator.ready::before {
    background: #4ade80;
}

.rca-status-indicator.typing::before {
    background: #fbbf24;
    animation: pulse 1.5s infinite;
}

.rca-status-indicator.error::before {
    background: #ef4444;
}

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

/* Улучшенные стили для сообщений */
.rca-message-content {
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rca-message-content p {
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Стили для длинных сообщений */
.rca-message-content p:not(:last-child) {
    margin-bottom: 8px;
}

/* Стили для ссылок в сообщениях */
.rca-message-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.5);
}

.rca-bot-message .rca-message-content a {
    color: #667eea;
    text-decoration-color: rgba(102, 126, 234, 0.5);
}

/* Стили для кода в сообщениях */
.rca-message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.rca-bot-message .rca-message-content code {
    background: rgba(255, 255, 255, 0.2);
}

/* Стили для списков в сообщениях */
.rca-message-content ul,
.rca-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.rca-message-content li {
    margin-bottom: 4px;
}

/* Стили для цитат в сообщениях */
.rca-message-content blockquote {
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    margin: 8px 0;
    padding-left: 12px;
    font-style: italic;
}

.rca-bot-message .rca-message-content blockquote {
    border-left-color: rgba(102, 126, 234, 0.3);
}

/* Стили для таблиц в сообщениях */
.rca-message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.9em;
}

.rca-message-content th,
.rca-message-content td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 8px;
    text-align: left;
}

.rca-bot-message .rca-message-content th,
.rca-bot-message .rca-message-content td {
    border-color: rgba(0, 0, 0, 0.1);
}

/* Стили для изображений в сообщениях */
.rca-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}

/* Улучшенные стили для мобильных устройств */
@media (max-width: 768px) {
    .rca-chat-container {
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .rca-chat-messages {
        flex: 1;
        height: auto;
        padding: 15px;
    }
    
    .rca-message-content {
        max-width: 85%;
    }
    
    .rca-chat-header {
        padding: 15px 20px;
    }
    
    .rca-chat-input-container {
        padding: 15px 20px;
    }
    
    .rca-input-wrapper {
        padding: 6px;
    }
    
    .rca-send-button {
        width: 36px;
        height: 36px;
    }
    
    .rca-message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .rca-message-avatar svg {
        width: 16px;
        height: 16px;
    }
}

/* Subscription Message Styles */
.rca-subscription-message {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.rca-subscription-content {
    position: relative;
}

.rca-subscription-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.rca-subscription-message h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.rca-subscription-message p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.rca-subscription-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.rca-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.rca-feature-icon {
    font-size: 1.2rem;
}

.rca-subscription-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    border: none;
    cursor: pointer;
}

.rca-subscription-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
    color: white;
    text-decoration: none;
}

.rca-btn-icon {
    font-size: 1.2rem;
}

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

/* Responsive Design for Subscription */
@media (max-width: 768px) {
    .rca-subscription-message {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .rca-subscription-message h3 {
        font-size: 1.5rem;
    }
    
    .rca-subscription-features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .rca-feature {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .rca-message-content {
        max-width: 90%;
        font-size: 14px;
    }
    
    .rca-chat-header h3 {
        font-size: 16px;
    }
    
    .rca-status-indicator {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .rca-input-footer {
        font-size: 11px;
    }
}

/* Стили для темной темы (если поддерживается) */
@media (prefers-color-scheme: dark) {
    .rca-chat-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .rca-chat-messages {
        background: #111827;
    }
    
    .rca-message-content {
        background: #374151;
        color: #f9fafb;
    }
    
    .rca-user-message .rca-message-content {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    .rca-input-wrapper {
        background: #374151;
        border-color: #4b5563;
    }
    
    .rca-message-input {
        color: #f9fafb;
    }
    
    .rca-message-input::placeholder {
        color: #9ca3af;
    }
    
    .rca-chat-input-container {
        background: #1f2937;
        border-top-color: #374151;
    }
}

/* Стили для фокуса и доступности */
.rca-message-input:focus {
    outline: none;
}

.rca-send-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Стили для загрузки */
.rca-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Стили для ошибок */
.rca-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
}

/* Стили для успешных операций */
.rca-success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
}

/* Стили для подсказок */
.rca-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

/* Стили для разделителей */
.rca-message-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.rca-message-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.rca-message-divider span {
    background: #f8fafc;
    padding: 0 10px;
    color: #6b7280;
    font-size: 12px;
}

/* Стили для кнопок действий */
.rca-action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.rca-action-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.rca-action-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.rca-bot-message .rca-action-button {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.rca-bot-message .rca-action-button:hover {
    background: rgba(102, 126, 234, 0.2);
} 