:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --accent-color: #f43f5e;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --user-msg-bg: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-gradient);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.chat-container {
    width: min(1100px, 95%);
    height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

/* هدر */
.chat-header {
    height: 80px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-avatar {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    background: var(--user-msg-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.3);
}

.header-info h1 {
    font-size: 18px;
    color: #1e293b;
    font-weight: 800;
}

.header-info p {
    font-size: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.header-info p::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.clear-btn {
    text-decoration: none;
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 12px;
    background: #fff1f2;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

/* چت */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.messages {
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.user { justify-content: flex-start; }
.message-row.assistant { justify-content: flex-end; }

.message {
    max-width: 75%;
    width: fit-content;
    padding: 14px 20px;
    border-radius: 20px;
    line-height: 1.8;
    font-size: 15px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}

.message.user {
    background: var(--user-msg-bg);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: #ffffff;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.message-label {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* بخش ورودی */
.composer-wrap {
    padding: 25px 30px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.composer {
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 18px;
    padding: 8px 15px;
    transition: all 0.3s ease;
}

.composer:focus-within {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
}

.composer textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    max-height: 150px;
    color: #1e293b;
}

.send-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05) rotate(-5deg);
}

.send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* بخش فوتر جدید */
.chat-footer {
    padding: 12px 30px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #64748b;
}

.chat-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.chat-footer a:hover {
    color: var(--primary-dark);
}

/* تایپینگ */
.typing::after {
    content: '...';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* اسکرول‌بار زیبا */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}
.message.assistant {
    position: relative;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    margin-top: 10px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.copy-btn[hidden] {
    display: none;
}

.copy-btn:hover {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.15);
    background-color: rgba(37, 99, 235, 0.08);
}

.copy-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.copy-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.copy-btn.copied {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.16);
    background-color: rgba(22, 163, 74, 0.08);
}

.copy-btn.copy-error {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.16);
    background-color: rgba(220, 38, 38, 0.08);
}

.copy-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-btn-icon svg {
    display: block;
}

/* رسپانسیو فوتر */
@media (max-width: 600px) {
    .chat-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 15px;
    }
}
