/* ==========================================================
   متغیرهای پایه رنگ و اندازه (مرجع مشترک برای همه فایل‌های CSS سایت)
   این فایل باید قبل از videos.css لود شود.
========================================================== */
:root {
    --primary: #311b5e;
    --accent: #ffb703;
    --bg-light: #f0edf6;
    --bg-body: #f5f3f9;
    --text-main: #333;
    --text-muted: #666;
    --error: #e74c3c;
    --radius: 16px;
}

/* تنظیمات پایه */
@font-face {
    font-family: "vazir-regular";
    src: url(../../fonts/Vazirmatn-Regular.ttf);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "vazir-regular", Tahoma, sans-serif;
}

body {
    background-color: var(--bg-body);
    /* پس‌زمینه ملایم با تم خیلی کم بنفش */
    color: var(--text-main);
}

.content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    z-index: 20000;
    display: none; /* مخفی در حالت عادی */
    align-items: center;
    justify-content: center;
}

.content-box {
    background: #fff;
    width: 90%;
    height: 85%;
    border-radius: 30px;
    padding: 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdf-wrapper {
    width: 100%;
    height: 100%;
    background: #eee;
    border-radius: 15px;
}

#closeContent {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 40px;
    cursor: pointer;
    color: var(--primary);
}


/* -------------------- کتاب و جزوه -------------------- */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.book-card {
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.book-card img {
    width: 100%;
    border-radius: 10px;
}

/* دکمه دانلود مشترک (کتاب/جزوه و سوالات تشریحی) — قبلاً دوبار با پدینگ متفاوت تعریف شده بود، یکی شد */
.download-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px;
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
}


/* -------------------- ویدیوها (لی‌آوت قدیمی/عمومی) -------------------- */
.youtube-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 20px;
}

.video-player {
    width: 100%;
    height: 400px;
    background: #000;
    border-radius: 15px;
}

.list-video-card {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
}

.list-video-card:hover {
    background: #f0f0f0;
}

.list-video-card img {
    width: 120px;
    height: 70px;
    border-radius: 8px;
}


/* -------------------- کلاس‌ها -------------------- */
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.class-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.class-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.class-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8em;
}

.status.open {
    background: #d4edda;
    color: #155724;
}

.status.full {
    background: #f8d7da;
    color: #721c24;
}

.register-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
}

.register-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}


/* -------------------- سوالات تشریحی -------------------- */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
}

.question-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: 0.3s;
}

.question-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.card-icon {
    font-size: 30px;
    margin-bottom: 10px;
}


/* -------------------- هدر -------------------- */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 25px; /* فاصله مناسب بین آیتم‌ها */
    padding: 0;
}

.main-nav a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: var(--accent);
}


/* -------------------- جدول کاربران -------------------- */
#usersTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-family: Tahoma, sans-serif;
    font-size: 14px;
}

#usersTable th,
#usersTable td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: right;
}

#usersTable th {
    background-color: #f4f4f4;
    font-weight: bold;
}

#usersTable tr:nth-child(even) {
    background-color: #f9f9f9;
}

#usersModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 1); /* رنگ سفید کامل که محتوای پشتش دیده نشه */
    z-index: 9999; /* بالاتر از همه لایه‌ها */
    overflow-y: auto; /* برای اسکرول کردن لیست کاربران */
    padding: 40px;
}


/* -------------------- مودال عمومی --------------------
   نکته: این فایل تنها منبع تعریف .modal-content است.
   قبلاً یک نسخه دیگر (متفاوت) هم در videos.css بود که حذف شد
   تا هنگام لود همزمان دو فایل تناقضی پیش نیاد.
*/
.modal {
    position: fixed; /* بسیار مهم: برای اینکه کل صفحه را بپوشاند */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); /* پس‌زمینه تیره */
    display: none; /* پیش‌فرض مخفی */
    justify-content: center;
    align-items: center;
    z-index: 9999; /* مودال باید روی همه چیز باشد */
}

.modal-content {
    position: relative; /* برای اینکه close-btn نسبت به این دیو موقعیت بگیرد */
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 800px;
    max-height: 90vh; /* برای اینکه اگر فیلم‌ها زیاد بود، اسکرول بخورد */
    overflow-y: auto; /* فعال کردن اسکرول عمودی */
    margin: 50px auto;
}


