/* ═══════════════════════════════════════════════════
   网文工坊 · Responsive Styles
   ═══════════════════════════════════════════════════ */

/* Tablets (≤900px) — collapse sidebar */
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    display: none;
    position: fixed; z-index: 200;
    top: var(--topbar-height); left: 0; bottom: 0;
    width: 240px; min-width: 240px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { display: flex; }
  .main-content { padding: 14px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-card-icon { font-size: 22px; }
  .stat-num { font-size: 22px; }

  /* Mobile menu toggle button */
  .topbar-brand { gap: 8px; }
  .topbar-brand::before {
    content: '☰'; font-size: 20px; cursor: pointer; color: var(--text-secondary);
    padding: 2px 6px; border-radius: 4px; line-height: 1;
  }
  .topbar-brand::before:hover { background: var(--bg-surface); }
}

/* Phones (≤640px) */
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .brand-title { font-size: 14px; }
  .brand-icon { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }

  .app-layout { flex-direction: column; }
  .main-content { padding: 12px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat-card { padding: 10px 12px; gap: 10px; }
  .stat-card-icon { font-size: 20px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 9.5px; }

  .chapter-row {
    flex-wrap: wrap; gap: 8px; padding: 12px 14px;
  }
  .chapter-actions { width: 100%; justify-content: flex-end; }
  .chapter-preview { max-width: 180px; }

  .modal { max-width: 96vw; margin: 0 8px; }
  .modal-body { padding: 14px 16px; font-size: 13px; }
  .modal-header h2 { font-size: 13px; }

  .form-row { flex-direction: column; }
  .form-row .btn { width: 100%; justify-content: center; }

  .toast {
    bottom: 16px; right: 16px; left: 16px;
    max-width: none; font-size: 12px;
  }

  .flex-between { flex-direction: column; align-items: stretch; }
  .flex-between .btn { justify-content: center; }

  .panel { padding: 14px; }
  .panel-header { font-size: 12px; }

  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 5px 8px; font-size: 10px; }

  .tabs { gap: 4px; }
  .tab { padding: 7px 11px; font-size: 11px; }
}

/* Very small phones (≤380px) */
@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 5px; }
  .stat-num { font-size: 18px; }
  .chapter-actions { flex-wrap: wrap; }
}
