/**
 * MensaPOS Modern Dashboard & Permission Matrix Design System
 * Inspired by modern Tailwind/Linear aesthetics: Clean, accessible, high-contrast, premium feel.
 */

:root {
  --hb-primary: #4f46e5;
  --hb-primary-hover: #4338ca;
  --hb-primary-light: #eef2ff;
  --hb-primary-border: #c7d2fe;
  
  --hb-success: #10b981;
  --hb-success-light: #ecfdf5;
  --hb-success-border: #a7f3d0;
  
  --hb-warning: #f59e0b;
  --hb-warning-light: #fffbeb;
  
  --hb-danger: #ef4444;
  --hb-danger-light: #fef2f2;
  
  --hb-slate-50: #f8fafc;
  --hb-slate-100: #f1f5f9;
  --hb-slate-200: #e2e8f0;
  --hb-slate-300: #cbd5e1;
  --hb-slate-400: #94a3b8;
  --hb-slate-500: #64748b;
  --hb-slate-600: #475569;
  --hb-slate-700: #334155;
  --hb-slate-800: #1e293b;
  --hb-slate-900: #0f172a;

  --hb-radius-sm: 8px;
  --hb-radius-md: 12px;
  --hb-radius-lg: 16px;
  --hb-radius-xl: 20px;

  --hb-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --hb-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --hb-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

/* Modern Card Layout */
.modern-card {
  background: #ffffff;
  border: 1px solid var(--hb-slate-200);
  border-radius: var(--hb-radius-lg);
  box-shadow: var(--hb-shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modern-card:hover {
  box-shadow: var(--hb-shadow-md);
  border-color: var(--hb-slate-300);
}

.modern-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--hb-slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.modern-card-body {
  padding: 1.5rem;
}

/* Page Hero & Header */
.modern-hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border-radius: var(--hb-radius-xl);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--hb-shadow-md);
}

.modern-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0) 70%);
  pointer-events: none;
}

.modern-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.modern-hero p {
  color: var(--hb-slate-300);
  font-size: 0.95rem;
  max-width: 650px;
  margin-bottom: 0;
  line-height: 1.5;
}

/* Modern Badges */
.badge-modern {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-modern-primary {
  background-color: var(--hb-primary-light);
  color: var(--hb-primary);
  border: 1px solid var(--hb-primary-border);
}

.badge-modern-success {
  background-color: var(--hb-success-light);
  color: #065f46;
  border: 1px solid var(--hb-success-border);
}

.badge-modern-slate {
  background-color: var(--hb-slate-100);
  color: var(--hb-slate-700);
  border: 1px solid var(--hb-slate-200);
}

/* Permission Matrix Specifics */
.perm-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.perm-category-card {
  background: #ffffff;
  border: 1px solid var(--hb-slate-200);
  border-radius: var(--hb-radius-lg);
  box-shadow: var(--hb-shadow-sm);
  display: flex;
  flex-direction: column;
}

.perm-category-header {
  padding: 1rem 1.25rem;
  background: var(--hb-slate-50);
  border-bottom: 1px solid var(--hb-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--hb-radius-lg);
  border-top-right-radius: var(--hb-radius-lg);
}

.perm-category-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--hb-slate-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.perm-item-row {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--hb-slate-100);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: background-color 0.15s ease;
}

.perm-item-row:last-child {
  border-bottom: none;
}

.perm-item-row:hover {
  background-color: var(--hb-slate-50);
}

.perm-info {
  flex: 1;
}

.perm-title {
  font-size: 0.885rem;
  font-weight: 600;
  color: var(--hb-slate-900);
  margin-bottom: 0.2rem;
}

.perm-desc {
  font-size: 0.775rem;
  color: var(--hb-slate-500);
  line-height: 1.35;
}

.perm-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  color: var(--hb-slate-400);
  background: var(--hb-slate-100);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.25rem;
}

/* Modern iOS/Tailwind Style Switch */
.modern-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.modern-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.modern-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--hb-slate-300);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.modern-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modern-switch input:checked + .modern-switch-slider {
  background-color: var(--hb-primary);
}

