/* Variables */
:root {
    --bg-color: #05050a;
    --term-bg: rgba(10, 10, 15, 0.85);
    --term-border: #333;
    --primary-neon: #00ff41; 
    --secondary-neon: #bd93f9; 
    --accent-neon: #ff79c6; 
    --text-main: #f8f8f2;
    --text-muted: #6272a4;
    
    --font-fa: 'Vazirmatn', sans-serif;
    --font-code: 'Fira Code', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-fa);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100vw;
}

.en-text { font-family: var(--font-code); display: inline-block; word-break: break-word; }
.fa-text { font-family: var(--font-fa); direction: rtl; text-align: right; color: var(--text-main); }
.fa-text.text-muted { color: var(--text-muted); }

/* Background Canvas & Effects */
#network-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -2; background: radial-gradient(circle at center, #0a0a1a 0%, #000000 100%);
}

.scanlines {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%);
    background-size: 100% 4px; z-index: -1; pointer-events: none; opacity: 0.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; width: 100%; }
.section { padding: 60px 0; }

/* Header - Mobile Friendly */
.header {
    background: rgba(5, 5, 10, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--primary-neon);
    padding: 10px 0;
    position: sticky; top: 0; z-index: 100;
}
/* تغییر جهت‌دهی نوبار به راست‌چین */
.nav-container { display: flex; justify-content: space-between; align-items: center; direction: rtl; flex-wrap: wrap; gap: 10px;}
.logo { font-family: var(--font-code); color: var(--primary-neon); font-size: 1.2rem; text-decoration: none; font-weight: bold; direction: ltr;}
.cursor-blink { animation: blink 1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Horizontal scrollable nav for mobile */
.navbar { width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch;}
.navbar::-webkit-scrollbar { display: none; }
.nav-links { list-style: none; display: flex; gap: 15px; padding-bottom: 5px;}
.nav-item { color: var(--text-main); text-decoration: none; font-family: var(--font-code); font-size: 0.85rem; transition: 0.3s; }
.nav-item:hover { color: var(--primary-neon); text-shadow: 0 0 8px var(--primary-neon); }

@media (min-width: 768px) {
    .nav-container { flex-wrap: nowrap; }
    .navbar { width: auto; overflow-x: visible; }
    .nav-links { gap: 20px; padding-bottom: 0;}
    .nav-item { font-size: 0.9rem; }
}

/* Glitch Title - Responsive */
.glitch-title {
    font-family: var(--font-fa); /* تغییر فونت به فارسی */
    font-size: 1.5rem; 
    color: var(--text-main);
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    text-shadow: 1px 1px 0px var(--primary-neon), -1px -1px 0px var(--accent-neon);
    direction: rtl; /* تغییر جهت گلیچ به راست‌چین */
    word-break: break-word;
    font-weight: bold;
}
@media (min-width: 768px) {
    .glitch-title { font-size: 2.2rem; text-shadow: 2px 2px 0px var(--primary-neon), -2px -2px 0px var(--accent-neon); }
}

/* Hero Section */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 30px;
    margin-top: 20px;
}
@media (min-width: 900px) {
    /* جابجایی پروفایل و ترمینال برای زبان فارسی */
    .hero-grid { grid-template-columns: 300px 1fr; margin-top: 40px;}
}

