/* Waha59 — global UI polish: forms, mobile nav, focus */

:root {
  --wms-primary: #4f46e5;
  --wms-radius: 0.75rem;
  --wms-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
}

/* ——— Mobile sidebar ——— */
#sidebarBackdrop {
  -webkit-tap-highlight-color: transparent;
}

#sidebar {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 639px) {
  #sidebar {
    box-shadow: var(--wms-shadow-card);
  }
  #sidebar {
    transform: translate3d(-100%, 0, 0);
  }
  body.wms-nav-open #sidebar {
    transform: translate3d(0, 0, 0);
  }
  body.wms-nav-open {
    overflow: hidden;
  }
}

@media (min-width: 640px) {
  #sidebar {
    transform: none !important;
  }
}

/* ——— Forms: consistent spacing (main + auth) ——— */
.wms-content input[type="text"],
.wms-content input:not([type]),
.wms-content input[type="email"],
.wms-content input[type="password"],
.wms-content input[type="number"],
.wms-content input[type="search"],
.wms-content input[type="url"],
.wms-content input[type="tel"],
.wms-content input[type="date"],
.wms-content input[type="time"],
.wms-content input[type="datetime-local"],
.wms-content select,
.wms-content textarea,
.wms-form input[type="text"],
.wms-form input:not([type]),
.wms-form input[type="email"],
.wms-form input[type="password"],
.wms-form input[type="number"],
.wms-form input[type="search"],
.wms-form input[type="url"],
.wms-form input[type="tel"],
.wms-form input[type="date"],
.wms-form input[type="time"],
.wms-form input[type="datetime-local"],
.wms-form select,
.wms-form textarea {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: 2.75rem;
  border-radius: var(--wms-radius);
  border: 1px solid #e5e7eb;
  background-color: #fff;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #111827;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wms-content select,
.wms-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.1rem;
  padding-right: 2.5rem;
}

.wms-content select[multiple],
.wms-form select[multiple] {
  background-image: none;
  min-height: 10rem;
  padding-right: 0.875rem;
}

.wms-content input:focus,
.wms-content select:focus,
.wms-content textarea:focus,
.wms-form input:focus,
.wms-form select:focus,
.wms-form textarea:focus {
  outline: none;
  border-color: var(--wms-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.wms-content input:disabled,
.wms-content select:disabled,
.wms-content textarea:disabled,
.wms-form input:disabled,
.wms-form select:disabled,
.wms-form textarea:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Label spacing */
.wms-content label,
.wms-form label {
  display: block;
  margin-bottom: 0.35rem;
}

/* Buttons: primary / neutral / danger — */
.wms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--wms-radius);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wms-btn:disabled,
.wms-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.wms-btn-primary {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.wms-btn-primary:hover {
  background: linear-gradient(180deg, #5550e8 0%, #3b32bd 100%);
}

.wms-btn-neutral {
  background: #f3f4f6;
  color: #111827;
  border-color: #e5e7eb;
}
.wms-btn-neutral:hover {
  background: #e5e7eb;
}

.wms-btn-danger {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
}
.wms-btn-danger:hover {
  background: linear-gradient(180deg, #e12f2f 0%, #a61c1c 100%);
}

/* Card */
.wms-card {
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: var(--wms-shadow-card);
}

/* Table horizontal scroll on small screens */
.wms-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sidebar dropdown (details / summary) */
.wms-nav-details > summary {
  list-style: none;
}
.wms-nav-details > summary::-webkit-details-marker {
  display: none;
}
/* Only the chevron on *this* section’s summary (avoids nested details breaking) */
.wms-nav-details[open] > summary .wms-nav-chevron {
  transform: rotate(180deg);
}
.wms-nav-sublink {
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.wms-nav-sublink-active {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.wms-nav-sublink:not(.wms-nav-sublink-active) {
  color: #374151;
}
.wms-nav-sublink:not(.wms-nav-sublink-active):hover {
  background: #f3f4f6;
}
.wms-nav-summary {
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.wms-nav-summary span {
  max-width: 10rem;
}
@media (min-width: 360px) {
  .wms-nav-summary span {
    max-width: 12.5rem;
  }
}

/* Flash messages in header (optional class from PHP) */
.wms-flash {
  border-radius: var(--wms-radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}
