:root {
    /* پالت رنگ سبز-زرد لیمویی */
    --limo-green: #A5D6A7;
    --limo-light: #C5E1A5;
    --limo-yellow: #FFF59D;
    --limo-dark: #81C784;
    --limo-darker: #4CAF50;
    
    /* رنگ‌های تم تاریک */
    --dark-bg: #121212;
    --dark-card: #1e1e1e;
    --dark-text: #e0e0e0;
    --dark-border: #333;
    --user-bubble: #2c2c2c;
    --ai-bubble: #1a3c1f;
    
    /* اندازه فونت پایه */
    --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(76, 175, 80, 0.1) 0%, transparent 60%),
                      radial-gradient(circle at bottom left, rgba(129, 199, 132, 0.1) 0%, transparent 60%);
    font-size: var(--base-font-size);
    direction: rtl;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* هدر و نویگیشن */
header {
    padding: 12px 0;
    border-bottom: 1px solid var(--dark-border);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 101;
}

.logo:hover {
    transform: scale(1.03);
}

.logo img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--limo-yellow);
    transition: all 0.3s ease;
}

.logo:hover img {
    transform: rotate(10deg);
    box-shadow: 0 0 15px rgba(255, 245, 157, 0.5);
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--limo-yellow), var(--limo-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(165, 214, 167, 0.2);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--limo-yellow);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 102;
}

.nav-links {
    display: flex;
    gap: 25px;
    transition: all 0.3s ease;
}

.nav-links a {
    color: var(--dark-text);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover {
    color: var(--limo-yellow);
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--limo-yellow);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* صفحه چت */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(30, 30, 30, 0.7);
    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: 12px 20px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
    background: rgba(26, 60, 31, 0.3);
    display: none;
    align-items: center;
    justify-content: space-between;
}

.chat-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--limo-yellow), transparent);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    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: 15px 15px;
    border-radius: 18px;
    line-height: 1.6;
    word-break: break-word;
    position: relative;
    box-shadow: 0 6px 15px 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(76, 175, 80, 0.2);
    white-space: pre-line;
}

.ai-bubble {
    background: var(--ai-bubble);
    border-bottom-right-radius: 1px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--limo-yellow);
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(255, 245, 157, 0.2);
    font-size: 0.95rem;
}

.message-header i {
    font-size: 1.1rem;
}

.message-header img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--limo-yellow);
    box-shadow: 0 0 8px rgba(255, 245, 157, 0.3);
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid rgba(76, 175, 80, 0.2);
    background: rgba(26, 60, 31, 0.25);
}

.chat-form {
    display: flex;
    gap: 12px;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

.chat-input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 25px;
    border: 1px solid var(--limo-dark);
    background: rgba(18, 18, 18, 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: 55px;
    max-height: 55px;
    overflow-y: auto;
    direction: rtl;
}

.chat-input:focus {
    border-color: var(--limo-yellow);
    box-shadow: 0 0 0 3px rgba(255, 245, 157, 0.3),
                inset 0 0 12px rgba(0, 0, 0, 0.4);
}

.chat-submit {
    background: linear-gradient(45deg, var(--limo-green), var(--limo-yellow));
    color: #000;
    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(165, 214, 167, 0.5);
}

.chat-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(165, 214, 167, 0.7);
}

.chat-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* استایل جدید برای باکس کدهای اینلاین */
.inline-code {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--limo-yellow);
    direction: ltr;
    display: inline-block;
    text-align: left;
    unicode-bidi: isolate;
    margin: 0 2px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.inline-code:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--limo-yellow);
    transform: translateY(-1px);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.4), 0 0 8px rgba(255, 245, 157, 0.2);
}

/* استایل‌های بهبود یافته برای هدرها در حباب AI */
.ai-bubble h1 {
    font-size: 1.8rem;
    color: var(--limo-yellow);
    border-bottom: 1px solid rgba(255, 245, 157, 0.3);
    padding-bottom: 10px;
    margin: 25px 0 20px;
    text-shadow: 0 0 10px rgba(255, 245, 157, 0.3);
}

.ai-bubble h2 {
    font-size: 1.6rem;
    color: var(--limo-yellow);
    margin: 23px 0 18px;
    padding-right: 15px;
    border-right: 3px solid var(--limo-green);
}

