/* ===== CSS Custom Properties (Theme) ===== */
:root {
  /* Light Theme – Warm Palette */
  --bg-primary: #fffbf5;
  --bg-secondary: #fef9ef;
  --bg-tertiary: #fff4e0;
  --bg-card: #ffffff;
  --bg-nav: rgba(255, 251, 245, 0.92);
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --accent-primary: #d97706;
  --accent-secondary: #dc2626;
  --accent-primary-hover: #b45309;
  --accent-secondary-hover: #b91c1c;
  --border-color: #fde68a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --gradient-accent: linear-gradient(135deg, #d97706, #dc2626);
  --tag-bg: #fef3c7;
  --tag-color: #92400e;
}

[data-theme="dark"] {
  --bg-primary: #0c0a09;
  --bg-secondary: #1c1917;
  --bg-tertiary: #292524;
  --bg-card: #1c1917;
  --bg-nav: rgba(12, 10, 9, 0.95);
  --text-primary: #f5f5f4;
  --text-secondary: #a8a29e;
  --text-muted: #78716c;
  --accent-primary: #f59e0b;
  --accent-secondary: #ef4444;
  --accent-primary-hover: #fbbf24;
  --accent-secondary-hover: #f87171;
  --border-color: #44403c;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  --gradient-accent: linear-gradient(135deg, #f59e0b, #ef4444);
  --tag-bg: #451a03;
  --tag-color: #fcd34d;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100vh;
  font-size: 16px;
}
body {
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  transition: background-color 0.3s, color 0.3s;
}

::selection {
  background: var(--accent-primary);
  color: #fff;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--accent-primary-hover); }

img {
  max-width: 100%;
  display: block;
}

/* ===== Scrollbar for content panels ===== */
.panel-content::-webkit-scrollbar { width: 5px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 10px; }

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 62px;
  background: var(--bg-nav);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.navbar .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}
.nav-brand i { font-size: 1rem; }
.nav-brand span {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active-tab {
  color: var(--accent-primary);
  background: var(--tag-bg);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: rotate(15deg);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform 0.4s, opacity 0.4s;
}
.theme-toggle .icon-sun { transform: translateY(-20px); opacity: 0; }
.theme-toggle .icon-moon { transform: translateY(0); opacity: 1; }
[data-theme="dark"] .theme-toggle .icon-sun { transform: translateY(0); opacity: 1; }
[data-theme="dark"] .theme-toggle .icon-moon { transform: translateY(20px); opacity: 0; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ===== Main Layout ===== */
.app-layout {
  display: flex;
  height: calc(100vh - 62px);
  margin-top: 62px;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

.sidebar-name {
  text-align: center;
}
.sidebar-name h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.sidebar-name h1 .highlight {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-name .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--tag-bg);
  color: var(--accent-primary);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}
.sidebar-name .subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-bio {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 260px;
}

.sidebar-social {
  display: flex;
  gap: 8px;
}
.sidebar-social a {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all 0.3s;
}
.sidebar-social a:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 220px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  text-align: center;
}
.btn-primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
  color: #fff;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* ===== Content Area ===== */
.content-area {
  flex: 1;
  min-width: 0;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow: hidden;
}
.tab-panel.active {
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 24px 32px 8px;
  flex-shrink: 0;
}
.panel-header .section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  margin-bottom: 4px;
}
.panel-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 32px 24px;
}

/* ===== About Panel ===== */
.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: all 0.3s;
}
.stat-item:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.3s;
}
.about-card:hover {
  box-shadow: var(--shadow-sm);
}
.about-card h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.about-card p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 8px;
  line-height: 1.7;
}

.about-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.detail-item:hover {
  background: var(--bg-tertiary);
}
.detail-item .icon {
  color: var(--accent-primary);
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.about-mission {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--tag-bg), var(--bg-card));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
}
.about-mission .mission-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.about-mission .mission-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.about-mission .mission-text strong {
  color: var(--text-primary);
}

/* ===== Skills Panel ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  transition: all 0.3s;
  position: relative;
}
.skill-category::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--gradient-accent);
}
.skill-category:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.skill-category-body {
  padding: 16px 16px 18px;
}
.skill-category .skill-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent-primary);
  margin-bottom: 10px;
  transition: all 0.3s;
}
.skill-category:hover .skill-icon {
  background: var(--accent-primary);
  color: #fff;
}
.skill-category h3 {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  font-weight: 700;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.skill-tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.2s;
}
.skill-tag:hover {
  background: var(--accent-primary);
  color: #fff;
}

/* ===== Projects Panel ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s;
}
.project-card:hover::before { transform: scaleX(1); }
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.project-card .project-icon { font-size: 1.5rem; margin-bottom: 8px; }
.project-card h3 { font-size: 0.95rem; margin-bottom: 6px; }
.project-card p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-bottom: 10px;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.project-tags span {
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}
.project-links { display: flex; gap: 10px; }
.project-links a { font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ===== Math Panel ===== */
.math-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.math-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
}
.math-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.math-card .math-icon { font-size: 2rem; margin-bottom: 8px; }
.math-card h3 { font-size: 0.9rem; margin-bottom: 6px; }
.math-card p { color: var(--text-secondary); font-size: 0.76rem; }

/* ===== Contact Panel ===== */
.contact-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: 100%;
}
.contact-info h3 { font-size: 1rem; margin-bottom: 10px; }
.contact-info > p { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 14px; }

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.contact-item:hover { border-color: var(--accent-primary); }
.contact-item .icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}
.contact-item .info { flex: 1; }
.contact-item .info strong { display: block; font-size: 0.78rem; }
.contact-item .info span,
.contact-item .info a { font-size: 0.76rem; color: var(--text-secondary); }

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
}
.contact-form h3 { font-size: 1rem; margin-bottom: 12px; }

