* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
    height: 100vh;
    overflow: hidden;
}

.chat-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.header-left span {
    font-size: 20px;
    font-weight: bold;
}

.header-right {
    display: flex;
    align-items: center;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    margin-bottom: 20px;
    scroll-behavior: smooth;
    max-height: calc(100vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: #dc2626 #f1f1f1;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb {
    background: linear-gradient(#dc2626, #ef4444);
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #b91c1c;
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.bubble {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.bubble.user {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bubble.ai {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
    overflow: hidden;
    border: 2px solid rgba(220, 38, 38, 0.2);
}

.ai-avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.typing {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    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% { transform: scale(1); opacity: 0.4; }
    30% { transform: scale(1.3); opacity: 1; }
}

.input-container {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

#user-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

#user-input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

#user-input {
    resize: none;
}

#send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220,38,38,0.4);
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.trash {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 14px;
}

.trash:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220,38,38,0.4);
}

#user-input {
    pointer-events: auto !important;
    user-select: text !important;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .header-left span {
        font-size: 18px;
    }
    
    .messages {
        padding: 16px;
    }
    
    .bubble {
        max-width: 85%;
    }
    
    .input-container {
        padding: 12px 16px;
    }
}

.quick-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.quick-btn:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}
