/**
 * ITX Economic Calendar - AI Chat Styles
 * Bybit-Style Minimalist Design
 * 
 * @package ITX_Economic_Calendar
 * @since 2.7.0
 */

/* ═══════════════════════════════════════════════════════════════════
   AI CHAT CONTAINER - Bybit Light Theme
   ═══════════════════════════════════════════════════════════════════ */

.dashboard-ai-chat {
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.dashboard-ai-chat .dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f7fafc;
    border-bottom: 1px solid #e0e6ed;
}

.dashboard-ai-chat .dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-ai-chat .dashboard-section-title i {
    font-size: 18px;
    color: #718096;
}

.dashboard-ai-chat .dashboard-section-title h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-chat-remaining {
    font-size: 12px;
    color: #718096;
    font-weight: 600;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════════
   CHAT CONTAINER
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-container {
    padding: 24px;
}

.ai-chat-messages {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ═══════════════════════════════════════════════════════════════════
   CHAT MESSAGES
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInUp 0.3s ease;
}

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

.ai-chat-message.user-message {
    flex-direction: row-reverse;
}

.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #f7fafc;
    border: 1px solid #e0e6ed;
}

.ai-chat-message.user-message .message-icon {
    background: #6366f1;
    border-color: #6366f1;
}

.message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #2d3748;
    background: #f7fafc;
    border: 1px solid #e0e6ed;
    max-width: 80%;
}

.ai-chat-message.user-message .message-content {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.ai-chat-message.ai-message .message-content {
    background: #ffffff;
    border-color: #e0e6ed;
}

/* Typing indicator */
.ai-chat-message.typing .message-content {
    padding: 16px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   CHAT INPUT FORM
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-form {
    border-top: 1px solid #e0e6ed;
    padding-top: 20px;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #2d3748;
    background: #ffffff;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.2s;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-chat-input::placeholder {
    color: #a0aec0;
}

.ai-chat-submit {
    padding: 12px 24px;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.ai-chat-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.ai-chat-submit:hover:not(:disabled) {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.ai-chat-submit:hover:not(:disabled)::before {
    left: 100%;
}

.ai-chat-submit:active:not(:disabled) {
    transform: translateY(0);
}

.ai-chat-submit:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.ai-chat-submit.loading {
    pointer-events: none;
}

.ai-chat-submit.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

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

/* ═══════════════════════════════════════════════════════════════════
   CHAT ACTIONS
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-actions {
    display: flex;
    justify-content: flex-end;
}

.ai-chat-clear-btn {
    padding: 8px 16px;
    background: transparent;
    color: #718096;
    border: 1px solid #e0e6ed;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-clear-btn:hover {
    background: #f7fafc;
    color: #2d3748;
    border-color: #cbd5e0;
}

.ai-chat-clear-btn:active {
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN REQUIRED STATE
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-login-required {
    padding: 40px 24px;
    text-align: center;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.ai-chat-login-required p {
    margin: 0 0 20px;
    font-size: 15px;
    color: #2d3748;
    font-weight: 500;
}

.ai-chat-login-btn {
    display: inline-block;
    padding: 12px 32px;
    background: #6366f1;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.ai-chat-login-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════
   ERROR MESSAGES
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-error {
    padding: 12px 16px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-size: 13px;
    margin-bottom: 16px;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.ai-chat-error strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .dashboard-ai-chat .dashboard-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ai-chat-container {
        padding: 16px;
    }
    
    .ai-chat-messages {
        max-height: 300px;
    }
    
    .ai-chat-input-wrapper {
        flex-direction: column;
    }
    
    .ai-chat-submit {
        width: 100%;
        justify-content: center;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .ai-chat-clear-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ai-chat-messages {
        max-height: 250px;
    }
    
    .message-content {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .message-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════ */

@media print {
    .dashboard-ai-chat {
        display: none;
    }
}

