/* ===== Iron 3 Tri — Mobile Menu Fix ===== */

/* Prevent horizontal overflow */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Hamburger button — hidden on desktop */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-card, #151d27);
  border: 1px solid var(--border, #1e2a3a);
  border-radius: 8px;
  color: var(--text-primary, #e8edf3);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle:hover {
  border-color: var(--accent, #5cbf2a);
  color: var(--accent, #5cbf2a);
}

.mobile-menu-toggle svg {
  width: 20px;
  height: 20px;
}

/* Overlay behind sidebar */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
  animation: mobileFadeIn 0.2s ease;
}

.mobile-sidebar-overlay.active {
  display: block;
}

@keyframes mobileFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile rules */
@media (max-width: 768px) {
  /* Show hamburger */
  .mobile-menu-toggle {
    display: flex !important;
  }

  /* Sidebar becomes slide-in drawer */
  .sidebar {
    display: flex !important;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    width: 260px !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    z-index: 160 !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Main content: no margin-left, add top-padding for hamburger */
  .main-content {
    margin-left: 0 !important;
    padding: 68px 14px 24px 14px !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Stats grid: 1 col on small, 2 on medium mobile */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Tables scroll inside container */
  .table-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 520px;
  }

  /* Cards / forms / grids stack */
  .grid-2,
  .grid-3,
  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Modals full-width */
  .modal {
    max-width: 100% !important;
    margin: 12px;
  }

  .modal-overlay {
    padding: 8px !important;
  }

  /* Filters wrap and shrink */
  .filters {
    gap: 8px;
  }

  .filters input,
  .filters select {
    flex: 1;
    min-width: 120px;
  }

  /* Page header sizing */
  .page-header h1 {
    font-size: 20px !important;
  }

  /* Cards padding reduce */
  .card,
  .stat-card {
    padding: 14px !important;
  }
}

/* Very small screens (iPhone SE, etc) */
@media (max-width: 380px) {
  .main-content {
    padding: 64px 10px 20px 10px !important;
  }
  .stat-card .stat-value {
    font-size: 22px !important;
  }
  .page-header h1 {
    font-size: 18px !important;
  }
}
