/* ============================================
   📱 Responsive layer for style.css (add-only)
   ============================================ */

/* ---------- GLOBAL ---------- */
html, body { overflow-x: hidden; }
img, video { max-width: 100%; height: auto; }
.container {
  width: 100%;
  max-width: 1100px;
  padding: 0 16px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ---------- TOPBAR → HAMBURGER ---------- */
.topbar { z-index: 1000; }
.nav-links { display: flex; gap: 10px; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 28px;
  height: 22px;
  gap: 5px;
  cursor: pointer;
  z-index: 1001;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translateY(8px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    right: 18px;
    top: 60px;
    flex-direction: column;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  .nav-links.show {
    display: flex;
  }
}

/* ---------- SUBNAV ---------- */
@media (max-width: 768px) {
  .subnav {
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
  }
  .subnav-btn {
    width: 100%;
    text-align: center;
  }
}

/* ---------- COMMANDS PAGE ---------- */
@media (max-width: 992px) {
  .commands-header-row {
    gap: 10px;
  }
  .filter-bar {
    flex-wrap: wrap;
    width: 100%;
  }
  .filter-bar input[type="text"],
  .filter-bar select {
    flex: 1 1 220px;
    min-width: 0;
  }
}

@media (max-width: 1100px) { .col-text { max-width: 420px; } }
@media (max-width: 900px) { .col-text { max-width: 320px; } }
@media (max-width: 700px) { .col-text { max-width: 240px; } }

@media (max-width: 900px) {
  .actions-cell .action-row {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  #default-commands,
  .tab-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    white-space: nowrap;
  }
  th, td { padding: 10px 8px; }
}

/* 🧩 Simplified command list on mobile: only show command name + actions */
@media (max-width: 600px) {
  .cmd-info .muted,
  .cmd-info small {
    display: none !important;
  }

  .cmd-info strong {
    font-size: 1rem;
    display: block;
    margin-bottom: 0;
  }

  #default-commands tr.command-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }

  #default-commands tr.command-row td {
    border: none;
    background: transparent;
    padding: 6px 4px;
  }

  #default-commands tr.command-row td:first-child {
    width: auto;
    text-align: left;
  }

  #default-commands tr.command-row td:nth-child(2) { flex: 1; }

  #default-commands tr.command-row td:last-child {
    width: auto;
    text-align: right;
    white-space: nowrap;
  }

  .actions-cell .action-row,
  #default-commands tr.command-row td:last-child {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }
}

/* ---------- PROFILE / DASHBOARD / MODULES ---------- */
@media (max-width: 992px) {
  .profile-card { flex-direction: column; text-align: center; }
  .profile-left, .profile-right { width: 100%; }
}
@media (max-width: 700px) { .dashboard-stats { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .modules-grid { grid-template-columns: 1fr; } }

/* ---------- MARGIN ADJUST ---------- */
@media (max-width: 768px) {
  .content-wrapper { margin-top: 8px; }
}

/* ---------- 🩹 Smart responsive fix — prevent search & dropdown from over-expanding ---------- */
@media (max-width: 600px) {
  .filter-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .filter-bar input[type="text"],
  .filter-bar select {
    flex: 1 1 auto;
    max-width: 220px;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 14px;
    box-sizing: border-box;
  }
}

@media (max-width: 400px) {
  .filter-bar input[type="text"],
  .filter-bar select { max-width: 200px; }
}

/* ---------- 🧩 Edit dropdown layout (always works) ---------- */
tr.edit-row .dropdown {
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  padding: 12px;
}

tr.edit-row .dropdown label {
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--muted);
}

tr.edit-row .dropdown input,
tr.edit-row .dropdown select,
tr.edit-row .dropdown textarea {
  width: 100%;
  font-size: 14px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

tr.edit-row .dropdown .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

tr.edit-row .dropdown .actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}