.modern-switch input:focus + .modern-switch-slider {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.modern-switch input:checked + .modern-switch-slider:before {
  transform: translateX(20px);
}

/* Modern Sticky Bottom Save Bar */
.sticky-save-bar {
  position: sticky;
  bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--hb-radius-xl);
  padding: 1rem 1.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  color: #ffffff;
}

/* Modern Buttons */
.btn-modern-primary {
  background-color: var(--hb-primary);
  color: #ffffff;
  border: none;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: var(--hb-radius-md);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-modern-primary:hover {
  background-color: var(--hb-primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
}

.btn-modern-outline {
  background: transparent;
  border: 1px solid var(--hb-slate-300);
  color: var(--hb-slate-700);
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: var(--hb-radius-md);
  transition: all 0.15s ease;
}

.btn-modern-outline:hover {
  background-color: var(--hb-slate-100);
  border-color: var(--hb-slate-400);
  color: var(--hb-slate-900);
}

/* Modern Stats / KPI Grid */
.modern-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.modern-stat-card {
  background: #ffffff;
  border: 1px solid var(--hb-slate-200);
  border-radius: var(--hb-radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--hb-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modern-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--hb-shadow-md);
  border-color: var(--hb-slate-300);
}

.modern-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--hb-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.modern-stat-icon.primary { background: var(--hb-primary-light); color: var(--hb-primary); }
.modern-stat-icon.success { background: var(--hb-success-light); color: var(--hb-success); }
.modern-stat-icon.warning { background: var(--hb-warning-light); color: var(--hb-warning); }
.modern-stat-icon.danger { background: var(--hb-danger-light); color: var(--hb-danger); }
.modern-stat-icon.slate { background: var(--hb-slate-100); color: var(--hb-slate-600); }

.modern-stat-info {
  display: flex;
  flex-direction: column;
}

.modern-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hb-slate-900);
  line-height: 1.2;
}

.modern-stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--hb-slate-500);
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* User Avatar & Status Dots */
.user-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hb-slate-100) 0%, var(--hb-slate-200) 100%);
  color: var(--hb-slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.active { background-color: var(--hb-success); box-shadow: 0 0 0 2px var(--hb-success-border); }
.status-dot.locked { background-color: var(--hb-danger); box-shadow: 0 0 0 2px var(--hb-danger-light); }
.status-dot.inactive { background-color: var(--hb-slate-400); }

/* Modern Minimalist Filter Bar */
.modern-filter-bar {
  background: #ffffff;
  border: 1px solid var(--hb-slate-200);
  border-radius: var(--hb-radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--hb-shadow-sm);
}

.modern-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.modern-input-group i {
  position: absolute;
  left: 1rem;
  color: var(--hb-slate-400);
  font-size: 1.1rem;
  pointer-events: none;
}

.modern-input-group .form-control {
  padding-left: 2.75rem;
  border-radius: var(--hb-radius-md);
  border: 1px solid var(--hb-slate-200);
  height: 44px;
  background-color: var(--hb-slate-50);
  transition: all 0.15s ease;
}

.modern-input-group .form-control:focus {
  background-color: #ffffff;
  border-color: var(--hb-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Modern Clean Table */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  background: var(--hb-slate-50);
  color: var(--hb-slate-600);
  font-weight: 600;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.25rem;
  border-top: none;
  border-bottom: 1px solid var(--hb-slate-200);
}

.table-modern tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--hb-slate-100);
  color: var(--hb-slate-800);
  font-size: 0.875rem;
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-modern tbody tr:hover td {
  background-color: #f8fafc;
}

/* Action Icons */
.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--hb-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hb-slate-500);
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.15s ease;
}

.btn-action-icon:hover {
  background: var(--hb-slate-100);
  color: var(--hb-slate-800);
  border-color: var(--hb-slate-200);
}

.btn-action-icon.danger:hover {
  background: var(--hb-danger-light);
  color: var(--hb-danger);
}

