:root {
    /* پالت رنگ آبی-بنفش برای مشاوره نوجوانان */
    --primary-blue: #5D5FEF;
    --light-blue: #8B9FFF;
    --soft-purple: #A78BFA;
    --light-purple: #C4B5FD;
    --accent-pink: #F472B6;
    
    /* رنگ‌های تم تاریک */
    --dark-bg: #0F172A;
    --dark-card: #1E293B;
    --dark-text: #E2E8F0;
    --dark-border: #334155;
    --user-bubble: #2D3748;
    --ai-bubble: #1E3A8A;
    
    /* اندازه فونت پایه */
    --base-font-size: 0.9rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', sans-serif;
    font-size: var(--base-font-size);
}

body {
    background-color: var(--dark-bg);
    color: var(--dark-text);
    line-height: 1.7;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    background-image: radial-gradient(circle at top right, rgba(93, 95, 239, 0.15) 0%, transparent 60%),
                      radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.15) 0%, transparent 60%);
    font-size: var(--base-font-size);
    direction: rtl;
}

/* چت کانتینر */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(30, 41, 59, 0.8);
    border: none;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 0;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(93, 95, 239, 0.3);
    background: rgba(30, 58, 138, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    justify-content: space-between;
}

.header-content img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-pink);
    box-shadow: 0 0 15px rgba(244, 114, 182, 0.3);
}

.header-content h1 {
    font-size: 1.4rem;
    background: linear-gradient(45deg, var(--light-blue), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(139, 159, 255, 0.3);
}

.clear-history {
    background: rgba(244, 114, 182, 0.12);
    border: 1px solid rgba(244, 114, 182, 0.3);
    color: var(--accent-pink);
    border-radius: 18px;
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.clear-history:hover {
    background: rgba(244, 114, 182, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(244, 114, 182, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.message-user {
    align-items: flex-end;
    align-self: flex-end;
}

.message-ai {
    align-items: flex-start;
    align-self: flex-start;
}

.message-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.6;
    word-break: break-word;
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.message-bubble:hover {
    transform: translateY(-3px);
}

.user-bubble {
    background: var(--user-bubble);
    border-bottom-left-radius: 1px;
    border: 1px solid rgba(93, 95, 239, 0.2);
    white-space: pre-line;
}

.ai-bubble {
    background: var(--ai-bubble);
    border-bottom-right-radius: 1px;
    border: 1px solid rgba(139, 159, 255, 0.3);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--accent-pink);
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(244, 114, 182, 0.3);
    font-size: 0.95rem;
}

.message-header i {
    font-size: 1.1rem;
}

.message-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--accent-pink);
    box-shadow: 0 0 8px rgba(244, 114, 182, 0.3);
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid rgba(93, 95, 239, 0.2);
    background: rgba(30, 58, 138, 0.25);
}

.hint-text {
    text-align: center;
    color: var(--light-blue);
    font-size: 0.85rem;
    margin-top: 10px;
    opacity: 0.8;
}

.hint-text i {
    margin-left: 5px;
    color: var(--accent-pink);
}

.chat-form {
    display: flex;
    gap: 12px;
    position: relative;
}

.chat-input {
    flex: 1;
    padding: 16px 20px;
    border-radius: 30px;
    border: 1px solid var(--light-blue);
    background: rgba(15, 23, 42, 0.85);
    color: var(--dark-text);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
    resize: none;
    min-height: 50px;
    max-height: 60px;
    overflow-y: auto;
    direction: rtl;
}

.chat-input:focus {
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.3),
                inset 0 0 12px rgba(0, 0, 0, 0.4);
}

.chat-submit {
    background: linear-gradient(45deg, var(--primary-blue), var(--accent-pink));
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    width: 60px;
    box-shadow: 0 4px 15px rgba(93, 95, 239, 0.4);
}

.chat-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(93, 95, 239, 0.6);
}

.chat-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* استایل‌های متن */
.ai-bubble h1 {
    font-size: 1.7rem;
    color: var(--accent-pink);
    border-bottom: 1px solid rgba(244, 114, 182, 0.3);
    padding-bottom: 10px;
    margin: 20px 0 15px;
}

.ai-bubble h2 {
    font-size: 1.5rem;
    color: var(--light-blue);
    margin: 18px 0 12px;
    padding-right: 15px;
    border-right: 3px solid var(--soft-purple);
}

.ai-bubble h3 {
    font-size: 1.3rem;
    color: var(--light-blue);
    border-bottom: 1px solid rgba(139, 159, 255, 0.3);
    padding-bottom: 8px;
    margin: 16px 0 12px;
}

.ai-bubble h4 {
    font-size: 1.2rem;
    color: var(--soft-purple);
    margin: 14px 0 10px;
    padding-right: 10px;
    border-right: 3px solid var(--light-blue);
}

.ai-bubble p {
    margin: 10px 0;
    line-height: 1.8;
}

.ai-bubble strong {
    color: var(--light-purple);
}

.ai-bubble em {
    color: #ddd;
    font-style: italic;
}

/* لیست‌ها */
.ai-bubble ul, .ai-bubble ol {
    padding-right: 30px;
    margin: 15px 0;
}

.ai-bubble li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.ai-bubble ul li::before {
    color: var(--accent-pink);
    font-weight: bold;
    margin-left: 8px;
}

/* نقل‌قول */
.ai-bubble blockquote {
    border-right: 3px solid var(--soft-purple);
    padding: 12px 20px;
    margin: 15px 0;
    color: var(--light-purple);
    font-style: italic;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;
}

/* کد اینلاین */
.inline-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 159, 255, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--light-purple);
    direction: ltr;
    display: inline-block;
}

/* نشانگر تایپ */
.typing-indicator {
    display: inline-flex;
    gap: 7px;
    padding: 12px 18px;
    background: var(--ai-bubble);
    border-radius: 18px;
    align-items: center;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-pink);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* دکمه کپی */
.message-copy-button {
    margin-top: 8px;
    padding: 8px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--accent-pink);
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.message-copy-button:hover {
    opacity: 1;
    background: rgba(244, 114, 182, 0.1);
}

/* اسکرول بار */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 5px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--soft-purple);
}

/* رسپانسیو */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .header-content h1 {
        font-size: 1.2rem;
    }
    
    .header-content img {
        width: 36px;
        height: 36px;
    }
    
    .clear-history {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message-bubble {
        padding: 14px 16px;
    }
    
    .chat-input-container {
        padding: 15px;
    }
    
    .hint-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.1rem;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-input {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .ai-bubble h1 { font-size: 1.4rem; }
    .ai-bubble h2 { font-size: 1.3rem; }
    .ai-bubble h3 { font-size: 1.2rem; }
    .ai-bubble h4 { font-size: 1.1rem; }
}