* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
}

.container {
    max-width: 800px;
    width: 100%;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 900px;
    overflow: hidden;
}

/* هدر */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 24px;
    text-align: center;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 400;
}

/* منطقه چت */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-color);
    scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* پیام‌ها */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message.user .avatar {
    background: var(--secondary-color);
}

.message-content {
    max-width: 70%;
    background: white;
    padding: 16px 18px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    line-height: 1.7;
}

.message.user .message-content {
    background: var(--primary-color);
    color: white;
}

.message-content p {
    margin-bottom: 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 10px 0;
    padding-right: 20px;
}

.message-content li {
    margin: 6px 0;
}

.message-content strong {
    font-weight: 600;
}

/* پیام خوشامدگویی */
.welcome-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.welcome-message .message-content {
    max-width: 100%;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
}

/* نوار ورودی */
.input-container {
    padding: 16px 20px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    transition: var(--transition);
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.send-button {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    font-size: 1.3rem;
}

/* دکمه‌های سریع */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 8px 14px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* نوار وضعیت */
.status-bar {
    padding: 8px 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-bar.thinking .status-dot {
    background: #f59e0b;
}

.status-bar.error .status-dot {
    background: #ef4444;
    animation: none;
}

/* انیمیشن تایپ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    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: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ریسپانسیو */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .header {
        border-radius: 0;
        padding: 16px 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .message-content {
        max-width: 85%;
    }

    .quick-actions {
        gap: 6px;
    }

    .quick-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* فونت فارسی (اختیاری - اگر نیاز به فونت خاص دارید) */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');
