/* =====================================================
   فونت Vazirmatn — لوکال (بعد از دانلود در assets/fonts بذار)
   ===================================================== */
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/Vazirmatn[wght].woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* =====================================================
   CSS Variables — رنگ‌ها و مقادیر تکراری
   ===================================================== */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-deeper: #1e40af;
  --primary-light:  #dbeafe;
  --primary-xlight: #eff6ff;
  --secondary:      #7c3aed;
  --text-darkest:   #0f172a;
  --text-dark:      #1e293b;
  --text-medium:    #334155;
  --text-light:     #475569;
  --text-muted:     #64748b;
  --bg-main:        #f4f7fc;
  --border-light:   #e2e8f0;
  --border-medium:  #cbd5e1;
  --white-75:       rgba(255,255,255,0.75);
  --white-92:       rgba(255,255,255,0.92);
  --radius-xl:      28px;
  --radius-lg:      20px;
  --radius-md:      12px;
}

/* =====================================================
   Reset و Base
   ===================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.8;
  scroll-behavior: smooth;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 15% 20%, rgba(59,130,246,0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(168,85,247,0.06) 0%, transparent 45%);
  z-index: -1;
}

/* =====================================================
   Navbar
   ===================================================== */
.navbar-custom {
  background: var(--white-92);
  /* Fallback برای مرورگرهایی که backdrop-filter ندارن */
  background: rgba(255,255,255,0.97);
  background: var(--white-92);
  -webkit-backdrop-filter: blur(15px);
          backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 0.8rem 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.navbar-custom .navbar-brand {
  font-weight: 900;
  font-size: 1.7rem;
  /* Fallback رنگ — اگه gradient ساپورت نشه متن نامرئی نشه */
  color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
          background-clip: text;
}

/* Fallback برای مرورگرهایی که text-fill-color ندارن */
@supports not (-webkit-text-fill-color: transparent) {
  .navbar-custom .navbar-brand {
    color: var(--primary);
    background: none;
  }
}

.nav-link {
  color: var(--text-medium) !important;
  font-weight: 500;
  margin: 0 0.3rem;
  transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary) !important;
  font-weight: 600;
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 80px;
  background: linear-gradient(135deg, var(--primary-xlight) 0%, #f8fafc 100%);
}

.hero-glow {
  font-size: 3.8rem;
  font-weight: 900;
  color: var(--text-darkest);
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 1.5rem;
  color: var(--text-light);
  border-right: 3px solid var(--primary);
  padding: 8px 20px;
  margin: 15px auto 25px;
  display: inline-block;
  background: #e2e8f0;
  border-radius: 8px 0 0 8px;
}

/* =====================================================
   دکمه‌ها
   ===================================================== */
.btn-primary-grad {
  background: var(--primary);
  border: none;
  padding: 12px 32px;
  border-radius: 35px;
  font-weight: 600;
  color: white;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 8px 20px rgba(37,99,235,0.25);
  text-decoration: none;
  display: inline-block;
}

.btn-primary-grad:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37,99,235,0.4);
  color: white;
}

.btn-outline-light-custom {
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 12px 32px;
  border-radius: 35px;
  font-weight: 600;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-outline-light-custom:hover {
  background: var(--primary-xlight);
  color: var(--primary-deeper);
  border-color: var(--primary-deeper);
}

/* =====================================================
   Glass Card
   ===================================================== */
.glass-card {
  /* Fallback برای مرورگرهای قدیمی */
  background: rgba(255,255,255,0.97);
  background: var(--white-75);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.9);
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.05);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.glass-card:hover {
  box-shadow: 0 25px 45px rgba(0,0,0,0.08);
  transform: translateY(-3px);
}

/* =====================================================
   Section Title
   ===================================================== */
.section-title {
  font-weight: 800;
  font-size: 2.3rem;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-darkest);
}

.section-title i {
  color: var(--primary);
  font-size: 2rem;
  background: var(--primary-light);
  padding: 12px;
  border-radius: var(--radius-md);
}

/* =====================================================
   Timeline
   ===================================================== */
.timeline-item {
  position: relative;
  padding-right: 35px;
  margin-bottom: 30px;
  border-right: 2px solid var(--border-medium);
}

.timeline-item::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 8px;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(37,99,235,0.5);
}

/* =====================================================
   Skill Badges
   ===================================================== */
.skill-badge {
  background: var(--primary-xlight);
  color: var(--primary-deeper);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 500;
  margin: 6px;
  display: inline-block;
  border: 1px solid var(--primary-light);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.skill-badge:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* =====================================================
   Project & Course Cards
   ===================================================== */
.project-card,
.course-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 20px rgba(0,0,0,0.02);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.project-card:hover,
.course-card:hover {
  border-color: var(--primary);
  box-shadow: 0 15px 30px rgba(37,99,235,0.1);
}

/* =====================================================
   Footer
   ===================================================== */
.footer-custom {
  background: #ffffff;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
}

/* =====================================================
   دکمه شناور هوش مصنوعی
   ===================================================== */
.ai-floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  box-shadow: 0 8px 25px rgba(37,99,235,0.5);
  cursor: pointer;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.ai-floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(37,99,235,0.7);
}

/* =====================================================
   پنل چت
   ===================================================== */
.chat-panel {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  max-width: 90vw;
  height: 500px;
  max-height: 70vh;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  z-index: 1049;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.chat-panel.open {
  display: flex;
}

.chat-header {
  background: #f8fafc;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--text-dark);
  flex-wrap: wrap;
  gap: 8px;
}

.chat-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 0.95rem;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 5px;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-dark);
  border-bottom-left-radius: 5px;
  white-space: pre-wrap;
}

.typing-indicator {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 12px 16px;
  border-radius: 18px;
  display: flex;
  gap: 5px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--border-medium);
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%   { opacity: 0.2; }
  20%  { opacity: 1;   }
  100% { opacity: 0.2; }
}

.chat-input-area {
  padding: 15px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  border: 1px solid var(--border-medium);
  border-radius: 25px;
  padding: 10px 18px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input-area input:focus {
  border-color: var(--primary);
}

.chat-input-area button {
  background: var(--primary);
  border: none;
  color: white;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, opacity 0.3s;
  flex-shrink: 0;
}

.chat-input-area button:hover {
  background: var(--primary-dark);
}

.chat-input-area button:disabled {
  cursor: not-allowed;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
  .hero-glow {
    font-size: 2.6rem;
  }

  .glass-card {
    padding: 1.8rem 1.2rem;
  }

  .chat-panel {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 90px;
  }

  .section-title {
    font-size: 1.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glass-card,
  .project-card,
  .course-card,
  .skill-badge,
  .btn-primary-grad,
  .ai-floating-btn {
    transition: none;
  }
}
