/* ============================================================
   COMPONENTS — Reusable UI Components
   ============================================================ */

/* --------------------------------------------------------
   1. BUTTONS
   -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary — Gradient */
.btn-primary {
  background: var(--color-brand-gradient);
  color: var(--color-white);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(26, 111, 212, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(26, 111, 212, 0.35);
  transform: translateY(-2px);
  filter: brightness(1.08);
}

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

/* Secondary — Outlined */
.btn-secondary {
  background: var(--color-white);
  color: var(--color-brand);
  border-color: var(--color-brand);
}

.btn-secondary:hover {
  background: var(--color-brand);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(26, 111, 212, 0.2);
}

/* Ghost — Transparent */
.btn-ghost {
  background: transparent;
  color: var(--color-brand);
}

.btn-ghost:hover {
  background: var(--color-brand-light);
}

/* Size Variants */
.btn-large {
  padding: 1rem 2.5rem;
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
}

.btn-small {
  padding: 0.5rem 1.25rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

/* With Icon */
.btn-icon svg,
.btn-icon img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Full Width */
.btn-block {
  display: flex;
  width: 100%;
}

/* --------------------------------------------------------
   2. CARDS
   -------------------------------------------------------- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-8);
  transition: all var(--transition-base);
  border: 1px solid var(--color-border);
  position: relative;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Glassmorphism card */
.card-glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: all var(--transition-base);
}

.card-glass:hover {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow-lg);
}

/* Flat card (no hover lift) */
.card-flat {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  border: 1px solid var(--color-border);
}

/* --------------------------------------------------------
   3. BADGES
   -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.3rem 0.85rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

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

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

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

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

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

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

.badge-popular {
  background: var(--color-brand-gradient);
  color: var(--color-white);
}

/* --------------------------------------------------------
   4. INPUTS
   -------------------------------------------------------- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-dark);
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--font-size-base);
  color: var(--color-dark);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.input::placeholder {
  color: var(--color-gray);
  opacity: 0.6;
}

.input:hover {
  border-color: var(--color-gray);
}

.input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.12);
}

/* Input with icon */
.input-icon {
  position: relative;
}

.input-icon .input {
  padding-left: 2.75rem;
}

.input-icon svg,
.input-icon .icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-gray);
  pointer-events: none;
}

/* --------------------------------------------------------
   5. DIVIDER
   -------------------------------------------------------- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-8) 0;
  color: var(--color-gray);
  font-size: var(--font-size-sm);
}

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

.divider:empty::before {
  flex: 1;
}

.divider:empty::after {
  display: none;
}

/* --------------------------------------------------------
   6. TAGS / CHIPS
   -------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  background: var(--color-gray-lighter);
  color: var(--color-gray);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--color-brand-light);
  color: var(--color-brand);
  border-color: var(--color-brand-light);
}

/* --------------------------------------------------------
   7. AVATAR
   -------------------------------------------------------- */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--color-brand-gradient);
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--font-size-base); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--font-size-xl); }

/* --------------------------------------------------------
   8. TOOLTIP
   -------------------------------------------------------- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.4rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-white);
  background: var(--color-dark);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 100;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--color-dark);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip:hover::before {
  transform: translateX(-50%);
}

/* --------------------------------------------------------
   9. SKELETON LOADER
   -------------------------------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-gray-light);
  border-radius: var(--radius-md);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-rect {
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --------------------------------------------------------
   10. ICON WRAPPER
   -------------------------------------------------------- */
.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.icon-wrap-sm { width: 32px; height: 32px; }
.icon-wrap-lg { width: 56px; height: 56px; }
.icon-wrap-xl { width: 80px; height: 80px; }