.ai-bubble h3 {
    font-size: 1.4rem;
    color: var(--limo-yellow);
    border-bottom: 1px solid rgba(255, 245, 157, 0.3);
    padding-bottom: 8px;
    margin: 20px 0 15px;
    text-shadow: 0 0 8px rgba(255, 245, 157, 0.2);
}

.ai-bubble h4 {
    font-size: 1.3rem;
    color: var(--limo-yellow);
    margin: 18px 0 12px;
    padding-right: 10px;
    border-right: 3px solid var(--limo-green);
}

.ai-bubble h5 {
    font-size: 1.2rem;
    color: var(--limo-light);
    margin: 16px 0 10px;
    position: relative;
    padding-right: 15px;
}

.ai-bubble h5:before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--limo-green);
    border-radius: 50%;
}

.ai-bubble h6 {
    font-size: 1.1rem;
    color: var(--limo-light);
    margin: 14px 0 8px;
    font-weight: bold;
    background: rgba(76, 175, 80, 0.15);
    padding: 5px 10px;
    border-radius: 8px;
    display: inline-block;
}

/* بهبود استایل لیست‌ها */
.ai-bubble ul, .ai-bubble ol {
    padding-right: 30px;
    margin: 15px 0;
    position: relative;
}

.ai-bubble ul {
    list-style-type: none;
}

.ai-bubble ol {
    list-style-type: decimal;
    padding-right: 35px;
}

.ai-bubble li {
    margin-bottom: 10px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.8;
}

.ai-bubble ul li::before {
    content: "•";
    color: var(--limo-yellow);
    position: absolute;
    right: -25px;
    font-size: 1.4rem;
    top: -2px;
    text-shadow: 0 0 8px rgba(255, 245, 157, 0.3);
}

/* استایل نقل‌قول‌ها */
.ai-bubble blockquote {
    border-right: 3px solid var(--limo-yellow);
    padding: 12px 20px;
    margin: 18px 0;
    color: var(--limo-light);
    font-style: italic;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
}

/* استایل متن زیرخط‌دار */
.ai-bubble u {
    text-decoration: underline;
    text-decoration-color: var(--limo-yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* استایل متن خط‌خورده */
.ai-bubble s {
    text-decoration: line-through;
    text-decoration-color: #ff6b6b;
    text-decoration-thickness: 2px;
}

/* استایل متن بزرگ */
.ai-bubble .large-text {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--limo-light);
}

/* استایل متن کوچک */
.ai-bubble small {
    font-size: 0.85em;
    color: #bbb;
}

/* استایل متن ایتالیک */
.ai-bubble em {
    font-style: italic;
    color: #ddd;
}

/* استایل خط جداکننده */
.ai-bubble hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--limo-yellow), transparent);
    margin: 20px 0;
}

/* استایل لینک‌ها */
.ai-bubble a {
    color: var(--limo-yellow);
    text-decoration: none;
    border-bottom: 1px dotted var(--limo-yellow);
    transition: all 0.3s ease;
}

.ai-bubble a:hover {
    color: var(--limo-light);
    border-bottom: 1px solid var(--limo-light);
}

/* انیمیشن‌ها */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.floating {
    animation: float 4s ease-in-out infinite;
}

.typing-indicator {
    display: inline-flex;
    gap: 7px;
    padding: 12px 18px;
    background: var(--ai-bubble);
    border-radius: 18px;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--limo-yellow);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    box-shadow: 0 0 5px rgba(255, 245, 157, 0.6);
}

.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(-6px); }
}

/* دکمه کپی پیام */
.message-copy-button {
    margin-top: 8px;
    padding: 10px 10px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--limo-yellow);
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    font-size: 0.9rem;
}

.message-copy-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.message-copy-button.success {
    color: var(--limo-green);
    background: rgba(165, 214, 167, 0.25);
}

/* استایل جداول */
.ai-bubble .table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.ai-bubble table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 30, 30, 0.6);
    border-radius: 8px;
    overflow: hidden;
}

.ai-bubble th, .ai-bubble td {
    padding: 12px 15px;
    text-align: right;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.ai-bubble th {
    background: rgba(76, 175, 80, 0.3);
    color: var(--limo-yellow);
    font-weight: bold;
}

.ai-bubble tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.2);
}

