/* ==========================================================================
   AERO Group ERP — Design System
   Modern, premium, mobile-first, government-contractor aesthetic
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand — AERO Aviation Blue (professional, trustworthy) */
  --brand-primary:        #0B5FFF;
  --brand-primary-dark:   #0747B6;
  --brand-primary-light:  #E8F0FF;
  --brand-primary-50:     #F4F8FF;
  --brand-accent:         #00C2A8;
  --brand-dark:           #0A1628;

  /* Semantic */
  --success:        #10B981;
  --success-light:  #D1FAE5;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --info:           #3B82F6;
  --info-light:     #DBEAFE;

  /* Neutrals (Slate) */
  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Type scale */
  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-lg:   18px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  30px;
  --text-4xl:  36px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:   0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:   0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl:   0 24px 48px rgba(15, 23, 42, 0.12);
  --shadow-focus:0 0 0 3px rgba(11, 95, 255, 0.20);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-w:        260px;
  --sidebar-w-collapsed: 72px;
  --topbar-h:         64px;
  --container-max:    1440px;
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  font-size:   var(--text-sm);
  line-height: 1.5;
  color:       var(--gray-800);
  background:  var(--gray-50);
  min-height:  100vh;
}

a { color: var(--brand-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-primary-dark); }

img, svg, video { display: block; max-width: 100%; height: auto; }

button {
  font-family: inherit;
  font-size:   inherit;
  cursor:      pointer;
  border:      none;
  background:  none;
}

input, textarea, select {
  font-family: inherit;
  font-size:   inherit;
  color:       inherit;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color:       var(--gray-900);
  line-height: 1.25;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }

.text-muted   { color: var(--gray-500); }
.text-dim     { color: var(--gray-400); }
.text-primary { color: var(--brand-primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* ---------- Layout helpers ---------- */
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0; min-width: 0; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-md);
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
  min-height: 40px;
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: #fff;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border-color: var(--gray-200);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
  color: var(--gray-900);
}

.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--brand-primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--gray-700);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #DC2626; color:#fff; }

.btn-sm { padding: 6px 12px; min-height: 32px; font-size: var(--text-xs); }
.btn-lg { padding: 14px 24px; min-height: 48px; font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-height: 38px; min-width: 38px; }

/* ---------- Form ---------- */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}
.form-label .required { color: var(--danger); }

.form-input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--gray-900);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--t-fast);
  min-height: 44px;
}
.form-input:hover { border-color: var(--gray-400); }
.form-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-focus);
}
.form-input::placeholder { color: var(--gray-400); }
.form-input.is-invalid { border-color: var(--danger); }
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.20); }

.form-help { margin-top: 6px; font-size: var(--text-xs); color: var(--gray-500); }
.form-error { margin-top: 6px; font-size: var(--text-xs); color: var(--danger); font-weight: 500; }

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .form-input { padding-left: 44px !important; padding-right: 48px !important; }
.input-group-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.input-group-action {
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: transparent !important;
  color: var(--gray-500);
  padding: 6px !important;
  border-radius: var(--radius-sm);
  z-index: 10 !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 32px !important;
  height: 32px !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.input-group-action:hover  { color: var(--gray-700); background: var(--gray-100) !important; }
.input-group-action:focus  { outline: none; color: var(--brand-primary); }
.input-group-action svg    { display: block !important; pointer-events: none; width: 20px; height: 20px; }
.input-group-action .hidden{ display: none !important; }

/* Hide browser-native password reveal icons (Edge, Chrome, IE) */
.input-group .form-input::-ms-reveal,
.input-group .form-input::-ms-clear,
.input-group .form-input::-webkit-credentials-auto-fill-button,
.input-group .form-input::-webkit-strong-password-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
}

/* Checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--gray-700);
  user-select: none;
}
.checkbox input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand-primary); }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: var(--text-base); font-weight: 600; }
.card-body { padding: var(--space-5); }

/* ---------- Alert / Flash ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border: 1px solid;
}
.alert-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.alert-danger  { background: var(--danger-light);  color: #991B1B; border-color: #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border-color: #FDE68A; }
.alert-info    { background: var(--info-light);    color: #1E40AF; border-color: #BFDBFE; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  line-height: 1.2;
}
.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger  { background: var(--danger-light);  color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info    { background: var(--info-light);    color: #1E40AF; }
.badge-primary { background: var(--brand-primary-light); color: var(--brand-primary-dark); }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: #fff;
  font-weight: 600;
  font-size: var(--text-xs);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-sm); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---------- Print ---------- */
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
}
