/* ============================================================================
 * INFINITE WEALTH ERP™ — Components
 * Boutons, cartes, inputs, modales, badges, tables, skeletons.
 * Dépend de iw-tokens.css.
 * Copyright © 2026 TEK DS INNOVATION CORP.
 * ============================================================================ */

/* ── Reset léger ────────────────────────────────────────────────────────── */
.iw *, .iw *::before, .iw *::after { box-sizing: border-box; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.iw-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--iw-s-2);
  font-family: var(--iw-font-body);
  font-size: var(--iw-fs-sm); font-weight: 600;
  padding: calc(var(--iw-s-2) * var(--iw-density)) calc(var(--iw-s-4) * var(--iw-density));
  border-radius: var(--iw-r-md);
  border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: all var(--iw-dur-fast) var(--iw-ease);
  text-decoration: none;
  white-space: nowrap;
}
.iw-btn:focus-visible { outline: 2px solid var(--iw-gold); outline-offset: 2px; }
.iw-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.iw-btn-primary {
  background: linear-gradient(135deg, var(--iw-gold), var(--iw-gold-light));
  color: var(--iw-text-on-gold);
  box-shadow: 0 2px 8px var(--iw-gold-glow);
}
.iw-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--iw-gold-glow);
}
.iw-btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 6px var(--iw-gold-glow);
}

.iw-btn-secondary {
  background: var(--iw-surface);
  color: var(--iw-text);
  border-color: var(--iw-border);
}
.iw-btn-secondary:hover:not(:disabled) {
  background: var(--iw-surface-2);
  border-color: var(--iw-border-2);
  color: var(--iw-gold);
}

.iw-btn-ghost {
  background: transparent; color: var(--iw-text-2);
}
.iw-btn-ghost:hover:not(:disabled) {
  background: var(--iw-surface);
  color: var(--iw-gold);
}

.iw-btn-danger {
  background: var(--iw-danger);
  color: white;
}
.iw-btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.iw-btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--iw-r-md);
}

