/* ═══════════════════════════════════════════════════════
   RESPONSIVE.CSS — Mobile & Tablet fixes pentru zmxclr
   Adaugă <link> după app.css în header.php
   ═══════════════════════════════════════════════════════ */

/* ── 1. SIDEBAR OVERLAY (backdrop când meniul e deschis) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  cursor: pointer;
}
body.sidebar-open .sidebar-overlay {
  display: block;
}

/* ── 2. SIDEBAR CLOSE BUTTON (X pe mobil) ── */
.sidebar-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  place-items: center;
  z-index: 10;
}

/* ── 3. SIDEBAR TOGGLE — mai vizibil, touch target mai mare ── */
.sidebar-toggle {
  min-width: 42px;
  min-height: 42px;
  font-size: 18px;
  flex-shrink: 0;
}

/* ── 4. SCROLL HORIZONTAL pe tabele — indicator vizibil ── */
.table-wrap {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--blue-dim) var(--panel);
  position: relative;
}
.table-wrap::after {
  content: '';
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(to left, var(--bg2) 10%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* ── 5. TABLET (≤ 980px) ── */
@media (max-width: 980px) {

  /* Sidebar — slide-in corect */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(300px, 88vw);
    height: 100dvh;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-110%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  }

  .sidebar-close {
    display: grid;
  }

  .sidebar-toggle {
    display: inline-grid;
    place-items: center;
  }

  /* Main area ocupă tot */
  .app-shell {
    grid-template-columns: 1fr;
  }

  /* Topbar mai compact */
  .topbar {
    gap: 10px;
    padding: 10px 16px;
    min-height: 56px;
  }

  .topbar__meta {
    gap: 5px;
  }

  /* Pills mai mici pe tabletă */
  .pill {
    font-size: 11px;
    padding: 3px 9px;
  }

  /* Stats 2 coloane */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Table fade gradient pe dreapta */
  .table-wrap::after {
    display: block;
  }
}

/* ── 6. MOBIL (≤ 640px) ── */
@media (max-width: 640px) {

  /* Body — previne scroll când sidebar e deschis */
  body.sidebar-open {
    overflow: hidden;
  }

  /* Topbar stivuit */
  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }

  .topbar > div:not(.topbar__meta) {
    flex: 1;
    min-width: 0;
  }

  .topbar__meta {
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
    padding-top: 2px;
    border-top: 1px solid var(--border);
    order: 10;
  }

  /* Ascunde data pe telefoane foarte mici */
  .topbar__meta .pill:last-child {
    display: none;
  }

  /* Page heading mai mic */
  .page-heading {
    font-size: 17px;
  }

  .eyebrow {
    font-size: 9px;
  }

  /* Content padding mai mic */
  .content {
    padding: 10px;
    gap: 10px;
  }

  /* Stats — o coloană */
  .stats-grid,
  .stats-grid--mini {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Stat value mai mic pe telefon */
  .stat-card__value {
    font-size: 32px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  /* Cards grid — o coloană */
  .cards-grid,
  .cards-grid--events {
    grid-template-columns: 1fr;
  }

  /* Profile grid — o coloană */
  .profile-grid {
    grid-template-columns: 1fr;
  }

  /* Panel card padding mai mic */
  .panel-card {
    padding: 14px;
  }

  /* Filters — toate full width */
  .filters > *,
  .form-grid > label {
    grid-column: span 12 !important;
  }

  /* Butoane full-width pe mobil */
  .action-grid {
    flex-direction: column;
  }
  .action-grid .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 13px;
  }

  /* Butoane mai ușor de apăsat (touch) */
  .btn {
    min-height: 42px;
    touch-action: manipulation;
  }

  /* Inputs mai mari pe touch */
  .input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px !important; /* previne zoom pe iOS */
    padding: 10px 12px;
  }

  /* Section head stivuit */
  .section-head {
    flex-direction: column;
    gap: 8px;
  }
  .section-head h2 {
    font-size: 15px;
  }

  /* Footer stivuit */
  .footer {
    flex-direction: column;
    text-align: center;
    gap: 6px;
    padding: 12px;
  }

  /* Pagination — touch friendly */
  .pagination__item {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  /* Table wrap scroll indicator */
  .table-wrap::after {
    display: block;
  }

  /* Badge mai mic */
  .badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  /* Brand card pe mobil */
  .brand-card {
    padding: 14px 12px;
  }

  /* Sidebar brand actions */
  .brand-actions {
    display: flex;
    gap: 6px;
  }
  .brand-actions .btn {
    flex: 1;
    min-height: 38px;
    font-size: 11px;
    padding: 7px 8px;
  }

  /* Auth card pe mobil */
  .auth-card {
    width: 100%;
  }
  .auth-shell {
    min-height: auto;
    padding: 20px 0;
  }

  /* Event card meta stivuit */
  .event-card__meta {
    flex-direction: column;
    gap: 4px;
  }

  /* Copy box mai mic */
  .copy-box {
    font-size: 11px;
    word-break: break-all;
    padding: 10px 12px;
  }
}

/* ── 7. MOBIL FOARTE MIC (≤ 380px) ── */
@media (max-width: 380px) {

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

  .page-heading {
    font-size: 15px;
  }

  .stat-card__value {
    font-size: 28px;
  }

  .content {
    padding: 8px;
  }
}

/* ── 8. LANDSCAPE MOBIL (telefon întors) ── */
@media (max-height: 500px) and (max-width: 900px) {
  .sidebar {
    overflow-y: auto;
    height: 100dvh;
    height: 100vh;
  }

  .topbar {
    padding: 6px 12px;
    min-height: 48px;
  }

  .page-heading {
    font-size: 16px;
  }
}

/* ── 9. SAFE AREA (iPhone cu notch/Dynamic Island) ── */
@supports (padding: env(safe-area-inset-left)) {
  .sidebar {
    padding-left: env(safe-area-inset-left);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
