/* ===============================================
   MOBILE.CSS - Responsive verbeteringen
   Voeg toe aan je index.php: <link rel="stylesheet" href="assets/mobile.css">
   =============================================== */

:root {
  --mobile-header: 56px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

  /* ===== FORCE HIDE SIDEBAR ON MOBILE ===== */
@media (max-width: 960px) {
  
  /* BELANGRIJK: Verberg standaard sidebar, toon alleen via drawer */
  .container > .sidebar:not(.drawer-open) {
    display: none;
  }
  
  /* Universele fixes */
  *, *::before, *::after { box-sizing: border-box; }
  
  html { font-size: clamp(15px, 3.8vw, 16px); }
  
  body { 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  
  img, video, canvas { 
    max-width: 100%; 
    height: auto; 
  }

  /* ===== LAYOUT ===== */
  
  .container {
    display: block !important;
    padding: 0;
  }
  
  /* Sidebar wordt drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    background: #0d0d0d;
    border-right: 1px solid var(--line, #242424);
    overflow-y: auto;
    padding-top: var(--safe-top);
  }
  
  body.menu-open .sidebar {
    transform: translateX(0);
  }
  
  /* Overlay */
  .drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 999;
  }
  
  body.menu-open .drawer-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  
  body.menu-open {
    overflow: hidden;
  }

  /* Content full width */
  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
  
  .main {
    padding: 12px !important;
    padding-top: calc(var(--mobile-header) + var(--safe-top) + 12px) !important;
    padding-bottom: calc(12px + var(--safe-bottom)) !important;
  }

  /* ===== TOPBAR ===== */
  
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: calc(var(--mobile-header) + var(--safe-top));
    padding: calc(8px + var(--safe-top)) 12px 8px;
    background: var(--bg, #0f0f0f);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 10px;
    align-items: center;
  }
  
  /* Hamburger menu */
  .topbar .burger {
    display: inline-flex !important;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #121212;
    cursor: pointer;
  }
  
  .topbar .burger .bars {
    width: 18px;
    height: 2px;
    background: #ddd;
    position: relative;
  }
  
  .topbar .burger .bars::before,
  .topbar .burger .bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: #ddd;
  }
  
  .topbar .burger .bars::before { top: -6px; }
  .topbar .burger .bars::after { top: 6px; }
  
  .topbar .search {
    flex: 1;
    min-width: 0;
  }
  
  .topbar input {
    height: 38px;
    width: 100%;
  }

  /* ===== CARDS & COMPONENTS ===== */
  
  .card {
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .card .hd {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ===== BUTTONS ===== */
  
  .pill, .btn {
    min-height: 44px; /* Apple touch target guideline */
    padding: 10px 14px;
    border-radius: 10px;
  }
  
  .pill.sm, .btn.sm {
    min-height: 38px;
    padding: 8px 12px;
  }

  /* ===== TABLES ===== */
  
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 640px;
  }

  /* ===== GRIDS ===== */
  
  .grid,
  .homegrid,
  [class*="grid-"] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  .row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  /* ===== HOME DASHBOARD ===== */
  
  .kpis {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  
  .kpi {
    padding: 12px;
  }
  
  .kpi .n {
    font-size: 24px;
  }

  /* ===== AGENDA ===== */
  
  .agenda-ev,
  .evrow {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 12px;
  }
  
  .agenda-date {
    width: 100%;
    justify-self: start;
  }
  
  .agenda-actions {
    width: 100%;
  }
  
  .agenda-actions form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .agenda-actions button {
    flex: 1 1 auto;
    min-width: 100px;
  }

  /* ===== FORMS ===== */
  
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    width: 100%;
    font-size: 16px; /* Prevent iOS zoom */
  }
  
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* ===== MODALS ===== */
  
  .modal .dialog {
    width: calc(100% - 32px);
    max-height: calc(100vh - 32px);
    margin: 16px;
  }

  /* ===== SONGS TABLE ===== */
  
  #songsTable {
    font-size: 14px;
  }
  
  #songsTable th,
  #songsTable td {
    padding: 8px;
  }

  /* ===== MULTITRACK ===== */
  
  .tracks,
  .stemlist {
    grid-template-columns: 1fr !important;
  }
  
  .rowCtrls {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }

  /* ===== HIDE DESKTOP ONLY ===== */
  
  .desktop-only {
    display: none !important;
  }
}

/* ===== EXTRA SMALL (phones) ===== */
@media (max-width: 480px) {
  
  .kpis {
    grid-template-columns: 1fr !important;
  }
  
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
  }
  
  .pill {
    padding: 9px 12px;
    font-size: 14px;
  }
}

/* ===== LANDSCAPE PHONES ===== */
@media (max-width: 960px) and (orientation: landscape) {
  
  .topbar {
    height: 48px;
    padding: 8px 12px;
  }
  
  .main {
    padding-top: 60px !important;
  }
}

/* ===== TOUCH ENHANCEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
  
  /* Grotere touch targets */
  a, button, input, select {
    min-height: 44px;
  }
  
  /* Geen hover effecten */
  .hover-only {
    display: none !important;
  }
  
  /* Tap highlight */
  * {
    -webkit-tap-highlight-color: rgba(29, 185, 84, 0.2);
  }
}

/* ===== PRINT ===== */
@media print {
  .sidebar,
  .topbar,
  .burger,
  .drawer-scrim,
  .btn,
  .pill,
  nav {
    display: none !important;
  }
  
  .main {
    padding: 0 !important;
  }
}