.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  transition: border 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group textarea { min-height: 70px; resize: vertical; }

.btn-submit {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.3);
}

/* ===== Blog Panel ===== */
.panel-header-blog {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header-blog h2 {
  flex: 1;
}
.panel-content-blog {
  padding-bottom: 32px;
}

.blog-card {
  display: flex;
  gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  transition: all 0.3s;
}
.blog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.blog-card-img {
  width: 200px;
  min-height: 160px;
  object-fit: cover;
  flex-shrink: 0;
}
.blog-card-body {
  padding: 18px 20px 18px 0;
  flex: 1;
  min-width: 0;
}
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.blog-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.blog-card-tags span {
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
}
.blog-card-body h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  line-height: 1.4;
}
.blog-card-body p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.6;
}
.blog-read-more {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  transition: gap 0.2s;
}
.blog-read-more:hover {
  gap: 8px;
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
.modal-editor {
  max-width: 600px;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  font-size: 1.1rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}
.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Admin Panel */
.admin-toolbar {
  margin-bottom: 16px;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: 10px;
  transition: background 0.2s;
}
.admin-row:hover {
  background: var(--bg-tertiary);
}
.admin-row-info {
  flex: 1;
  min-width: 0;
}
.admin-row-info strong {
  display: block;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-row-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.admin-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.admin-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.admin-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.admin-btn-del:hover {
  border-color: #dc2626;
  color: #dc2626;
}

/* ===== Latest Posts in About Section ===== */
.latest-posts-section {
  margin-top: 24px;
}
.latest-posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.latest-posts-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.latest-posts-link:hover {
  gap: 8px;
}
.latest-posts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.latest-post-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  text-decoration: none;
}
.latest-post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.latest-post-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
}
.latest-post-img-placeholder {
  font-size: 2rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.latest-post-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
}
.latest-post-overlay span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-post-overlay small {
  font-size: 0.65rem;
  opacity: 0.8;
}
.latest-post-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.latest-post-tags span {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6rem;
}

/* ===== Tab Transition ===== */
.tab-panel {
  animation: tabFadeIn 0.35s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Students page (separate, scrollable) ===== */
body.students-page {
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}
body.students-page .app-layout {
  height: auto;
  min-height: calc(100vh - 62px);
  display: block;
  margin-top: 62px;
  overflow: visible;
}
.students-hero {
  text-align: center;
  padding: 60px 24px 20px;
  background: var(--bg-secondary);
}
.students-hero .big-icon { font-size: 3rem; margin-bottom: 8px; }
.students-hero h1 { font-size: 1.8rem; margin-bottom: 6px; }
.students-hero p { color: var(--text-secondary); font-size: 0.9rem; }

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}
.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s;
}
.student-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.student-card .card-icon { font-size: 2rem; margin-bottom: 8px; }
.student-card h3 { font-size: 0.95rem; margin-bottom: 6px; }
.student-card p { color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 12px; }
.student-card .card-link { font-weight: 600; font-size: 0.82rem; }

.ask-section { padding: 32px 24px 48px; background: var(--bg-secondary); }
.ask-card {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}
.ask-card .big-icon { font-size: 2.5rem; margin-bottom: 12px; }
.ask-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.ask-card p { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 20px; }

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  text-decoration: none;
}
.whatsapp-btn:hover {
  background: #1ebe5d;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
  color: #fff;
}

.telegram-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0088cc;
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  text-decoration: none;
}
.telegram-btn:hover {
  background: #006fa3;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.3);
  color: #fff;
}

.shad-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #2ecc71;
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  text-decoration: none;
}
.shad-btn:hover {
  background: #27ae60;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
  color: #fff;
}

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-links-inline {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.footer-links-inline a { font-size: 0.8rem; color: var(--text-secondary); }
.footer-links-inline a:hover { color: var(--accent-primary); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar { width: 260px; min-width: 260px; padding: 24px 16px; }
  .sidebar-avatar { width: 110px; height: 110px; }
  .sidebar-name h1 { font-size: 1.15rem; }
  .contacts-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html, body { overflow: auto; height: auto; }

  .app-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 62px);
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    border-left: none;
    border-bottom: 1px solid var(--border-color);
    padding: 24px 16px 16px;
    gap: 10px;
  }
  .sidebar-avatar { width: 130px; height: 130px; }
  .sidebar-name h1 { font-size: 1.1rem; }
  .sidebar-bio { max-width: 100%; }
  .sidebar-actions { flex-direction: row; max-width: 100%; }
  .sidebar-actions .btn { flex: 1; }

  .content-area { height: auto; min-height: 400px; }
  .tab-panel.active { display: flex; }
  .tab-panel { animation: none; }

  .panel-header { padding: 16px 16px 4px; }
  .panel-header h2 { font-size: 1.1rem; }
  .panel-content { padding: 8px 16px 24px; }

  .latest-posts-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-card { flex-direction: column; }
  .blog-card-img { width: 100%; height: 180px; }
  .blog-card-body { padding: 14px 16px; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .about-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-item { padding: 12px 8px; }
  .stat-num { font-size: 1.3rem; }
  .about-grid { grid-template-columns: 1fr; }
  .about-details { grid-template-columns: 1fr; }
  .about-mission { flex-direction: column; text-align: center; padding: 16px; }
  .contact-split { grid-template-columns: 1fr; }

  .nav-links {
    position: fixed;
    top: 62px; left: 0; right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 12px;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-110%);
    opacity: 0;
    transition: all 0.4s;
    pointer-events: none;
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
  }
  .hamburger { display: flex; }
  .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
}

@media (max-width: 480px) {
  .skills-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .math-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