.full-video-flex {
    display: flex;
    flex-wrap: wrap; /* برای اینکه در موبایل و دسکتاپ مرتب شود */
    gap: 20px;
    justify-content: center;
    padding: 20px;
}

.full-video-flex .video-card {
    width: 250px; /* سایز ثابت برای کارت‌های داخل مودال */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.full-video-flex .video-card:hover {
    transform: scale(1.05);
}


/************** نمایش کامل فیلم‌ها **************/
.grid-view {
    display: flex !important; /* اجبار برای بازنویسیِ استایل قبلی */
    flex-wrap: wrap !important; /* اجازه می‌دهد فیلم‌ها به سطر بعدی بروند */
    gap: 20px !important; /* فاصله بین کارت‌ها */
    justify-content: center; /* وسط‌چین کردن کارت‌ها */
    overflow-x: visible !important; /* غیرفعال کردن اسکرول افقی */
    padding: 20px;
}

/* برای اینکه کارت‌ها در حالت گرید خیلی بزرگ یا کوچک نشوند */
.grid-view .video-card {
    min-width: 280px !important; /* عرض کارت‌ها در حالت تمام‌صفحه */
    margin: 0 !important; /* حذف مارجین‌های اضافیِ اسکرول */
}


.full-view-container {
    padding: 40px 20px;
    max-width: 1200px;
    margin: auto;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.back-btn {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}


/* -------------------- جستجو -------------------- */
.search-box {
    position: relative; /* مهم: برای چسبیدن نتایج به باکس سرچ */
}

/* باکس اصلی نتایج */
#searchResults {
    position: absolute;
    top: 55px; /* کمی پایین‌تر از اینپوت */
    right: 0;
    width: 100%;
    background: #ffffff; /* سفید تمیز */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); /* سایه نرم و جذاب */
    z-index: 9999;
    overflow: hidden; /* برای گرد شدن لبه‌های باکس */
}

/* هر آیتم نتیجه */
.result-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.3s ease; /* انیمیشن نرم */
    color: #333; /* رنگ متن تیره برای خوانایی */
    border-bottom: 1px solid #f0f0f0;
}

/* حالت هاور */
.result-item:hover {
    background: var(--accent);
    color: #ffffff; /* متن سفید می‌شود تا خوانا باشد */
    padding-right: 20px; /* یک افکتِ حرکتِ ملایم */
}

/* استایل کوچکِ دسته‌بندی */
.result-item small {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.result-item:hover small {
    color: #e8ffe8; /* رنگِ دسته‌بندی در حالتِ هاور */
}


#savedVideosModal {
    display: none; /* پیش‌فرض مخفی */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

#savedVideosModal.active {
    display: block !important; /* وقتی کلاس active می‌گیرد، حتما نمایش داده شود */
}

/* استایل‌دهی به اسکرول بار نرم و جذاب */
#avatarGrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;           /* برای فایرفاکس */
    scrollbar-color: #311b5e #f0f0f0; /* رنگ نوار و پس‌زمینه برای فایرفاکس */
}

/* اسکرول بار سفارشی برای کروم، سافاری و اج */
#avatarGrid::-webkit-scrollbar {
    width: 8px;
}

#avatarGrid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#avatarGrid::-webkit-scrollbar-thumb {
    background: #311b5e;
    border-radius: 10px;
    border: 2px solid #f1f1f1; /* ایجاد فاصله ظاهری با ترک */
}

#avatarGrid::-webkit-scrollbar-thumb:hover {
    background: #4a2a8c; /* کمی روشن‌تر هنگام هاور */
}
/* زیباتر کردن باکس مودال آواتار */
#avatarModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    /* تغییرات اصلی برای حل مشکل ارتفاع کم */
    justify-content: center;
    align-items: flex-start; /* مودال از بالا شروع بشه نه مرکز مطلق */
    overflow-y: auto;        /* اجازه اسکرول به کل مودال */
    padding: 20px 0;         /* فاصله از بالا و پایین */
}

#avatarModal > div {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin: auto; /* برای سنتر شدن */
}



/* زیباتر کردن نوار اسکرول برای کل مودال */
#editProfileModal {
    scrollbar-width: thin;
    scrollbar-color: #311b5e #f0f0f0;
}

