/* AI Chatbot Styles */

/* Chat Button - Floating bottom-right */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chat-button:active {
    transform: scale(0.95);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-button.open svg {
    transform: rotate(45deg);
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-window.open {
    display: flex;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.chat-header-text {
    flex: 1;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-header-text p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

.chat-close svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

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

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.user .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

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

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

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

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-action-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #667eea;
}

.quick-action-btn:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

/* Chat Input Area */
.chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-input::placeholder {
    color: #999;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Welcome Message */
.welcome-message {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.welcome-message h4 {
    margin: 0 0 8px 0;
    color: #667eea;
    font-size: 1rem;
}

.welcome-message p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-button {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }

    .chat-button svg {
        width: 24px;
        height: 24px;
    }

    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 90px;
        right: 16px;
        left: 16px;
        max-width: 100%;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-messages {
        padding: 16px;
        gap: 12px;
    }

    .message-content {
        max-width: 80%;
        font-size: 0.9rem;
    }

    .chat-input-area {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 0;
        left: 0;
        border-radius: 16px 16px 0 0;
    }

    .message-content {
        max-width: 85%;
    }
}

/* Landscape Mode */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-window {
        height: calc(100vh - 80px);
        bottom: 70px;
    }

    .chat-messages {
        padding: 12px;
    }
}

/* iOS Safari Fixes */
@supports (-webkit-touch-callout: none) {
    .chat-input {
        font-size: 16px; /* Prevent zoom on focus */
    }

    .chat-messages {
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #1a1a1a;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }

    .chat-messages {
        background: #2a2a2a;
    }

    .bot .message-content {
        background: #333;
        color: #e0e0e0;
    }

    .chat-input-area {
        background: #1a1a1a;
        border-top-color: #444;
    }

    .chat-input {
        background: #333;
        color: #e0e0e0;
        border-color: #444;
    }

    .quick-action-btn {
        background: #333;
        border-color: #444;
        color: #667eea;
    }

    .quick-action-btn:hover {
        background: #444;
    }

    .typing-indicator {
        background: #333;
    }
}

/* Stock Card Styles */
.stock-card-container {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    max-width: 85%;
    min-width: 260px;
}

.stock-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stock-card-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
}

.stock-card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.stock-card-sector {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #666;
}

.stock-card-directions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.direction-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.direction-badge.long {
    background: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
    color: #065f46;
}

.direction-badge.short {
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
    color: #7f1d1d;
}

.stock-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.metric-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.metric-value.positive {
    color: #10b981;
}

.metric-value.negative {
    color: #ef4444;
}

.stock-card-button {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stock-card-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.stock-card-button:active {
    transform: translateY(0);
}

/* Mobile adjustments for stock cards */
@media (max-width: 768px) {
    .stock-card-container {
        max-width: 90%;
        min-width: 240px;
    }

    .stock-card-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .metric-item {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .metric-label {
        text-align: left;
    }

    .metric-value {
        text-align: right;
    }
}

@media (max-width: 480px) {
    .stock-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .stock-card-title {
        font-size: 1.1rem;
    }
}

