/* ===== MOBILE RESPONSIVE ===== */

/* Tabs scrollable horizontalement */
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex-shrink: 0; }

@media (max-width: 768px) {
  /* Layout */
  .container { padding: 0.75rem; }

  /* Header */
  .header { padding: 1rem; margin-bottom: 1rem; border-radius: 10px; }
  .header-title { font-size: 1.35rem; }
  .header-content > div:last-child {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  .header-content > div:last-child .btn,
  .header-content > div:last-child label.btn {
    font-size: 0.78rem;
    padding: 0.5rem 0.6rem;
    justify-content: center;
    width: 100%;
    margin: 0;
  }
  /* badge status full width */
  #statusBadge { grid-column: 1 / -1; text-align: center; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
  .stat-card { padding: 1rem; }
  .stat-card-value { font-size: 1.4rem; }

  /* Tabs */
  .tabs { padding-bottom: 0; border-bottom: none; margin-bottom: 0; }
  .tab { padding: 0.7rem 0.9rem; font-size: 0.78rem; }
  /* Scrollbar indicator */
  .tabs-wrapper {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Main card */
  .card { padding: 0.75rem; border-radius: 10px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  /* Toolbar flux */
  .flex-between { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .search-bar { max-width: 100% !important; width: 100%; }

  /* Buttons toolbar */
  #tab-fluxes .flex.gap-1 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
    gap: 0.35rem;
  }
  #tab-fluxes .flex.gap-1 button { font-size: 0.72rem; padding: 0.4rem 0.3rem; }

  /* Filters selects */
  #filterCategory, #filterSource { width: 100%; }

  /* Flux rows */
  .flux-row { flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 0.75rem; }
  .flux-row-name { max-width: 100%; min-width: 0; font-size: 0.82rem; flex-basis: 100%; }
  .flux-row-url { display: none; }
  .flux-row-actions { margin-left: 0; width: 100%; justify-content: flex-end; }

  /* Tables */
  .table-container { margin: 0 -0.75rem; }
  .table th, .table td { padding: 0.6rem 0.5rem; font-size: 0.78rem; }
  /* Hide less important columns on very small screens */
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }

  /* Form row → single column */
  .form-row { grid-template-columns: 1fr; }
  .form-group { margin-bottom: 1rem; }

  /* Modal full-screen on mobile */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    padding: 1.25rem;
  }

  /* Settings sub-nav */
  #ssec-account ~ div,
  [id^="ssec-"] {
    /* handled individually */
  }
  #tab-settings > div:first-child {
    gap: 0.3rem;
  }
  #tab-settings > div:first-child button {
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
  }

  /* Catalog grid */
  .catalog-grid { grid-template-columns: 1fr; }

  /* Archive tab */
  #tab-archive .flex.gap-1 { flex-direction: column; width: 100%; }
  #tab-archive .flex.gap-1 input,
  #tab-archive .flex.gap-1 select { max-width: 100%; width: 100%; }

  /* Toast */
  .toast-container { top: auto; bottom: 1rem; left: 0.75rem; right: 0.75rem; }
  .toast { min-width: auto; }

  /* Admin codes d'invitation */
  #ssec-admin > div > div[style*="display:flex"] { flex-direction: column; }

  /* Stats page */
  #detailedStats .flex-between { flex-direction: column; align-items: flex-start; }

  /* Header dropdowns full width on mobile */
  #exportMenu, #userMenu, #themePickerMenu {
    right: auto;
    left: 0;
    min-width: 90vw;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .stats-grid { grid-template-columns: 1fr; }
  .header-content > div:last-child { grid-template-columns: 1fr; }
  .tab { font-size: 0.72rem; padding: 0.6rem 0.7rem; }
  .btn { font-size: 0.8rem; }
  .stat-card-value { font-size: 1.2rem; }
  #tab-fluxes .flex.gap-1 { grid-template-columns: 1fr 1fr; }
}
/* Survols (ex-onmouseover inline, interdits par la CSP) */
.theme-card:hover { transform: translateY(-2px); }
.arch-row:hover { background: var(--bg-hover, rgba(255,255,255,.05)); }
