/* ===========================
   RESPONSIVE — MOBILE FIRST
   breakpoints: 768px mobile, 1024px tablet
   =========================== */

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  align-items: center;
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: none;
  flex-direction: column;
  gap: 5px;
  height: 42px;
  justify-content: center;
  padding: 0 0.7rem;
  width: 46px;
}

.hamburger-btn span {
  background: var(--color-text);
  border-radius: 2px;
  display: block;
  height: 2px;
  transition: opacity 0.2s;
  width: 20px;
}

/* Sidebar close button — hidden on desktop */
.sidebar-close-btn {
  align-items: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  display: none;
  font-size: 1.25rem;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

.sidebar-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

/* Overlay behind mobile sidebar */
.sidebar-overlay {
  background: rgba(15, 23, 42, 0.4);
  bottom: 0;
  display: none;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 45;
}

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

/* Landing hamburger — hidden on desktop */
.landing-hamburger {
  display: none;
}

/* ===========================
   TABLET (769 – 1024px)
   =========================== */
@media (max-width: 1024px) and (min-width: 769px) {
  .dashboard-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .hero-section {
    grid-template-columns: 1fr;
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 3rem);
  }

  .hero-card {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 4.5vw, 3.5rem);
  }

  .landing-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .landing-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===========================
   MOBILE (≤ 768px)
   =========================== */
@media (max-width: 768px) {
  /* ── Landing page ── */

  .landing-header {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .landing-header nav.landing-nav {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    left: 0;
    padding: 0.75rem 1rem 1rem;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
  }

  .landing-header nav.landing-nav.menu-open {
    display: flex;
  }

  .landing-hamburger {
    align-items: center;
    background: none;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 42px;
    justify-content: center;
    padding: 0 0.7rem;
    width: 46px;
  }

  .landing-hamburger span {
    background: var(--color-text);
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 20px;
  }

  .hero-section {
    grid-template-columns: 1fr;
    padding: 2.5rem 1.25rem;
  }

  .hero-card {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .landing-section {
    padding: 0 1.25rem 3rem;
  }

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

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

  .landing-cta {
    flex-direction: column;
    align-items: flex-start;
    margin: 0 1.25rem 3rem;
  }

  .landing-cta .btn {
    align-self: flex-start;
  }

  .landing-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .landing-footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .landing-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  /* ── Dashboard ── */

  .dashboard-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .dashboard-sidebar {
    border-bottom: none;
    border-left: none;
    bottom: 0;
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.12);
    display: none;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    width: 288px;
    z-index: 50;
  }

  .dashboard-sidebar.sidebar-open {
    display: block;
  }

  .sidebar-close-btn {
    display: flex;
  }

  .hamburger-btn {
    display: flex;
  }

  .dashboard-main {
    padding: 1rem;
  }

  .dashboard-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .dashboard-topbar h1 {
    font-size: 1.25rem;
  }

  /* ── Grids ── */

  .dashboard-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .split-panel {
    grid-template-columns: 1fr;
  }

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

  /* ── Section header ── */

  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  /* ── Tables ── */

  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .data-table {
    min-width: 640px;
  }

  /* ── Forms ── */

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

  .action-row {
    flex-direction: column;
  }

  .action-row .btn {
    width: 100%;
  }

  /* ── Report card print ── */

  .report-card-actions {
    display: none;
  }

  /* ── Exam ── */

  .exam-layout {
    grid-template-columns: 1fr;
  }

  .exam-sidebar-panel {
    order: -1;
  }

  /* ── Usage chart ── */

  .usage-chart {
    height: 100px;
  }
}

/* ===========================
   PRINT STYLES (report card)
   =========================== */
@media print {
  /* Hide navigation and UI chrome */
  .dashboard-sidebar,
  .dashboard-topbar,
  .report-card-actions,
  .section-header .btn,
  .section-header .action-row,
  .sidebar-overlay,
  .topbar-btn,
  nav,
  header,
  footer {
    display: none !important;
  }

  body {
    background: white !important;
    color: #111 !important;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-size: 11pt;
    margin: 0;
    padding: 0;
    direction: rtl;
  }

  .dashboard-shell {
    display: block !important;
    min-height: unset;
  }

  .dashboard-main {
    padding: 1cm 1.5cm !important;
    max-width: 100% !important;
  }

  /* Page setup */
  @page {
    size: A4 portrait;
    margin: 1.5cm 2cm;
  }

  /* Card layout for print */
  .panel-card {
    box-shadow: none !important;
    border: 1px solid #bbb !important;
    background: white !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1rem;
  }

  /* Report card table */
  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #999 !important;
    padding: 0.4rem 0.6rem;
    text-align: right;
  }

  .data-table th {
    background: #f5f5f5 !important;
    font-weight: 700;
    color: #111 !important;
  }

  .data-table tbody tr:nth-child(even) {
    background: #fafafa !important;
  }

  /* Metric cards in print */
  .metric-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: white !important;
    break-inside: avoid;
    border-radius: 0 !important;
  }

  .metric-card strong {
    font-size: 1.4rem !important;
    color: #111 !important;
  }

  /* Dashboard grid compact for print */
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
  }

  /* Table wrap no overflow in print */
  .table-wrap {
    overflow: visible !important;
  }

  /* Section header in print */
  .section-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid #111;
    padding-bottom: 0.5rem;
  }

  .section-header h2 {
    font-size: 14pt;
    color: #111 !important;
  }

  .section-header p {
    color: #555 !important;
    font-size: 10pt;
  }

  /* Links as plain text */
  a {
    color: #111 !important;
    text-decoration: none !important;
  }

  /* Status pills */
  .badge,
  .status-pill {
    border: 1px solid #999 !important;
    background: transparent !important;
    color: #111 !important;
    font-size: 9pt;
  }
}
