/* Users responsive styles - updated to mirror payroll responsive patterns */

/* Header visibility helpers (used by layouts) */
.desktop-only { display: block; }
.mobile-only { display: none; }

/* Users header and actions - keeps header and controls aligned */
.users-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 24px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(2,6,23,0.04);
  margin-bottom: 12px;
}
.users-header .title h1 { margin:0; font-size:1.4rem; font-weight:800; color:var(--text); }
.users-header .subtitle { margin-top:6px; color:var(--muted); font-size:0.95rem; }

.users-header .actions-group {
  display:flex; gap:10px; align-items:center; justify-content:flex-end; flex-wrap:wrap;
}
.users-header .actions-group .btn { min-height:36px; padding:8px 12px; border-radius:8px; font-weight:700; }

/* Card list layout */
.user-cards { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.user-card { display:flex; gap:12px; align-items:flex-start; padding:12px; background:var(--panel); border-radius:10px; box-shadow:0 6px 18px rgba(2,6,23,0.04); }
.user-card .card-left { flex:0 0 56px; }
.user-card .user-avatar { width:56px; height:56px; border-radius:8px; display:flex; align-items:center; justify-content:center; background:linear-gradient(180deg,var(--accent),var(--accent-2)); color:#fff; font-weight:700; }
.user-card .card-main { flex:1 1 auto; min-width:0; }
.user-card .user-name { font-weight:800; }
.user-card .card-actions { display:flex; gap:8px; flex-direction:column; flex:0 0 140px; align-items:flex-end; }

/* Truncate potential long fields but allow wrap on mobile */
.user-card .user-name, .user-card .user-role, .user-card .user-meta, .user-card .user-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Desktop -> hide mobile list */
@media (max-width:900px) {
  .desktop-only { display:none !important; }
  .mobile-only { display:block !important; }
}

/* Mobile-specific card layout improvements */
@media (max-width:900px) {
  .user-card { flex-direction: column; align-items:stretch; padding:10px; }
  .user-card .card-left { flex: 0 0 auto; margin-bottom:8px; }
  .user-card .card-main { margin-bottom:8px; }
  .user-card .card-actions { flex-direction:row; justify-content:flex-end; align-items:center; flex: 0 0 auto; }
  .user-card .card-actions .btn { min-width:88px; }

  /* allow multi-line for address/meta on small screens */
  .user-card .user-meta, .user-card .user-address { white-space: normal; }

  /* allow name to wrap instead of truncating on very small widths */
  .user-card .user-name { white-space: normal; }
}

@media (max-width:480px) {
  .user-card { padding:8px; }
  .user-card .card-left { flex:0 0 48px; }
  .user-card .user-avatar { width:48px; height:48px; font-size:13px; }
  .user-card .card-actions { flex: 0 0 auto; gap:6px; }
  .user-card .card-actions .btn { min-width:72px; padding:6px 8px; font-size:0.9rem; }
}

/* Table view fallbacks - if user list is rendered as a table */
.table-responsive { overflow-x:auto; margin-top:8px; }
.table { width:100%; border-collapse:collapse; }

/* Ensure action buttons align and don't overflow cells */
td .btn { white-space:nowrap; }

/* Table -> stacked card rows for small screens similar to payroll */
.table-modern { width:100%; }
@media (max-width:900px) {
  .table-modern thead { display:none; }
  .table-modern tbody { display:block; }
  .table-modern tbody tr { display:block; margin-bottom:12px; background:var(--panel); border-radius:10px; padding:10px; box-shadow:0 6px 18px rgba(2,6,23,0.04); }
  .table-modern tbody tr td { display:flex; justify-content:space-between; align-items:center; padding:8px 6px; border-bottom:none; }
  .table-modern tbody tr td:first-child { display:none; }
  .table-modern tbody tr td::before { content: attr(data-label) ": "; font-weight:700; color:var(--muted); margin-right:6px; }
}

/* Desktop/tablet enhancements */
@media (min-width:768px) {
  .user-card .card-actions { flex-direction:column; }
}

@media (max-width:767px) {
  .user-card .card-actions { flex-direction:row; gap:8px; }
}

/* Accessibility: ensure sufficient hit area on small screens */
.user-card .card-actions .btn, .table-modern .btn { min-height:36px; }

/* Small tweaks to keep visuals consistent */
.user-card .user-role { color:var(--muted); font-size:0.95rem; }
.user-card .user-meta { color:var(--muted); font-size:0.9rem; }

/* Fallback spacing in narrow table rows */
.table-modern td > .btn { margin-left:8px; }

/* Keep the user-cards responsive container padding similar to other pages */
.users-container { width:100%; padding:8px 12px; box-sizing:border-box; }

/* Modal / helper card styling for user actions */
.users-modal-backdrop { position:fixed; inset:0; background:rgba(2,6,23,0.65); display:flex; align-items:center; justify-content:center; z-index:4000; padding:20px; }
.users-modal-card { background:var(--panel,#fff); color:var(--text,#0f172a); width:100%; max-width:620px; border-radius:12px; padding:18px; box-shadow:0 24px 60px rgba(2,6,23,0.45); border:1px solid rgba(2,6,23,0.06); display:flex; flex-direction:column; gap:10px; }

@media (max-width:520px) {
  .users-modal-card { padding:16px; max-width:480px; }
  .users-modal-card .btn { min-width:72px; font-size:0.92rem; }
}

/* End of users responsive styles */
