/* ─── Mint Vault — Component Library ────────────────────────── */

/* ══ BUTTONS ══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  padding: 16px 28px;
  border-radius: 16px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--clr-card);
  color: var(--clr-text);
  border: 1.5px solid var(--clr-border-subtle);
}
.btn-secondary:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-secondary);
  border: 1.5px solid transparent;
}
.btn-ghost:hover { background: var(--clr-card); color: var(--clr-text); }

.btn-danger {
  background: linear-gradient(135deg, #F87171, #DC2626);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(248,113,113,0.35); }

.btn-sm { padding: 9px 16px; font-size: 0.8125rem; border-radius: var(--r-sm); }
.btn-lg { padding: 18px 36px; font-size: 1rem; border-radius: 18px; }
.btn-icon { padding: 10px; border-radius: var(--r-md); aspect-ratio: 1; }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn .spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ══ INPUTS ═══════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text-secondary);
  font-family: var(--font-display);
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute;
  left: 16px;
  color: var(--clr-text-muted);
  pointer-events: none;
  transition: color var(--transition);
  display: flex; align-items: center;
}
.input-wrap .input-icon-right {
  position: absolute;
  right: 14px;
  color: var(--clr-text-muted);
  cursor: pointer;
  display: flex; align-items: center;
  transition: color var(--transition);
}
.input-wrap .input-icon-right:hover { color: var(--clr-primary); }

input, select, textarea {
  width: 100%;
  background: var(--clr-card);
  border: 1.5px solid var(--clr-border-subtle);
  border-radius: var(--r-md);
  padding: 14px 16px;
  color: var(--clr-text);
  font-size: 0.9375rem;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.input-wrap.has-icon input { padding-left: 46px; }
.input-wrap.has-icon-right input { padding-right: 46px; }

input::placeholder, textarea::placeholder { color: var(--clr-text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}
input:focus ~ .input-icon, select:focus ~ .input-icon { color: var(--clr-primary); }

select {
  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='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}
select option { background: var(--clr-card); }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.field-error { font-size: 0.8125rem; color: var(--clr-error); }
.field-hint  { font-size: 0.8125rem; color: var(--clr-text-muted); }

input.is-error, select.is-error, textarea.is-error {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.15);
}

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; }
.toggle {
  position: relative; width: 48px; height: 26px;
  background: var(--clr-border-subtle); border-radius: var(--r-full);
  cursor: pointer; transition: background var(--transition); flex-shrink: 0;
}
.toggle.active { background: var(--clr-primary); }
.toggle::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle.active::after { transform: translateX(22px); }

/* ══ CARDS ════════════════════════════════════════════════════ */
.card {
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--clr-border-subtle); }
.card-clickable { cursor: pointer; }
.card-clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }

/* Gradient hero card */
.hero-card {
  background: linear-gradient(135deg, #00C896 0%, #0284C7 100%);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  position: relative;
  overflow: hidden;
  border: none;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 20px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

/* ══ BADGES ═══════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
}
.badge-primary  { background: var(--clr-primary-glow);  color: var(--clr-primary); }
.badge-income   { background: rgba(52,211,153,0.15);     color: var(--clr-income); }
.badge-expense  { background: rgba(248,113,113,0.15);    color: var(--clr-expense); }
.badge-warning  { background: rgba(251,191,36,0.15);     color: var(--clr-warning); }
.badge-info     { background: rgba(56,189,248,0.15);     color: var(--clr-info); }
.badge-muted    { background: rgba(148,163,184,0.1);     color: var(--clr-text-muted); }

/* ══ PROGRESS BARS ════════════════════════════════════════════ */
.progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.8125rem; color: var(--clr-text-muted);
}
.progress-track {
  height: 8px; background: var(--clr-border-subtle);
  border-radius: var(--r-full); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: var(--grad-primary);
  transition: width 0.6s var(--ease);
}
.progress-fill.warning { background: linear-gradient(90deg, var(--clr-warning), #F59E0B); }
.progress-fill.danger  { background: var(--grad-expense); }

/* ══ MODALS ═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border-subtle);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  width: 100%; max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(24px) scale(0.97);
  transition: transform var(--transition);
  position: relative;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: var(--sp-5); right: var(--sp-5);
  background: var(--clr-card); border: none;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--clr-text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--clr-border-subtle); color: var(--clr-text); }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin-bottom: var(--sp-6); }

/* ══ TOAST NOTIFICATIONS ══════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 360px; width: 100%;
}
.toast {
  background: var(--clr-card);
  border: 1px solid var(--clr-border-subtle);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex; align-items: flex-start; gap: var(--sp-3);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.35s var(--ease);
}
.toast.show { transform: translateX(0); }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.toast-msg   { font-size: 0.8125rem; color: var(--clr-text-muted); }
.toast.success { border-left: 3px solid var(--clr-income); }
.toast.error   { border-left: 3px solid var(--clr-expense); }
.toast.warning { border-left: 3px solid var(--clr-warning); }
.toast.info    { border-left: 3px solid var(--clr-info); }

/* ══ CHIP SELECTOR ════════════════════════════════════════════ */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: var(--clr-card);
  border: 1.5px solid var(--clr-border-subtle);
  color: var(--clr-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.chip.active {
  background: var(--clr-primary-glow);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

/* ══ DIVIDER ══════════════════════════════════════════════════ */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--clr-text-muted); font-size: 0.875rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  border-top: 1px solid var(--clr-border-subtle);
}

/* ══ EMPTY STATE ══════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--sp-4);
  padding: var(--sp-16) var(--sp-6);
  text-align: center;
}
.empty-icon {
  width: 72px; height: 72px;
  background: var(--clr-card);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-text-muted);
}
.empty-state h4 { color: var(--clr-text-secondary); }
.empty-state p  { color: var(--clr-text-muted); font-size: 0.9rem; max-width: 280px; }

/* ══ AVATAR ═══════════════════════════════════════════════════ */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1rem; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg  { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar-xl  { width: 80px; height: 80px; font-size: 1.75rem; }

/* ══ CATEGORY ICON ════════════════════════════════════════════ */
.cat-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ══ SKELETON LOADER ══════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--clr-card) 25%, var(--clr-card-hover) 50%, var(--clr-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ══ FAB ══════════════════════════════════════════════════════ */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 56px; height: 56px;
  background: var(--grad-primary);
  border: none; border-radius: 50%;
  color: #fff; cursor: pointer;
  box-shadow: var(--shadow-glow);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  transition: var(--transition);
}
.fab:hover { transform: scale(1.1); box-shadow: 0 12px 32px rgba(0,200,150,0.5); }

/* ══ ANIMATIONS ═══════════════════════════════════════════════ */
@keyframes spin          { to { transform: rotate(360deg); } }
@keyframes fade-in       { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up      { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes slide-down    { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: none; } }
@keyframes scale-in      { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse-glow    { 0%,100% { box-shadow: 0 0 0 0 var(--clr-primary-glow); } 50% { box-shadow: 0 0 0 8px transparent; } }

.animate-fade-in  { animation: fade-in  0.4s var(--ease) both; }
.animate-slide-up { animation: slide-up 0.4s var(--ease) both; }
.animate-scale-in { animation: scale-in 0.3s var(--ease) both; }

/* Staggered children */
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }
