/* ============================================
   صفحه انتخاب کتگوری - استایل اختصاصی
   آکادمی مریم ورزنده
============================================ */

/* --- فونت‌ها --- */
@font-face {
  font-family: 'vazir';
  src: url(../fonts/Vazir.woff2) format(woff2);
}

@font-face {
  font-family: 'vazirb';
  src: url('../fonts/Vazirmatn-Bold.ttf') format(truetype);
}

/* --- متغیرها --- */
:root {
  --bg-page-1: #f9fcfb;
  --bg-page-2: #e8f1ee;
  --card-bg: rgba(255, 255, 255, 0.96);
  --card-border: rgba(210, 222, 217, 0.9);
  --text-main: #17221f;
  --text-muted: #5e6c67;

  --shadow-1: 0 8px 22px rgba(15, 30, 26, 0.10);
  --shadow-2: 0 22px 60px rgba(15, 30, 26, 0.12);
  --shadow-3: 0 40px 90px rgba(15, 30, 26, 0.12);
  --radius: 12px;

  --accent: #22403a;
  --accent-light: #2f5c54;
  --accent-soft: #e7f2ef;

  --gold: #c8a165;
  --gold-soft: #f3e7d3;
  --gold-glow: rgba(200, 161, 101, 0.35);
  --gold-glow-strong: rgba(200, 161, 101, 0.55);
  --teal-very-soft: #eef7f4;
}

/* --- ریست کلی --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- بادی --- */
body {
  background:
    radial-gradient(1200px 600px at 20% -10%, #ffffff 0%, transparent 65%),
    radial-gradient(900px 500px at 100% 0%, rgba(200, 161, 101, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-page-1) 0%, var(--bg-page-2) 100%);
  font-family: 'vazir', "Vazirmatn", sans-serif !important;
  color: var(--text-main);
  padding: 16px;
  line-height: 1.8;
  min-height: 100vh;
}

.page-wrap {
  max-width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ============================================
   هدر
============================================ */
.site-header {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 250, 248, 0.96) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(6px);
  text-align: center;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  border: 1px solid rgba(200, 161, 101, 0.4);
  pointer-events: none;
  box-shadow: 0 0 20px rgba(200, 161, 101, 0.15);
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.site-header h1 {
  font-family: 'vazirb', sans-serif;
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 900;
  letter-spacing: .3px;
}

.site-header p {
  color: var(--text-muted);
  font-size: .95rem;
  max-width: 700px;
  margin: 0 auto;
}

/* ============================================
   گرید باکس‌های کتگوری
============================================ */
.categories-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

/* --- باکس کتگوری --- */
.category-box {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(6px);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* border طلایی داخلی */
.category-box::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  border: 1px solid rgba(200, 161, 101, 0.35);
  pointer-events: none;
  transition: all 0.35s ease;
}

/* Halo طلایی بیرونی - Gold Glow قوی */
.category-box::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--radius) + 8px);
  box-shadow: 0 0 30px var(--gold-glow);
  opacity: 0.7;
  pointer-events: none;
  transition: all 0.35s ease;
  z-index: -1;
}

/* --- هاور افکت --- */
.category-box:hover {
  transform: translateY(-6px);
  box-shadow:
    0 25px 50px rgba(15, 30, 26, 0.18),
    0 10px 30px rgba(200, 161, 101, 0.15);
}

.category-box:hover::before {
  border-color: rgba(200, 161, 101, 0.6);
  box-shadow: inset 0 0 0 1px rgba(200, 161, 101, 0.15);
}

.category-box:hover::after {
  inset: -12px;
  box-shadow: 0 0 50px var(--gold-glow-strong);
  opacity: 1;
}

/* --- هدر باکس (آیکون + عنوان) --- */
.category-box-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.category-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-soft) 0%, #f7e9d2 100%);
  border: 1px solid #ead8b7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #8b6a2f;
  box-shadow:
    0 4px 14px rgba(200, 161, 101, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.35s ease;
}

.category-box:hover .category-icon {
  transform: rotate(-6deg) scale(1.08);
}

.category-title {
  font-family: 'vazirb', sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.4;
  flex: 1;
}

/* --- توضیحات کوتاه (اختیاری) --- */
.category-desc {
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.8;
}

/* --- فوتر باکس (badge + دکمه) --- */
.category-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #e4ece8;
}

.videos-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-soft) 0%, #f7e9d2 100%);
  border: 1px solid #ead8b7;
  color: #8b6a2f;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(200, 161, 101, 0.25);
}

.videos-count-badge i {
  font-size: 14px;
}

.category-enter-btn {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(34, 64, 58, 0.25);
}

