/* ==========================================================================
   استایل جامع ریسپانسیو موبایل و تبلت (صفحه اصلی، صفحات داخلی، تک‌نوشته‌ها و پنل ادمین)
   ========================================================================== */

/* دکمه انتخاب مراسم شاخص در جدول مدیریت و آرشیو */
.highlight-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #4d3538;
  background: #221a1c;
  color: #cbbab8;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.highlight-select-btn:hover {
  border-color: #c5383f;
  color: #fff;
  background: #332023;
}

.highlight-select-btn.is-active {
  background: linear-gradient(135deg, #522d12, #381f0d);
  border-color: #d98a2b;
  color: #ffd88a;
  box-shadow: 0 4px 12px rgba(217, 138, 43, 0.2);
}

.report-highlight-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  background: rgba(34, 22, 12, 0.9);
  border: 1px solid #d98a2b;
  color: #ffd88a;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

/* اسکرول افقی امن برای جدول‌های عریض ادمین */
.admin-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* دکمه منوی موبایل در نوار بالای پنل ادمین */
.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #463235;
  background: #261d1f;
  color: #f3e8e6;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* جلوگیر از اسکرول افقی ناخواسته در کل صفحات */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   ۱. تبلت‌ها و لپ‌تاپ‌های کوچک (حداکثر 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .container {
    width: min(1220px, calc(100% - 32px));
  }

  /* چیدمان‌های سه ستونه کارت‌ها در تبلت به ۲ ستون تبدیل شوند */
  .news-grid,
  .highlight-grid,
  .video-grid,
  .report-grid,
  .thought-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }

  /* صفحات داخلی تک‌نوشته (اخبار، ویدیو، گزارش، اندیشه) */
  .single-layout {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .single-sidebar {
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px !important;
  }

  /* صفحات کمک به هیئت و درباره هیئت */
  .donate-wrapper,
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 22px !important;
  }
}

