/* StockTrotter - Chat Widget Styles */

#chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}
#chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
#chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}
#chat-panel {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 480px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    flex-direction: column;
    overflow: hidden;
}
#chat-panel.open {
    display: flex;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
#chat-header {
    padding: 16px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
#chat-close-btn {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#chat-close-btn:hover {
    background: rgba(255,255,255,0.3);
}
.chat-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}
.chat-header-title {
    font-weight: 600;
    font-size: 15px;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.message.user {
    align-self: flex-end;
}
.message.assistant {
    align-self: flex-start;
}
.message-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.message.user .message-content {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-bottom-right-radius: 4px;
}
.message.assistant .message-content {
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
}
.message.assistant .message-content a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}
.message.assistant .message-content a:hover {
    text-decoration: underline;
}
.message.assistant .message-content ul,
.message.assistant .message-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
    list-style-position: outside;
}
.message.assistant .message-content li {
    margin: 0.25em 0;
}
.message.assistant .message-content p {
    margin: 0.5em 0;
}
.message.assistant .message-content p:first-child {
    margin-top: 0;
}
.message.assistant .message-content p:last-child {
    margin-bottom: 0;
}
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    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); }
    30% { transform: translateY(-4px); }
}
#chat-input-container {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}
#chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
#chat-input:focus {
    border-color: #2563eb;
}
#chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s;
}
#chat-send:hover {
    transform: scale(1.05);
}
#chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    #chat-widget {
        bottom: 16px;
        right: 16px;
    }
    #chat-toggle {
        width: 56px;
        height: 56px;
    }
    #chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
    #chat-close-btn {
        display: flex;
    }
    #chat-input-container {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