/* Cyber Profile Card */
.cyber-profile {
    background: rgba(20, 20, 30, 0.7);
    border: 1px solid var(--term-border); border-top: 3px solid var(--primary-neon);
    padding: 20px; display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.05);
    max-width: 350px; margin: 0 auto; width: 100%;
}
.image-wrapper {
    width: 150px; height: 150px; border-radius: 50%; overflow: hidden;
    position: relative; border: 2px solid var(--text-muted); margin-bottom: 20px;
}
.profile-img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(80%) contrast(120%); transition: 0.5s; }
.cyber-profile:hover .profile-img { filter: grayscale(0%); }
.scanner-line {
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--primary-neon); box-shadow: 0 0 10px var(--primary-neon);
    animation: scan 3s linear infinite;
}
@keyframes scan { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

.profile-data { width: 100%; font-size: 0.85rem; color: var(--text-muted); border-top: 1px solid #333; padding-top: 15px; direction: rtl; }
.data-row { margin-bottom: 8px; display: flex; justify-content: space-between; }
.data-row .label { color: var(--secondary-neon); }
.social-cyber { display: flex; gap: 15px; margin-top: 20px; }
.cyber-icon { color: var(--text-muted); font-size: 1.2rem; transition: 0.3s; }
.cyber-icon:hover { color: var(--primary-neon); text-shadow: 0 0 10px var(--primary-neon); }

/* Terminal Window */
.terminal-window {
    background: var(--term-bg); border: 1px solid var(--term-border);
    border-radius: 8px; overflow: hidden; box-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
    backdrop-filter: blur(5px); width: 100%;
}
/* دکمه‌های ترمینال در فارسی بهتر است راست باشند یا چپ؟ اینجا سمت چپ قرار دادم */
.terminal-header { background: #1e1e2e; padding: 8px 10px; display: flex; align-items: center; border-bottom: 1px solid var(--term-border); direction: rtl; }
.term-buttons { display: flex; gap: 6px; }
.t-btn { width: 10px; height: 10px; border-radius: 50%; }
.t-btn.close { background: #ff5f56; } .t-btn.min { background: #ffbd2e; } .t-btn.max { background: #27c93f; }
.term-title { margin: 0 auto; color: var(--text-muted); font-size: 0.75rem; word-break: break-all; text-align: center; padding: 0 10px; direction: ltr;}

.terminal-body { padding: 15px; min-height: 250px; font-size: 0.85rem; overflow-x: hidden; }
@media (min-width: 768px) { .terminal-body { padding: 20px; min-height: 300px; font-size: 0.95rem; } }

.prompt { color: var(--primary-neon); font-weight: bold; }
.typing-cmd { color: var(--text-main); }
.output-lines { margin-top: 15px; color: #8be9fd; }
.out-line { margin-bottom: 10px; opacity: 0; animation: fadeIn 0.1s forwards; line-height: 1.6; word-break: break-word;}
.out-line.fa-text { direction: rtl; text-align: right; color: var(--text-main); font-size: 0.95rem; }
.out-line.stats { display: flex; flex-direction: column; gap: 5px; color: var(--accent-neon); margin-top: 20px; direction: ltr; font-family: var(--font-code);}
@media (min-width: 500px) { .out-line.stats { flex-direction: row; gap: 20px; } }
@keyframes fadeIn { to { opacity: 1; } }

/* Tech Grid */
.tech-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 20px;
    direction: rtl; /* تغییر مسیر گرید به راست به چپ */
}
@media (min-width: 768px) {
    .tech-grid { grid-template-columns: repeat(2, 1fr); }
    .span-2-col { grid-column: span 2; }
}
@media (min-width: 1024px) {
    .tech-grid { grid-template-columns: repeat(3, 1fr); }
}

.tech-box {
    background: rgba(20, 20, 30, 0.6); border: 1px solid var(--text-muted);
    border-radius: 5px; padding: 25px 15px 15px 15px; position: relative; transition: 0.3s;
    width: 100%; overflow: hidden;
}
.tech-box:hover { border-color: var(--primary-neon); box-shadow: inset 0 0 15px rgba(0, 255, 65, 0.1); }
/* انتقال لیبل باکس به سمت راست */
.box-label {
    position: absolute; top: -1px; right: 10px; left: auto; background: var(--bg-color);
    padding: 0 8px; font-family: var(--font-fa); font-size: 0.75rem;
    color: var(--secondary-neon); border: 1px solid var(--text-muted); border-top: none;
    border-bottom-left-radius: 4px; border-bottom-right-radius: 4px;
}
/* Live Training Console Styling */
.console-box { 
    height: 150px; 
    overflow-y: auto; 
    overflow-x: hidden; 
    color: #f1fa8c; 
    font-size: 0.75rem; 
    line-height: 1.5; 
    word-break: break-all;
    padding-left: 5px; /* تنظیم پدینگ اسکرول بار برای راست چین */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
}

.console-box::-webkit-scrollbar { width: 4px; }
.console-box::-webkit-scrollbar-track { background: rgba(10, 10, 15, 0.5); border-radius: 4px; }
.console-box::-webkit-scrollbar-thumb { background: var(--primary-neon); border-radius: 4px; box-shadow: 0 0 5px var(--primary-neon); }
.console-box::-webkit-scrollbar-thumb:hover { background: #fff; }
.console-box { scrollbar-width: thin; scrollbar-color: var(--primary-neon) rgba(10, 10, 15, 0.5); }

.code-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.json-code { color: #f8f8f2; font-size: 0.85rem; white-space: pre; }
.json-code .string { color: #f1fa8c; }

/* Education Dirs */
.edu-terminal { margin-top: 10px; direction: rtl;}
.edu-item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 15px; }
.dir-icon { color: #ffbd2e; font-size: 1.2rem; margin-top: 3px;}
.edu-details h4 { margin-bottom: 5px; font-size: 0.95rem; line-height: 1.4;}
.edu-details p { font-size: 0.85rem; }

/* Git History - RTL Adjusted & Centered */
.git-history {
    background: rgba(10, 10, 15, 0.6);
    border-right: 2px solid var(--text-muted); /* خط در سمت راست */
    border-left: none;
    padding: 20px 20px 20px 15px; /* تنظیم پدینگ داخلی */
    margin: 0 15px 0 0; /* در موبایل کمی از حاشیه راست فاصله می‌گیرد */
    border-radius: 5px;
}

.commit { 
    margin-bottom: 25px; 
    position: relative; 
}

/* تنظیم نقطه نئونی روی خط در حالت موبایل */
.commit::before {
    content: ''; 
    position: absolute; 
    right: -26px; /* محاسبه دقیق برای قرارگیری مرکز دایره روی خط */
    left: auto; 
    top: 5px;
    width: 10px; 
    height: 10px; 
    border-radius: 50%;
    background: var(--accent-neon); 
    box-shadow: 0 0 10px var(--accent-neon);
}

/* تنظیمات مخصوص دسکتاپ برای جلوگیری از چسبیدن به راست */
@media (min-width: 768px) {
    .git-history { 
        max-width: 850px; /* محدود کردن عرض باکس */
        margin: 0 auto; /* وسط‌چین کردن کل باکس تاریخچه در صفحه */
        padding: 30px 40px 30px 20px; /* افزایش فضای داخلی */
    }
    
    /* تنظیم نقطه نئونی روی خط در حالت دسکتاپ */
    .commit::before { 
        right: -46px; /* تنظیم مجدد موقعیت دایره به خاطر افزایش پدینگ داخلی */
        width: 12px; 
        height: 12px; 
        top: 4px;
    }
}

.commit-hash { 
    color: #ffb86c; 
    font-weight: bold; 
    margin-bottom: 3px; 
    font-size: 0.85rem;
}

.hash-color { color: var(--accent-neon); }

.commit-author, .commit-date { 
    color: var(--text-muted); 
    font-size: 0.75rem;
}

.commit-msg { 
    color: var(--primary-neon); 
    margin-top: 8px; 
    font-weight: bold; 
    font-size: 0.95rem; 
    direction: rtl; 
    font-family: var(--font-fa);
}

.commit-desc { 
    margin-top: 8px; 
    border-right: none; 
    border-left: 2px solid var(--text-muted); /* خط تزئینی توضیحات به چپ رفت */
    padding-left: 10px; 
    padding-right: 0; 
    font-size: 0.9rem; 
    line-height: 1.6;
}

/* Cyber Cards (Publications) */
.cyber-grid { display: grid; grid-template-columns: 1fr; gap: 20px; direction: rtl;}
@media (min-width: 768px) { .cyber-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }

.cyber-card {
    border: 1px solid #333; background: rgba(20,20,30,0.8);
    padding: 15px; position: relative; overflow: hidden;
}
/* خط نئونی کنار کارت به سمت راست منتقل شد */
.cyber-card::before { content: ''; position: absolute; top: 0; right: 0; left: auto; width: 3px; height: 100%; background: var(--secondary-neon); }
.cyber-card:hover { border-color: var(--secondary-neon); }
.card-header { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 8px; direction: ltr; text-align: left;}
.card-title { color: #fff; font-size: 1rem; margin-bottom: 12px; line-height: 1.4; text-align: left;}
.card-body { font-size: 0.85rem; margin-bottom: 15px; line-height: 1.6;}
.card-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed #444; padding-top: 10px;}
.cyber-badge { background: rgba(189, 147, 249, 0.2); color: var(--secondary-neon); padding: 3px 6px; font-size: 0.75rem;}
.cyber-link { color: var(--primary-neon); }

/* Projects Grid */
.cyber-projects-grid { display: grid; grid-template-columns: 1fr; gap: 20px; direction: rtl;}
@media (min-width: 768px) { .cyber-projects-grid { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px;} }

.project-module { border: 1px solid var(--term-border); background: var(--term-bg); display: flex; flex-direction: column; }
.module-img { height: 180px; position: relative; overflow: hidden; }
.module-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(50%); transition: 0.5s; }
.project-module:hover .module-img img { filter: grayscale(0%) scale(1.05); }
.img-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, transparent, rgba(10,10,15,1)); }
.module-info { padding: 15px; transform: translateY(-20px); position: relative; z-index: 2; }
.module-title { color: var(--text-main); font-family: var(--font-fa); direction: rtl; text-align: right; margin-bottom: 8px; font-size: 1.1rem; text-shadow: 0 0 5px var(--primary-neon);}
.module-desc { font-size: 0.85rem; margin-bottom: 15px; }
.module-tech { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; justify-content: flex-end;}
.module-tech span { color: var(--bg-color); background: var(--primary-neon); padding: 2px 6px; font-size: 0.7rem; font-weight: bold;}

/* Contact Form - RTL Inputs */
.contact-terminal { max-width: 600px; margin: 0 auto; width: 100%; }
.cmd-input-group { display: flex; flex-direction: column; margin-bottom: 15px; align-items: flex-start; direction: rtl;}
@media (min-width: 600px) {
    .cmd-input-group { flex-direction: row; align-items: center; }
    .cmd-label { width: 130px; margin-bottom: 0; text-align: left; padding-left: 10px;}
}
.cmd-label { color: var(--accent-neon); font-size: 0.85rem; margin-bottom: 5px; direction: ltr; font-family: var(--font-fa);}
.cmd-input {
    background: transparent; border: none; outline: none; width: 100%;
    color: var(--text-main); font-family: var(--font-fa);
    font-size: 0.95rem; flex: 1; border-bottom: 1px dashed var(--text-muted);
    padding: 5px; border-radius: 0;
}
.cmd-input:focus { border-bottom-color: var(--primary-neon); }
.cyber-btn {
    background: transparent; border: 1px solid var(--primary-neon);
    color: var(--primary-neon); padding: 10px; cursor: pointer;
    width: 100%; transition: 0.3s; margin-top: 10px; font-size: 0.95rem;
    font-family: var(--font-fa); font-weight: bold;
}
.cyber-btn:hover { background: var(--primary-neon); color: var(--bg-color); box-shadow: 0 0 15px var(--primary-neon); }
