/* =============================================
   HUMANO — COMPONENTS
   Buttons, Inputs, Cards, Badges, Modals, etc.
   ============================================= */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: 0.4rem 0.875rem; font-size: var(--font-size-sm); border-radius: var(--radius-sm); }
.btn-lg { padding: 0.875rem 1.75rem; font-size: var(--font-size-md); border-radius: var(--radius-lg); }
.btn-icon { padding: 0.625rem; aspect-ratio: 1; }
.btn-icon-sm { padding: 0.4rem; aspect-ratio: 1; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: var(--shadow-primary-lg);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-gray-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-bg); color: var(--text-primary); }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-accent);
}
.btn-accent:hover { background: var(--color-accent-hover); transform: translateY(-1px); }

.btn-danger {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-success {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
}

/* ===== INPUTS ===== */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.form-label span.required { color: var(--color-primary); margin-left: 2px; }

.input {
  width: 100%;
  padding: 0.625rem var(--space-4);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}
.input::placeholder { color: var(--text-placeholder); font-weight: var(--font-weight-regular); }
.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(74,124,255,0.12);
}
.input:hover:not(:focus) { border-color: var(--color-gray-light); }
.input.error { border-color: var(--color-error); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 2.75rem; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.input-icon-wrap .input-icon-right {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
}
.input-icon-wrap .input-icon-right:hover { color: var(--text-primary); }
.form-hint { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.form-error { font-size: var(--font-size-xs); color: var(--color-error); display: flex; align-items: center; gap: 4px; }

textarea.input { resize: vertical; min-height: 80px; line-height: var(--line-height-relaxed); }

select.input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239998A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 2.5rem; }

/* ===== CARDS ===== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-body { padding: var(--space-6); }
.card-header { padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border-light); display: flex; align-items: center; justify-content: space-between; }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border-light); background: var(--color-bg); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-primary { background: #FFF0E6; color: var(--color-primary); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); border: 1px solid var(--color-error-border); }
.badge-accent { background: var(--color-accent-light); color: var(--color-accent); }
.badge-neutral { background: var(--color-bg); color: var(--text-secondary); border: 1px solid var(--color-border); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
  background: linear-gradient(135deg, var(--color-primary-lighter), var(--color-primary));
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-sm); }
.avatar-lg { width: 52px; height: 52px; font-size: var(--font-size-xl); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--font-size-2xl); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); }
.tab-btn {
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--color-bg); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: var(--font-weight-semibold); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--transition-base) ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-spring) ease;
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }
.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}
.modal-title { font-size: var(--font-size-lg); font-weight: var(--font-weight-bold); }
.modal-close-btn { color: var(--text-tertiary); transition: color var(--transition-fast), background var(--transition-fast); border-radius: var(--radius-sm); padding: 4px; }
.modal-close-btn:hover { color: var(--text-primary); background: var(--color-bg); }
.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-border-light); display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: var(--space-6); right: var(--space-6); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid;
  max-width: 360px;
  min-width: 280px;
  pointer-events: all;
  animation: slideInRight 0.3s ease;
}
.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-error); }
.toast.warning { border-color: var(--color-warning); }
.toast.info { border-color: var(--color-accent); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-icon.success { color: var(--color-success); }
.toast-icon.error { color: var(--color-error); }
.toast-icon.warning { color: var(--color-warning); }
.toast-icon.info { color: var(--color-accent); }
.toast-content { flex: 1; }
.toast-title { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); }
.toast-msg { font-size: var(--font-size-sm); color: var(--text-secondary); margin-top: 2px; }
.toast-dismiss { color: var(--text-tertiary); cursor: pointer; transition: color var(--transition-fast); padding: 2px; }
.toast-dismiss:hover { color: var(--text-primary); }
.toast.removing { animation: slideOutRight 0.25s ease forwards; }

/* ===== SKELETON LOADER ===== */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-bg) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}
.skeleton-text { height: 14px; border-radius: var(--radius-full); }
.skeleton-avatar { border-radius: var(--radius-full); }
.skeleton-card { border-radius: var(--radius-xl); height: 120px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  gap: var(--space-4);
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--color-warm-1);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.empty-state-title { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); }
.empty-state-desc { font-size: var(--font-size-base); color: var(--text-secondary); max-width: 320px; }

/* ===== DROPDOWN ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
}
.dropdown-item:hover { background: var(--color-bg); }
.dropdown-item.danger { color: var(--color-error); }
.dropdown-item.danger:hover { background: var(--color-error-bg); }
.dropdown-divider { height: 1px; background: var(--color-border-light); margin: var(--space-1) 0; }

/* ===== STATS CARD ===== */
.stat-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  min-width: 0;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-value { font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); line-height: 1; }
.stat-card-label { font-size: var(--font-size-sm); color: var(--text-secondary); margin-top: var(--space-1); }
.stat-card-trend { font-size: var(--font-size-xs); margin-top: var(--space-2); display: flex; align-items: center; gap: 4px; }

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar .input { padding-left: 2.75rem; }
.search-bar-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-xl); border: 1px solid var(--color-border-light); box-shadow: var(--shadow-sm); }
table.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--color-bg); }
.data-table tbody td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border-light); font-size: var(--font-size-base); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== PROGRESS BAR ===== */
.progress { height: 6px; background: var(--color-border); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light)); transition: width 0.6s ease; }

/* ===== TOGGLE SWITCH ===== */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-spring);
}
.toggle input:checked + .toggle-slider { background: var(--color-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== RADIO CARD ===== */
.radio-card { position: relative; }
.radio-card input[type=radio] { position: absolute; opacity: 0; }
.radio-card-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}
.radio-card input:checked + .radio-card-label {
  border-color: var(--color-primary);
  background: #FFF0E6;
  color: var(--color-primary);
}