/* استایل لیست‌های تو در تو */
.ai-bubble ul.nested-1 { padding-right: 30px; }
.ai-bubble ul.nested-2 { padding-right: 50px; }
.ai-bubble ul.nested-3 { padding-right: 70px; }
.ai-bubble ol.nested-1 { padding-right: 30px; }
.ai-bubble ol.nested-2 { padding-right: 50px; }
.ai-bubble ol.nested-3 { padding-right: 70px; }

/* استایل چک‌لیست */
.ai-bubble .task-item {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-bubble .task-item input[type="checkbox"] {
    cursor: default;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--limo-yellow);
    border-radius: 4px;
    position: relative;
}

.ai-bubble .task-item input[type="checkbox"]:checked::before {
    content: "✓";
    position: absolute;
    top: -2px;
    right: 2px;
    color: var(--limo-yellow);
    font-size: 14px;
}

/* رسپانسیو */
@media (max-width: 992px) {
    :root {
        --base-font-size: 0.85rem;
    }
    
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .chat-container {
        height: calc(100vh - 65px);
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message {
        max-width: 98%;
    }
    
    .chat-input {
        padding: 12px 18px;
    }
    
    /* تنظیمات جدول برای موبایل */
    .ai-bubble .table-container {
        font-size: 0.8rem;
    }
    
    .ai-bubble th, .ai-bubble td {
        padding: 8px 10px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        height: 100vh;
        background: rgba(30, 30, 30, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 80px 20px 20px;
        gap: 15px;
        z-index: 100;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
        transition: right 0.3s ease;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links a {
        padding: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        font-size: 1.05rem;
    }
    
    .chat-form {
        flex-direction: column;
    }
    
    .chat-submit {
        padding: 14px;
        width: 100%;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .logo img {
        width: 38px;
        height: 38px;
    }
    
    .clear-history {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
    
    /* تنظیمات جدید برای موبایل */
    .ai-bubble h1 { font-size: 1.5rem; }
    .ai-bubble h2 { font-size: 1.4rem; }
    .ai-bubble h3 { font-size: 1.3rem; }
    .ai-bubble h4 { font-size: 1.2rem; }
    .ai-bubble h5 { font-size: 1.1rem; }
    .ai-bubble h6 { font-size: 1rem; }
    
    .ai-bubble ul, .ai-bubble ol {
        padding-right: 25px;
    }
}

@media (max-width: 480px) {
    :root {
        --base-font-size: 0.82rem;
    }
    
    .chat-header {
        padding: 10px 15px;
    }
    
    .message-bubble {
        padding: 12px 16px;
    }
    
    .message-header {
        font-size: 0.9rem;
    }
    
    .message-header img {
        width: 26px;
        height: 26px;
    }
    
    .chat-input-container {
        padding: 12px;
    }
    
    .inline-code {
        font-size: 0.8em;
        padding: 1px 4px;
    }
    
    /* تنظیمات جدول برای موبایل کوچک */
    .ai-bubble th, .ai-bubble td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
}

/* اسکرول بار */
.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(--limo-dark);
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.2);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--limo-darker);
}

.clear-history {
    background: rgba(255, 0, 0, 0.12);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    border-radius: 18px;
    padding: 7px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.clear-history:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff5252;
    transform: translateY(-2px);
}

/* جلوه‌های ویژه */
.glow-text {
    text-shadow: 0 0 8px rgba(165, 214, 167, 0.7);
}

.developer-badge {
    position: absolute;
    bottom: 8px;
    left: 15px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 12px;
    border-radius: 18px;
    font-size: 0.8rem;
    color: var(--limo-light);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.code-block-container {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
}

.language-tag {
    background: rgba(76, 175, 80, 0.25);
    padding: 7px 14px;
    border-radius: 18px;
    font-weight: bold;
    color: var(--limo-yellow);
    text-shadow: 0 0 6px rgba(255, 245, 157, 0.3);
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.code-actions {
    display: flex;
    gap: 10px;
}

.copy-code-btn, .download-code-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--limo-yellow);
    border-radius: 18px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.copy-code-btn:hover, .download-code-btn:hover {
    background: rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

.copy-code-btn.success {
    color: var(--limo-green);
    background: rgba(165, 214, 167, 0.25);
}

.code-block-container pre {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
    background: rgba(0,0,0,0.45);
    padding: 18px;
    border-radius: 0 0 10px 10px;
    overflow-x: auto;
    margin: 0;
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-top: none;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
    position: relative;
    font-size: 0.85rem;
}

.code-block-container code {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: 0.95rem;
}