/**
 * TaskFlow | تسک‌فلو
 * استایل‌های واکنش‌گرا برای تبلت، موبایل و انواع نمایشگرها
 * سازگار با طراحی Premium Dark Glassmorphism و RTL
 */

/* ==================== لپ‌تاپ‌های متوسط و کوچک (زیر ۱۲۰۰ پیکسل) ==================== */
@media (max-width: 1200px) {
  .analytics-hub {
    grid-template-columns: 320px 1fr;
    gap: 16px;
  }

  .analytics-hub .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .hero-banner-card {
    padding: 28px 30px;
    gap: 20px;
  }

  .hero-visual {
    width: 260px;
    height: 180px;
  }
}

/* ==================== تبلت و لپ‌تاپ‌های کوچک (زیر ۱۰۲۴ پیکسل) ==================== */
@media (max-width: 1024px) {
  .analytics-hub {
    grid-template-columns: 1fr;
    gap: 16px;
  }

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

  .dashboard-split-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .search-box {
    width: 240px;
  }
}

/* ==================== تبلت و موبایل (زیر ۷۶۸ پیکسل) ==================== */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  /* منوی کناری به شکل کشو (Drawer) در موبایل با جلوه شیشه‌ای تاریک */
  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    box-shadow: -8px 0 35px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    background: rgba(16, 19, 26, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .sidebar:not(.sidebar-open) {
    display: none;
  }

  .sidebar.sidebar-open {
    display: flex;
    transform: translateX(0);
  }

  /* لایه تیره پس‌زمینه در زمان باز شدن منوی موبایل */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(4, 6, 10, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .app-container {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  /* بدنه اصلی بدون حاشیه کناری */
  .main-wrapper {
    margin-inline-start: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  /* سربرگ در موبایل */
  .app-header {
    padding: 0 16px;
    gap: 10px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
  }

  .header-start {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .mobile-menu-btn {
    display: inline-flex !important;
  }

  .header-desc {
    display: none;
  }

  .header-title {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* پنهان‌سازی دکمه کار جدید در هدر و تنظیم جعبه جست‌وجو */
  .header-new-btn {
    display: none !important;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .search-box {
    width: 130px;
    max-width: 130px;
    flex-shrink: 0;
  }

  .search-input {
    padding: 7px 10px;
    padding-inline-start: 30px;
    font-size: 0.82rem;
  }

  .search-icon {
    width: 14px;
    height: 14px;
    inset-inline-start: 9px;
  }

  .app-main {
    padding: 16px 14px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    min-width: 0;
    overflow-x: hidden;
  }

  /* بنر محصول در موبایل */
  .hero-banner-card {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 18px;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .hero-banner-content {
    max-width: 100%;
    width: 100%;
  }

  .hero-visual {
    display: none !important; /* جهت صرفه‌جویی در فضای صفحه موبایل */
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .hero-desc {
    font-size: 0.92rem;
  }

  .hero-actions {
    width: 100%;
  }

  .btn-hero-glass {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.98rem;
  }

  /* هاب شاخص‌ها و کارت پیشرفت در تبلت و موبایل */
  .analytics-hub {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    gap: 14px;
  }

  .analytics-hub .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .progress-feature-card {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 20px;
    gap: 14px;
  }

  .dashboard-split-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    gap: 16px;
  }

  .progress-rate-text {
    font-size: 1.65rem;
  }

  .progress-pills-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .prog-pill {
    font-size: 0.78rem;
    padding: 4px 6px;
  }

  /* نوار فیلترها */
  .toolbar-card {
    padding: 14px 16px;
  }

  .priority-chips-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .priority-chips-group {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .priority-chip {
    padding: 5px 11px;
    font-size: 0.8rem;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-group {
    justify-content: space-between;
    width: 100%;
  }

  .filter-select {
    flex-grow: 1;
    max-width: 65%;
  }

  .filter-actions {
    width: 100%;
  }

  .filter-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* کارت وظیفه در موبایل */
  .task-card {
    padding: 14px 16px;
  }

  .task-card-main {
    gap: 12px;
  }

  .task-title {
    font-size: 0.98rem;
  }

  .task-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .task-actions {
    margin-inline-start: auto;
  }

  .task-subtasks-summary {
    gap: 8px;
  }

  .subtasks-ratio-badge {
    font-size: 0.78rem;
  }

  /* فرم‌های مودال در موبایل */
  .modal {
    padding: 10px;
  }

  .modal-dialog {
    max-height: calc(100vh - 20px);
    overflow: hidden;
  }

  .modal-header-unified {
    flex-wrap: wrap;
    gap: 8px;
  }

  .unified-tabs-wrapper {
    order: 2;
    width: 100%;
    justify-content: stretch;
  }

  .unified-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .form-grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-header,
  .modal-footer {
    padding: 16px 18px;
  }

  /* پیام‌های Toast در موبایل */
  .toast-container {
    inset-inline-start: 16px;
    inset-inline-end: 16px;
    inset-block-end: 16px;
    max-width: none;
  }
}

/* ==================== دستگاه‌های همراه و گوشی‌ها (زیر ۶۴۰ پیکسل) ==================== */
@media (max-width: 640px) {
  .search-box {
    display: none !important;
  }

  .header-date-badge {
    display: none !important;
  }

  .progress-pills-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== گوشی‌های کوچک (زیر ۴۸۰ پیکسل) ==================== */
@media (max-width: 480px) {
  .search-box {
    display: none; /* تمرکز کامل بر محتوا در صفحات بسیار کوچک */
  }

  .analytics-hub .stats-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .progress-pills-row {
    grid-template-columns: 1fr;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .task-footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==================== انطباق برنامه هفتگی دانشگاه در تبلت و موبایل ==================== */
@media (max-width: 1024px) {
  .schedule-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .schedule-toolbar-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .schedule-category-chips-bar {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }

  .schedule-category-chips-group {
    flex-wrap: nowrap;
  }

  .schedule-toolbar-bottom-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .schedule-toolbar-start,
  .schedule-view-switcher {
    width: 100%;
  }

  .btn-switch-tab {
    flex: 1;
    justify-content: center;
  }

  .schedule-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .schedule-toolbar-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .countdown-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .countdown-timer-badge {
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
  }

  .live-event-sub-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .schedule-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .schedule-cards-grid {
    grid-template-columns: 1fr;
  }

  .schedule-card {
    padding: 14px 16px;
  }

  .schedule-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .schedule-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-create-class-task {
    width: 100%;
    justify-content: center;
  }

  .schedule-card-actions {
    margin-inline-start: auto;
  }

  .overview-today-classes-grid {
    grid-template-columns: 1fr;
  }

  .overview-schedule-off-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .overview-schedule-off-banner .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .schedule-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== واکنش‌گرایی تقویم شمسی و تایمر پومودورو ==================== */
@media (max-width: 768px) {
  .jalali-weekdays-row {
    font-size: 0.76rem;
  }

  .cal-day-cell {
    min-height: 44px;
    padding: 4px 2px;
  }

  .cal-day-num {
    font-size: 0.84rem;
  }

  .header-date-badge {
    display: none;
  }

  .pomodoro-timer-visual {
    width: 220px;
    height: 220px;
  }

  .pomodoro-time-display {
    font-size: 2.6rem;
  }

  .pomodoro-mode-pills {
    width: 100%;
  }

  .pomodoro-pill {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .cal-day-cell {
    min-height: 38px;
  }

  .cal-day-num {
    font-size: 0.78rem;
  }

  .pomodoro-controls {
    flex-direction: column;
    width: 100%;
  }

  .pomodoro-btn-main,
  .pomodoro-btn-sec {
    width: 100%;
    justify-content: center;
  }
}


