/* ================================================================
   ADMIN-RESPONSIVE.CSS
   Responsive layer for admin panel — append to style.css
   or link AFTER style.css în admin-layout.ejs
   
   Breakpoints:
     ≤ 900px  — sidebar → top bar orizontal + sticky
     ≤ 640px  — form grid single column, form-actions stacked
     ≤ 520px  — table → card pattern, row-actions stacked
   ================================================================ */

/* ── 900px: Sidebar devine top bar ───────────────────────────── */
@media (max-width: 900px) {

  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    min-height: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.25rem;

    /* Horizontal layout */
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;

    /* Sticky la scroll */
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
  }

  /* Brand + nav pe același rând */
  .admin-brand {
    flex-shrink: 0;
    line-height: 1.2;
  }

  .admin-brand strong {
    display: inline;
    margin-top: 0;
    margin-left: 0.35em;
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.15rem;
    flex: 1;
  }

  .admin-nav a {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
  }

  /* Logout împins la dreapta */
  .admin-nav-logout {
    margin-top: 0;
    margin-left: auto;
  }

  /* Main area: reduce padding lateral */
  .admin-main {
    padding: 1.75rem 1.5rem;
    max-width: 100%;
  }

  .admin-page-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
  }
}

/* ── 640px: Form grid → coloană unică ────────────────────────── */
@media (max-width: 640px) {

  .admin-main {
    padding: 1.25rem 1rem;
  }

  /* Form grid: orice variație cade pe 1 coloană */
  .form-grid,
  .sec-grid {
    grid-template-columns: 1fr !important;
  }

  /* Secțiunile de form mai compacte */
  .form-section {
    margin-bottom: 1.5rem;
  }

  /* Form actions: butoane full-width stacked */
  .form-actions {
    flex-direction: column;
    gap: 0.65rem;
  }

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

  /* Dash actions: stivuite vertical pe telefoane mici */
  .dash-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .dash-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* Add section bar (issue-form): butoane puțin mai mari pe touch */
  .add-section-bar {
    gap: 0.4rem;
  }

  .add-section-bar button {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    touch-action: manipulation;
  }

  /* Flash messages mai compacte */
  .flash {
    font-size: 0.82rem;
    padding: 0.65rem 0.85rem;
  }

  /* Diptic (two-images) în sections builder */
  .sb-diptic {
    flex-direction: column;
  }
}

/* ── 520px: Table → card pattern ─────────────────────────────── */
@media (max-width: 520px) {

  /* Ascunde header-ul tabelului */
  .issues-table thead {
    display: none;
  }

  /* Fiecare rând devine card */
  .issues-table,
  .issues-table tbody,
  .issues-table tr {
    display: block;
    width: 100%;
  }

  .issues-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    padding: 0.75rem 1rem;
  }

  /* Anulăm hover-ul de tabel (nu mai e tr> td) */
  .issues-table tr:hover td {
    background: transparent;
  }

  /* Fiecare celulă: block cu label înainte */
  .issues-table td {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: none;
    font-size: 0.875rem;
  }

  /* Label generat din data-label */
  .issues-table td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    width: 80px;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.15em;
    line-height: 1.4;
  }

  /* Celula Titlu: permite wrap */
  .issues-table td:first-child {
    align-items: flex-start;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
  }

  /* Celula Acțiuni: fără label, butoane wrap */
  .issues-table td[data-label="Acțiuni"] {
    padding-top: 0.5rem;
  }

  .issues-table td[data-label="Acțiuni"]::before {
    display: none;
  }

  /* Row actions pe mobil: wrap */
  .row-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }

  .row-actions .btn,
  .row-actions button {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.8rem;
    padding: 0.5rem 0.65rem;
    touch-action: manipulation;
  }

  /* Slug mai mic pe mobil */
  .issue-slug {
    font-size: 0.68rem;
    word-break: break-all;
  }

  /* Badge status: inline */
  .issues-table td[data-label="Status"] {
    align-items: center;
  }

  /* Empty state mai compact */
  .empty-state {
    padding: 2.5rem 1rem;
    font-size: 0.875rem;
  }
}

/* ── Focus vizibil pe touch (accesibilitate) ──────────────────── */
@media (max-width: 900px) {
  .field input:focus,
  .field select:focus,
  .field textarea:focus,
  .sb-input:focus,
  .sb-textarea:focus {
    outline: 2px solid var(--sienna);
    outline-offset: 1px;
  }

  /* Input-uri mai ușor de atins */
  .field input,
  .field select,
  .field textarea {
    font-size: 1rem; /* previne zoom automat iOS */
    min-height: 44px;
  }

  .field textarea {
    min-height: 90px;
  }

  /* Butoane touch-friendly */
  .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }
}