#editProfileModal::-webkit-scrollbar {
    width: 2px; /* خیلی باریک و ظریف */
}

#editProfileModal::-webkit-scrollbar-track {
    background: transparent; /* شفاف برای اینکه با پس‌زمینه مودال یکی بشه */
}

#editProfileModal::-webkit-scrollbar-thumb {
    background-color: #311b5e; /* رنگ بنفش اصلی سایت */
    border-radius: 10px;       /* لبه‌های کاملاً گرد */
    border: 1px solid white;   /* یه حاشیه سفید برای ظرافت بیشتر */
}

#editProfileModal::-webkit-scrollbar-thumb:hover {
    background-color: #4a2a8c; /* کمی روشن‌تر هنگام هاور */
}


/* استایل یکپارچه برای همه دکمه‌های کلاس */
.btn-action {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s, background 0.3s;
}

.btn-action:hover {
    transform: scale(1.03);
}

.btn-sessions { background: #311b5e; color: white; } /* همان بنفش خفنِ خودت */
.btn-free { background: #e67e22; color: white; }    /* نارنجی پرانرژی */
.btn-register { background: #2ecc71; color: white; } /* سبز موفقیت */

.fz-package {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    width: 30%; /* اندازه بسته‌ها در ردیف */
}

.fz-package img {
    width: 100%;
    border-radius: 12px;
    border: 2px solid transparent;
}

/* افکتِ هاور: بزرگ شدن و تکان خوردن */
.fz-package:hover {
    transform: translateY(-10px) scale(1.05); /* بالا رفتن و کمی بزرگ شدن */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.package-card {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30%;
    transition: transform 0.3s ease;
}

.package-card img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.fz-label {
    margin-top: 10px;
    color: #ffb703;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(255,183,3,0.5);
    display: inline-block;
    direction: ltr; /* این خط باعث میشه ترتیب همیشه عدد بعد FZ باشه */
}

/* افکتِ هاور روی کل کارت */
.package-card:hover {
    transform: translateY(-10px);
}

.package-card:hover img {
    transform: scale(1.05);
    box-shadow: 0 15px 25px rgba(255,183,3,0.3);
}

/* استایل مودال */
.modal-content-buy {
    background: linear-gradient(145deg, #1a1a2e, #101018); /* گرادینتِ خیلی شیک */
    padding: 35px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid #333; /* یک کادرِ بسیار نازک برای ابهت بیشتر */
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* استایل دکمه بستن - مینیمال و مخفی */
.close-btn-buy {
    margin-top: 25px;
    padding: 8px 30px;
    background: transparent; /* دکمه شفاف */
    color: #888;
    border: 1px solid #444;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn-buy:hover {
    background: #333;
    color: #fff;
}

/* متن‌ها */
.modal-title { color: #f1c40f; font-size: 1.5rem; margin-bottom: 5px; }
.modal-subtitle { color: #aaa; margin-bottom: 30px; }



/* هایلایت ردیف کاربر لاگین‌شده در جدول رتبه‌بندی */
.current-user-row {
  background: linear-gradient(90deg, rgba(0, 198, 255, 0.15), rgba(0, 114, 255, 0.05)) !important;
  position: relative;
  animation: currentUserGlow 2.5s ease-in-out infinite; /* افکت درخشش نرم و تکرارشونده */
}

.current-user-row td:first-child {
  color: #00c6ff; /* رنگ عدد رتبه برای کاربر خودش، آبی روشن */
}

@keyframes currentUserGlow {
  0%, 100% {
    box-shadow: inset 0 0 8px rgba(0, 198, 255, 0.15);
  }
  50% {
    box-shadow: inset 0 0 18px rgba(0, 198, 255, 0.4); /* در وسط انیمیشن درخشش بیشتر میشه */
  }
}


#watermarkOverlay {
  position: absolute;
  pointer-events: none;
  z-index: 999999;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 1.2s ease, top 1.5s ease, left 1.5s ease;
  user-select: none;
  direction: ltr;
}

/* وقتی wrapper فول‌اسکرین شد، تمام فضا رو بگیره تا موقعیت‌دهی درست باشه */
#playerWrapper:fullscreen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
#playerWrapper:fullscreen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}