.category-enter-btn i {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.category-box:hover .category-enter-btn {
  background: var(--accent-light);
  box-shadow: 0 6px 18px rgba(34, 64, 58, 0.35);
}

.category-box:hover .category-enter-btn i {
  transform: translateX(-4px);
}

/* --- حالت انتخاب‌شده (وقتی کاربر کلیک کرد) --- */
.category-box.selected {
  border-color: var(--gold);
  transform: translateY(-4px);
}

.category-box.selected::before {
  border-color: var(--gold);
  border-width: 2px;
}

.category-box.selected::after {
  box-shadow: 0 0 60px var(--gold-glow-strong);
  opacity: 1;
}

.selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(200, 161, 101, 0.4);
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- انیمیشن ورود باکس‌ها --- */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-box {
  animation: slideInUp 0.5s ease backwards;
}

.category-box:nth-child(1) {
  animation-delay: 0.05s;
}

.category-box:nth-child(2) {
  animation-delay: 0.15s;
}

.category-box:nth-child(3) {
  animation-delay: 0.25s;
}

.category-box:nth-child(4) {
  animation-delay: 0.35s;
}

.category-box:nth-child(5) {
  animation-delay: 0.45s;
}

.category-box:nth-child(6) {
  animation-delay: 0.55s;
}

/* ============================================
   پیام وضعیت (loading / error)
============================================ */
.status-message {
  text-align: center;
  padding: 40px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 20px;
}

.status-message.error {
  border-color: #f5c2c2;
  color: #8b2f2f;
  background: #fef5f5;
}

.loading-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   باکس تماس (کپی از اصلی با کمی بهبود)
============================================ */
.contact-box {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-1);
  position: relative;
}

.contact-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(200, 161, 101, 0.25);
  pointer-events: none;
}

.contact-social {
  width: 280px;
}

.contact-box-title {
  font-family: 'vazirb', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 32px;
  color: var(--accent);
  position: relative;
  display: inline-block;
}

.contact-box-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 25%;
  height: 4px;
  width: 50%;
  background: #003d31;
  border-radius: 2px;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  display: none;
}

.social-icons a {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold-soft), #f7e9d2);
  border: 1px solid #ead8b7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 18px;
  color: #8b6a2f;
  box-shadow: 0 4px 12px rgba(200, 161, 101, 0.25);
  transition: transform 0.25s ease;
}

.social-icons a:hover {
  transform: translateY(-3px);
}

.back-btn {
  display: block;
  margin: 8px auto;
  max-width: 280px;
  background: var(--accent);
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(34, 64, 58, 0.25);
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

.back-btn.last {
  background: #ed9000;
  box-shadow: 0 6px 18px rgba(200, 161, 101, 0.3);
}

.back-btn.last:hover {
  background: #c17500;
}

/* ============================================
   فوتر
============================================ */
.site-footer {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-1);
  font-size: .85rem;
}

/* ============================================
   اسکرول‌بار
============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #e7efec;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #22403a;
  border-radius: 10px;
  border: 2px solid #e7efec;
}

::-webkit-scrollbar-thumb:hover {
  background: #2d544c;
}

/* ============================================
   ریسپانسیو - تبلت (۲ ستون)
============================================ */
@media (min-width: 720px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .site-header {
    padding: 28px 24px;
  }

  .site-header h1 {
    font-size: 1.75rem;
  }
}

/* ============================================
   ریسپانسیو - دسکتاپ (۳ ستون)
============================================ */
@media (min-width: 1000px) {
  body {
    padding: 24px;
  }

  .page-wrap {
    max-width: 1280px;
    margin: 0 auto;
  }

  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .site-header {
    padding: 32px;
    margin-bottom: 28px;
  }

  .site-header h1 {
    font-size: 1.9rem;
  }

  .site-header p {
    font-size: 1rem;
  }

  .category-box {
    padding: 26px 24px;
  }

  .category-icon {
    width: 58px;
    height: 58px;
    font-size: 26px;
  }

  .category-title {
    font-size: 1.3rem;
  }
}

/* ============================================
   ریسپانسیو - دسکتاپ بزرگ (۴ ستون در صورت نیاز)
============================================ */
@media (min-width: 1400px) {
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* کانتینر دکمه یا نشان انتخاب‌شده در فوتر باکس */
.category-action {
  display: inline-flex;
  align-items: center;
}

/* --- هیچ متنی داخل دکمه/نشان نشکند --- */
.videos-count-badge,
.category-enter-btn,
.selected-badge {
  white-space: nowrap;
}

/* --- اگر جا کم آمد، کل دکمه به خط بعد برود نه اینکه له شود --- */
.category-box-footer {
  flex-wrap: wrap;
}

.category-enter-btn {
  padding: 8px 16px;
}

/* --- باکس تماس: فاصله‌های اضافی حذف --- */
.contact-box-title {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

.contact-box-title::after {
  bottom: -8px;
}

.contact-links {
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.back-btn {
  width: 100%;
  max-width: 280px;
  margin: 0;
}

/* --- موبایل خیلی کوچک: فوتر باکس ستونی و مرتب --- */
@media (max-width: 420px) {
  .category-box-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .videos-count-badge {
    justify-content: center;
  }

  .category-action {
    display: flex;
  }

  .category-enter-btn,
  .selected-badge {
    width: 100%;
    margin-top: 10px;
    justify-content: center;
  }
}

/* --- دسکتاپ: باکس‌ها عریض‌تر (۲ ستون تا ۱۲۰۰px) --- */
@media (min-width: 1000px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- دسکتاپ بزرگ: ۳ ستون با کانتینر عریض‌تر --- */
@media (min-width: 1200px) {
  .page-wrap {
    max-width: 1320px;
  }

  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- دسکتاپ: باکس تماس افقی و فشرده (یک ردیف) --- */
@media (min-width: 1000px) {
  .contact-box {
    justify-content: space-evenly;
    padding: 16px 28px;
    gap: 0;
  }

  .contact-social {
    width: 45%;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
  }

  .contact-box-title {
    margin-bottom: 0;
  }

  .social-icons {
    margin: 0;
  }

  .contact-links {
    width: auto;
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    gap: 10px;
  }

  .back-btn {
    width: auto;
    max-width: none;
    padding: 9px 18px;
  }
}