/* --------------------------------------------------------------------------
   ۲. موبایل و تبلت عمودی (حداکثر 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .container {
    width: calc(100% - 28px) !important;
  }

  .section {
    padding: 36px 0 !important;
  }

  /* نوار باریک بالای سایت */
  .topline {
    font-size: 10.5px !important;
    padding: 6px 0 !important;
  }

  .topline-in {
    flex-wrap: wrap;
    gap: 6px;
  }

  .topline-in > span:first-child {
    max-width: 62%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* هدر سایت */
  .site-header .nav-wrap {
    min-height: 62px !important;
    padding: 8px 0 !important;
  }

  .brand-text b {
    font-size: 14px !important;
  }

  .brand-text small {
    font-size: 10px !important;
  }

  .site-header-logo {
    width: 38px !important;
    height: 38px !important;
  }

  /* بنر اصلی صفحه نخست */
  .hero {
    padding-top: 14px !important;
    padding-bottom: 10px !important;
  }

  .hero-link {
    border-radius: 14px !important;
  }

  .hero-link img {
    min-height: 175px !important;
    max-height: 260px !important;
    object-fit: cover !important;
  }

  /* سرتیتر بخش‌ها */
  .section-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
  }

  .section-head h2 {
    font-size: clamp(20px, 5.5vw, 26px) !important;
  }

  .section-note {
    font-size: 12.5px !important;
    line-height: 1.7 !important;
  }

  /* بخش مراسم بعدی در موبایل */
  .next-event-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .next-poster {
    max-width: 320px !important;
    width: 100% !important;
    margin: 0 auto !important;
    aspect-ratio: 3 / 4 !important;
  }

  .next-notice {
    padding: 18px 16px !important;
  }

  .next-notice h3 {
    font-size: 17px !important;
    line-height: 1.5 !important;
  }

  .next-dates-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .countdown {
    gap: 8px !important;
  }

  .countdown div {
    padding: 10px 6px !important;
  }

  .countdown b {
    font-size: 18px !important;
  }

  /* نوار فیلتر دسته‌بندی‌ها با اسکرول لمسی روان در موبایل */
  .news-filters,
  .thought-filters {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px !important;
    margin-bottom: 18px !important;
    gap: 8px !important;
    scrollbar-width: none;
  }

  .news-filters::-webkit-scrollbar,
  .thought-filters::-webkit-scrollbar {
    display: none;
  }

  .news-filter,
  .thought-filter {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    padding: 7px 14px !important;
  }

  /* تک‌ستونه شدن کارت‌ها در موبایل */
  .news-grid,
  .highlight-grid,
  .video-grid,
  .report-grid,
  .thought-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .news-card > img {
    height: 195px !important;
  }

  .news-card-body {
    padding: 16px !important;
  }

  .news-card h3 {
    font-size: 15.5px !important;
  }

  /* پلیر صوتی اختصاصی در صفحه گزارش مراسمات */
  .heyat-custom-player {
    padding: 14px !important;
  }

  .hcp-main {
    gap: 10px !important;
  }

  .hcp-title {
    font-size: 13px !important;
  }

  .hcp-actions-row {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .hcp-download-btn {
    width: 100%;
    justify-content: center;
  }

  /* پخش زنده در موبایل */
  .live-offline-wrap {
    min-height: 300px !important;
  }

  .live-offline-overlay {
    padding: 20px 16px !important;
  }

  .live-offline-overlay h3 {
    font-size: 17px !important;
  }

  .live-offline-overlay p {
    font-size: 12.5px !important;
  }

  /* صفحه کمک به هیئت و کارت بانکی در موبایل */
  .donate-info-card,
  .bank-card-visual {
    padding: 20px 16px !important;
    border-radius: 16px !important;
  }

  .card-digits {
    font-size: clamp(15px, 4.8vw, 21px) !important;
    letter-spacing: 1px !important;
    padding: 12px 8px !important;
  }

  .card-details-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .iban-box {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    word-break: break-all !important;
    font-size: 11.5px !important;
  }

  /* صفحه درباره هیئت */
  .about-main-text,
  .about-units-sidebar {
    padding: 20px 16px !important;
  }

  /* صفحات داخلی تک‌نوشته (Single Post / Video / Report / Thought) */
  .single-page-section {
    padding: 22px 0 44px !important;
  }

  .single-breadcrumb {
    font-size: 11px !important;
    padding: 10px 12px !important;
    margin-bottom: 16px !important;
    overflow-x: auto;
    white-space: nowrap;
  }

  .single-article-card {
    padding: 18px 15px !important;
    border-radius: 16px !important;
  }

  .single-title {
    font-size: clamp(18px, 5.2vw, 24px) !important;
    line-height: 1.55 !important;
  }

  .single-lead {
    padding: 12px 14px !important;
    font-size: 13px !important;
    line-height: 1.8 !important;
  }

  .single-meta-row {
    gap: 8px 12px !important;
    font-size: 11px !important;
    padding: 10px 0 !important;
  }

  .single-body {
    font-size: 14px !important;
    line-height: 2 !important;
  }

  .single-share-box {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  .single-share-box button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* شناسنامه گزارش مراسم و گالری در صفحه تک‌گزارش */
  .report-info-banner {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  .report-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .report-gallery-item img {
    height: 130px !important;
  }

  .thought-quote-box {
    padding: 16px !important;
    font-size: 14px !important;
  }

  /* مودال‌ها در موبایل */
  .login-box,
  .photo-modal-box {
    width: calc(100% - 24px) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 22px 16px !important;
    border-radius: 16px !important;
  }

  /* پنل مدیریت ادمین در موبایل */
  .admin-mobile-menu-btn {
    display: inline-flex !important;
  }

  .admin-shell {
    grid-template-columns: 1fr !important;
  }

  .admin-sidebar {
    position: fixed !important;
    top: 0;
    right: 0;
    bottom: 0;
    width: 270px !important;
    z-index: 2000;
    transform: translateX(105%);
    transition: transform 0.25s ease;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-topbar {
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-content {
    padding: 14px !important;
  }

  .admin-welcome {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 16px !important;
  }

  .admin-welcome > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .admin-form,
  .taxonomy-grid {
    grid-template-columns: 1fr !important;
  }

  .panel-card {
    padding: 14px !important;
  }

  .panel-card-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .admin-subnav {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 6px !important;
    gap: 6px !important;
  }

  .subnav-tab {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 11.5px !important;
  }

  .messenger-item-card {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .messenger-item-actions {
    width: 100%;
    justify-content: flex-start !important;
  }

  #dynamicAudiosList .dynamic-row,
  #dynamicVideosList .dynamic-row {
    grid-template-columns: 1fr !important;
  }
}

/* --------------------------------------------------------------------------
   ۳. گوشی‌های موبایل کوچک (حداکثر 420px)
   -------------------------------------------------------------------------- */
@media (max-width: 420px) {
  .topline-in > span:first-child {
    display: none;
  }

  .topline-in {
    justify-content: space-between;
    width: 100%;
  }

  .report-gallery-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  .countdown {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  .countdown b {
    font-size: 16px !important;
  }
}