.iw-btn-sm { font-size: var(--iw-fs-xs); padding: 0.3rem 0.6rem; }
.iw-btn-lg { font-size: var(--iw-fs-md); padding: 0.7rem 1.2rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.iw-card {
  background: var(--iw-bg-1);
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-r-lg);
  padding: var(--iw-s-5);
  transition: border-color var(--iw-dur-mid) var(--iw-ease),
              transform var(--iw-dur-mid) var(--iw-ease),
              box-shadow var(--iw-dur-mid) var(--iw-ease);
}
.iw-card-hover:hover {
  border-color: var(--iw-border-2);
  transform: translateY(-3px);
  box-shadow: var(--iw-sh-md), 0 0 0 1px var(--iw-border);
}
.iw-card-glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.iw-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--iw-s-4);
  padding-bottom: var(--iw-s-3);
  border-bottom: 1px solid var(--iw-border);
}
.iw-card-title {
  font-family: var(--iw-font-display);
  font-size: var(--iw-fs-lg); font-weight: 700;
  color: var(--iw-gold);
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.iw-input, .iw-select, .iw-textarea {
  width: 100%;
  font-family: var(--iw-font-body);
  font-size: var(--iw-fs-sm);
  color: var(--iw-text);
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-r-md);
  padding: 0.6rem 0.85rem;
  transition: border-color var(--iw-dur-fast), background var(--iw-dur-fast);
  outline: none;
}
.iw-input:focus, .iw-select:focus, .iw-textarea:focus {
  border-color: var(--iw-gold);
  background: var(--iw-surface-2);
  box-shadow: 0 0 0 3px var(--iw-gold-glow);
}
.iw-input::placeholder { color: var(--iw-text-muted); }
.iw-label {
  display: block;
  font-size: var(--iw-fs-xs); font-weight: 600;
  color: var(--iw-text-2);
  margin-bottom: var(--iw-s-2);
  letter-spacing: 0.5px; text-transform: uppercase;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.iw-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: var(--iw-fs-xs); font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--iw-r-full);
  letter-spacing: 0.3px;
}
.iw-badge-success { background: var(--iw-success-bg); color: var(--iw-success); }
.iw-badge-warning { background: var(--iw-warning-bg); color: var(--iw-warning); }
.iw-badge-danger  { background: var(--iw-danger-bg);  color: var(--iw-danger); }
.iw-badge-info    { background: var(--iw-info-bg);    color: var(--iw-info); }
.iw-badge-gold    { background: rgba(212,175,55,.12); color: var(--iw-gold); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.iw-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--iw-fs-sm);
}
.iw-table thead th {
  text-align: left;
  font-size: var(--iw-fs-xs); font-weight: 700;
  color: var(--iw-text-2); text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--iw-s-3) var(--iw-s-4);
  border-bottom: 1px solid var(--iw-border);
  background: var(--iw-surface);
}
.iw-table tbody td {
  padding: var(--iw-s-3) var(--iw-s-4);
  border-bottom: 1px solid var(--iw-border-soft);
  color: var(--iw-text);
}
.iw-table tbody tr:hover { background: var(--iw-surface); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.iw-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: var(--iw-z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: var(--iw-s-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--iw-dur-mid) var(--iw-ease);
}
.iw-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.iw-modal {
  background: var(--iw-bg-1);
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-r-lg);
  box-shadow: var(--iw-sh-lg);
  max-width: 560px; width: 100%;
  max-height: 90vh; overflow: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--iw-dur-mid) var(--iw-ease);
}
.iw-modal-backdrop.open .iw-modal { transform: translateY(0) scale(1); }
.iw-modal-header {
  padding: var(--iw-s-4) var(--iw-s-5);
  border-bottom: 1px solid var(--iw-border);
  display: flex; align-items: center; justify-content: space-between;
}
.iw-modal-body { padding: var(--iw-s-5); }
.iw-modal-footer {
  padding: var(--iw-s-4) var(--iw-s-5);
  border-top: 1px solid var(--iw-border);
  display: flex; gap: var(--iw-s-3); justify-content: flex-end;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.iw-toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: var(--iw-z-toast);
  display: flex; flex-direction: column; gap: var(--iw-s-2);
  pointer-events: none;
}
.iw-toast {
  background: var(--iw-bg-1);
  border: 1px solid var(--iw-border);
  border-left: 3px solid var(--iw-gold);
  border-radius: var(--iw-r-md);
  padding: var(--iw-s-3) var(--iw-s-4);
  min-width: 280px; max-width: 420px;
  box-shadow: var(--iw-sh-md);
  color: var(--iw-text); font-size: var(--iw-fs-sm);
  pointer-events: auto;
  animation: iw-toast-in var(--iw-dur-mid) var(--iw-ease);
  display: flex; align-items: center; gap: var(--iw-s-3);
}
.iw-toast-success { border-left-color: var(--iw-success); }
.iw-toast-warning { border-left-color: var(--iw-warning); }
.iw-toast-danger  { border-left-color: var(--iw-danger); }
@keyframes iw-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Skeleton loaders ───────────────────────────────────────────────────── */
.iw-skeleton {
  background: linear-gradient(90deg,
    var(--iw-surface) 25%,
    var(--iw-surface-2) 50%,
    var(--iw-surface) 75%);
  background-size: 200% 100%;
  border-radius: var(--iw-r-sm);
  animation: iw-skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes iw-skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.iw-skeleton-text  { height: 12px; margin: 6px 0; }
.iw-skeleton-title { height: 24px; width: 60%; margin: 10px 0; }
.iw-skeleton-card  { height: 120px; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.iw-empty {
  text-align: center;
  padding: var(--iw-s-7) var(--iw-s-5);
  color: var(--iw-text-3);
}
.iw-empty-icon {
  font-size: 3rem;
  color: var(--iw-text-muted);
  margin-bottom: var(--iw-s-4);
  opacity: 0.5;
}
.iw-empty-title {
  font-family: var(--iw-font-display);
  font-size: var(--iw-fs-lg); font-weight: 700;
  color: var(--iw-text-2);
  margin-bottom: var(--iw-s-2);
}
.iw-empty-text { font-size: var(--iw-fs-sm); margin-bottom: var(--iw-s-4); }

/* ── KBD (touches clavier) ──────────────────────────────────────────────── */
.iw-kbd {
  display: inline-flex; align-items: center;
  font-family: var(--iw-font-mono);
  font-size: 0.7rem; font-weight: 600;
  color: var(--iw-text-2);
  background: var(--iw-surface-2);
  border: 1px solid var(--iw-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  min-width: 18px; height: 20px;
  justify-content: center;
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.iw-stack > * + * { margin-top: var(--iw-s-3); }
.iw-row { display: flex; align-items: center; gap: var(--iw-s-3); }
.iw-row-end { display: flex; align-items: center; gap: var(--iw-s-3); justify-content: flex-end; }
.iw-grid { display: grid; gap: var(--iw-s-4); }
.iw-grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.iw-grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.iw-grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.iw-text-muted { color: var(--iw-text-3); }
.iw-text-gold  { color: var(--iw-gold); }
.iw-text-sm    { font-size: var(--iw-fs-sm); }
.iw-text-xs    { font-size: var(--iw-fs-xs); }

.iw-mt-1 { margin-top: var(--iw-s-1); }  .iw-mt-2 { margin-top: var(--iw-s-2); }
.iw-mt-3 { margin-top: var(--iw-s-3); }  .iw-mt-4 { margin-top: var(--iw-s-4); }
.iw-mt-5 { margin-top: var(--iw-s-5); }  .iw-mt-6 { margin-top: var(--iw-s-6); }
