/* ============================================================
   mobile.css — Responsive fixes for ManageQuery
   Place in: public_html/css/mobile.css
   Add to board.html AND login.html AFTER style.css:
   <link rel="stylesheet" href="css/mobile.css">
   ============================================================ */

/* ── Back button (mobile only, hidden on desktop) ─── */
.btn-back-mobile {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   MOBILE  ≤ 640px
   ═══════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Header ── */
  .header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-title { font-size: 14px; }
  .header-sub   { font-size: 11px; }
  .user-badge   { font-size: 11px; padding: 3px 8px; }
  .header-right { gap: 7px; }
  .header-right .btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* ── Session bar ── */
  .session-bar {
    padding: 8px 14px;
    font-size: 12px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .session-active, .session-none { font-size: 12px; }

  /* ── Stats row: 2 columns on mobile ── */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 14px 0;
  }
  .stat-card  { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }

  /* ── Search ── */
  .search-row { padding: 10px 14px 0; }
  .search-row input { max-width: 100%; font-size: 13px; }

  /* ── Main layout: stack vertically ── */
  .main {
    display: block;
    padding: 10px 14px 80px; /* extra bottom for chat button */
  }

  /* ── Card grid ── */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }
  /* When panel is open on mobile — hide the grid */
  .grid.panel-open {
    display: none;
  }

  /* ── Card ── */
  .card { padding: 12px; }
  .card-name  { font-size: 12px; }
  .card-topic { font-size: 10px; margin-bottom: 8px; }
  .avatar { width: 36px; height: 36px; font-size: 12px; margin-bottom: 8px; }
  .count-badge { font-size: 9px; padding: 2px 6px; }

  /* ── Side panel: full width on mobile ── */
  .panel {
    width: 100% !important;
    border-radius: 12px;
    margin-top: 0;
  }
  .panel-body {
    max-height: 65vh;
  }

  /* Show back button on mobile ── */
  .btn-back-mobile {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
  }

  /* ── Panel header: compact ── */
  .panel-header { padding: 12px 14px; }
  .panel-name   { font-size: 14px; }
  .panel-topic  { font-size: 11px; }

  /* ── Add doubt box ── */
  .add-doubt-box { padding: 12px; }
  .add-doubt-box h4 { font-size: 12px; }

  /* ── Filter tabs ── */
  .filter-tabs { gap: 4px; }
  .filter-tab  { padding: 4px 10px; font-size: 10px; }

  /* ── Doubt items ── */
  .doubt-item   { padding: 10px; }
  .doubt-question { font-size: 12px; }
  .doubt-status { font-size: 9px; }
  .doubt-time   { font-size: 10px; }

  /* ── Buttons in doubt actions ── */
  .teacher-actions .btn,
  .doubt-item .btn {
    font-size: 11px;
    padding: 7px 12px;
    min-height: 36px;
  }

  /* ── Session modal ── */
  .modal { padding: 20px 16px; margin: 0 12px; }
  .modal h3 { font-size: 14px; }

  /* ── Chat panel: full width, slide from bottom ── */
  .chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100% !important;
    height: 70vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }
  .chat-toggle {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }

  /* ── Login page ── */
  .login-card {
    padding: 24px 18px;
    margin: 16px;
    max-width: 100%;
  }
  .login-logo h1 { font-size: 18px; }
  .tab-btn { font-size: 13px; }

  /* ── Tip box ── */
  .tip-box { font-size: 11px; padding: 8px 10px; }

  /* ── Image preview ── */
  .doubt-image img { max-height: 160px; }
}

/* ═══════════════════════════════════════════════════════
   SMALL MOBILE  ≤ 380px  (very small phones)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 380px) {

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px 0;
  }
  .stat-value { font-size: 16px; }

  .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .main { padding: 8px 10px 80px; }

  .header { padding: 8px 10px; }
  .header-title { font-size: 13px; }

  .panel-body { max-height: 60vh; }
}

/* ═══════════════════════════════════════════════════════
   TABLET  641px – 900px
   ═══════════════════════════════════════════════════════ */
@media (min-width: 641px) and (max-width: 900px) {

  .stats-row { grid-template-columns: repeat(4, 1fr); gap: 8px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .grid.panel-open { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  .panel { width: 340px !important; }

  .chat-panel { width: 320px !important; }
}
