/* ═══════════════════════════════════════════════
   NextHire — Components (components.css)
   Reusable UI components: buttons, cards, inputs,
   modals, toasts, badges, loaders
   ═══════════════════════════════════════════════ */

/* ═══════════════════════════════════
   Buttons
   ═══════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  border-radius: var(--radius-lg);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  text-transform: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-button);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Shimmer overlay on primary button */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s var(--ease-out);
}

.btn-primary:hover::after {
  left: 100%;
}

/* Secondary / Outline Button */
.btn-secondary {
  background: transparent;
  color: var(--color-accent-light);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(var(--blur-sm));
}

.btn-secondary:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
}

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

/* Danger Button */
.btn-danger {
  background: var(--color-error);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: var(--color-error-light);
  transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
}

.btn-lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-md);
}

/* Button with spinner */
.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}


/* ═══════════════════════════════════
   Cards
   ═══════════════════════════════════ */
.card {
  background: var(--color-glass);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--color-accent-subtle);
  color: var(--color-accent-light);
  font-size: var(--fs-xl);
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text-heading);
}

.card-description {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}


/* ═══════════════════════════════════
   Form Inputs
   ═══════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
}

.form-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-input);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  font-size: var(--fs-base);
  transition: all var(--duration-fast) var(--ease-out);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.form-input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--color-error-light);
}

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


/* ═══════════════════════════════════
   Select / Dropdown
   ═══════════════════════════════════ */
.form-select {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-input);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  font-size: var(--fs-base);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825a.7.7 0 0 1-.5-.2L1.5 4.625a.7.7 0 0 1 1-1L6 7.125l3.5-3.5a.7.7 0 0 1 1 1l-4 4a.7.7 0 0 1-.5.2Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
  transition: all var(--duration-fast) var(--ease-out);
}

.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-select option {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}


/* ═══════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 320px;
  max-width: 420px;
  padding: var(--sp-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--blur-md));
  pointer-events: all;
  animation: toastSlideIn 0.4s var(--ease-spring) forwards;
}

.toast.removing {
  animation: toastSlideOut 0.3s var(--ease-out) forwards;
}

.toast-icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-heading);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--fs-xs);
  color: var(--color-text-secondary);
  line-height: var(--lh-normal);
}

.toast-close {
  padding: var(--sp-1);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) ease;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--color-text-primary);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastTimer linear forwards;
}

/* Toast Variants */
.toast--success { border-left: 3px solid var(--color-success); }
.toast--success .toast-icon { color: var(--color-success); }
.toast--success .toast-progress { background: var(--color-success); }

.toast--error { border-left: 3px solid var(--color-error); }
.toast--error .toast-icon { color: var(--color-error); }
.toast--error .toast-progress { background: var(--color-error); }

.toast--warning { border-left: 3px solid var(--color-warning); }
.toast--warning .toast-icon { color: var(--color-warning); }
.toast--warning .toast-progress { background: var(--color-warning); }

.toast--info { border-left: 3px solid var(--color-info); }
.toast--info .toast-icon { color: var(--color-info); }
.toast--info .toast-progress { background: var(--color-info); }


/* ═══════════════════════════════════
   Badges
   ═══════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-full);
  letter-spacing: var(--ls-wide);
}

.badge-primary {
  background: var(--color-accent-subtle);
  color: var(--color-accent-light);
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success-light);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-light);
}

.badge-error {
  background: var(--color-error-bg);
  color: var(--color-error-light);
}


/* ═══════════════════════════════════
   Modal
   ═══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--sp-8);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--duration-base) var(--ease-spring);
  box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}


/* ═══════════════════════════════════
   Loader / Spinner
   ═══════════════════════════════════ */
.loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-bg-elevated);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.loader-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* Full page loading */
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  background: var(--color-bg-primary);
  z-index: var(--z-modal);
}


/* ═══════════════════════════════════
   Progress Bar
   ═══════════════════════════════════ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-button);
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease-out);
}


/* ═══════════════════════════════════
   Divider
   ═══════════════════════════════════ */
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-glass-border);
}


/* ═══════════════════════════════════
   Tabs
   ═══════════════════════════════════ */
.tabs {
  display: flex;
  gap: var(--sp-1);
  background: var(--color-bg-input);
  padding: var(--sp-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-glass-border);
}

.tab {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  flex: 1;
  text-align: center;
}

.tab:hover {
  color: var(--color-text-secondary);
}

.tab.active {
  background: var(--gradient-button);
  color: #fff;
  box-shadow: var(--shadow-sm);
}


/* ═══════════════════════════════════
   Tooltip
   ═══════════════════════════════════ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-out);
  z-index: var(--z-dropdown);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
