/* ========================================
   ExpenseIQ — Core Components CSS
   ======================================== */

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 700;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { width: 16px; height: 16px; transition: transform var(--transition-fast); }
.btn:hover svg { transform: scale(1.1); }
.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
}
.btn:active {
  transform: translateY(0) scale(0.96);
}

.btn-sm { padding: 8px 16px; font-size: 12px; border-radius: var(--radius-md); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-md); }

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px var(--accent-primary-glow);
  transition: var(--transition-spring);
}
.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 8px 24px var(--accent-primary-glow);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  transition: var(--transition-spring);
}
.btn-secondary:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-card-hover);
  color: var(--accent-primary);
}

.btn-soft {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}
.btn-soft:hover {
  background: rgba(94, 95, 240, 0.2);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-expense);
  color: white;
}
.btn-danger:hover {
  background: var(--color-expense-hover);
  box-shadow: 0 4px 12px rgba(224, 60, 92, 0.2);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* ═══ FORM ELEMENTS ═══ */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .form-select {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-base);
  font-weight: 500;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}
.form-input-lg {
  height: 64px;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-secondary); color: var(--text-primary); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: 20px 0;
  position: relative;
  font-weight: 700;
  letter-spacing: 1px;
}
.form-divider::before, .form-divider::after {
  content: ''; position: absolute; top: 50%; width: 38%;
  height: 1px; background: var(--glass-border);
}
.form-divider::before { left: 0; }
.form-divider::after { right: 0; }

/* Type Toggle Selection */
.type-toggle {
  display: flex;
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-input);
  padding: 4px;
}
.type-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
}
.type-btn.active.expense-btn { background: var(--color-expense); color: white; }
.type-btn.active.income-btn { background: var(--color-income); color: white; }

/* ═══ PILLS ═══ */
.pills { display: flex; gap: 6px; }
.pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
}
.pill:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* ═══ CARDS ═══ */
.chart-card, .recent-transactions-card, .budget-overview-card, .premium-card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 24px;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.chart-card::after, .recent-transactions-card::after, .budget-overview-card::after, .premium-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, var(--accent-primary) 50%, var(--accent-secondary) 60%, transparent 70%);
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  opacity: 0;
}

.chart-card:hover::after, .recent-transactions-card:hover::after, .budget-overview-card:hover::after, .premium-card:hover::after {
  opacity: 1;
  animation: borderGlow 3s infinite linear;
}

.chart-card:hover, .recent-transactions-card:hover, .budget-overview-card:hover, .premium-card:hover {
  border-color: transparent;
  box-shadow: var(--shadow-xl), 0 0 20px rgba(99, 102, 241, 0.15);
  transform: translateY(-4px) scale(1.008);
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.section-link {
  font-size: 12px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  transition: color var(--transition-fast);
  text-decoration: none;
}
.section-link:hover { color: var(--accent-primary-hover); }
.section-link svg { width: 14px; height: 14px; }
.chart-container { height: 260px; position: relative; }

/* ═══ PROGRESS BAR ═══ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  transition: width 0.5s ease;
}
.progress-bar-fill.green { background: var(--color-income); }
.progress-bar-fill.yellow { background: var(--color-warning); }
.progress-bar-fill.red { background: var(--color-expense); }
.progress-bar-fill.overbudget {
  background: linear-gradient(90deg, var(--color-expense), #ff0000);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 20px;
  border: 1px solid var(--glass-border);
}
.empty-state-icon svg { width: 24px; height: 24px; }
.empty-state-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; color: var(--text-primary); }
.empty-state-message { font-size: 13px; color: var(--text-secondary); max-width: 320px; line-height: 1.5; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-modal);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 36px;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-xl);
  position: relative;
}
.modal-lg { max-width: 640px; }
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
}
.modal-close:hover { background: var(--color-expense-bg); color: var(--color-expense); }
.modal-close svg { width: 16px; height: 16px; }
.modal-title { font-size: 22px; font-weight: 900; margin-bottom: 24px; color: var(--text-primary); letter-spacing: -0.5px; }

/* ═══ CONFIRM DIALOG ═══ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-modal);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.25s ease;
  box-shadow: var(--shadow-xl);
}
.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.confirm-icon svg { width: 24px; height: 24px; }
.confirm-icon.danger { background: var(--color-expense-bg); color: var(--color-expense); }
.confirm-icon.warning { background: var(--color-warning-bg); color: var(--color-warning); }
.confirm-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; color: var(--text-primary); }
.confirm-message { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: calc(100vw - 48px);
}
.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.toast-icon svg { width: 18px; height: 18px; }

.toast.success { border-color: rgba(15, 169, 104, 0.2); }
.toast.success .toast-icon { background: var(--color-income-bg); color: var(--color-income); }

.toast.error { border-color: rgba(224, 60, 92, 0.2); }
.toast.error .toast-icon { background: var(--color-expense-bg); color: var(--color-expense); }

.toast.warning { border-color: rgba(229, 139, 18, 0.2); }
.toast.warning .toast-icon { background: var(--color-warning-bg); color: var(--color-warning); }

.toast.info { border-color: rgba(37, 99, 235, 0.2); }
.toast.info .toast-icon { background: var(--color-info-bg); color: var(--color-info); }

.toast-body { flex: 1; }
.toast-title { font-size: 14px; font-weight: 800; margin-bottom: 2px; color: var(--text-primary); }
.toast-message { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.toast-close {
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toast-close svg { width: 14px; height: 14px; }
.toast-close:hover { color: var(--text-primary); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-primary);
  animation: progressShrink linear forwards;
}
.toast-undo {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
}
.toast-undo:hover { text-decoration: underline; }

/* ═══ TRANSACTION ROW ═══ */
.transaction-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
}
.transaction-row:last-child { border-bottom: none; }
.transaction-row:hover {
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  margin: 0 -10px;
}
.transaction-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.transaction-icon svg { width: 18px; height: 18px; }
.transaction-details { flex: 1; min-width: 0; }
.transaction-name { font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaction-category { font-size: 12px; color: var(--text-secondary); margin-top: 2px; font-weight: 600; }
.transaction-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.transaction-amount {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.transaction-amount.income { color: var(--color-income); }
.transaction-amount.expense { color: var(--color-expense); }
.transaction-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition-fast); }
.transaction-row:hover .transaction-actions { opacity: 1; }

/* ═══ COLOR PICKER ═══ */
.color-picker-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.color-option {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  cursor: pointer; transition: all var(--transition-fast);
  border: 2px solid transparent;
}
.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: white; box-shadow: 0 0 0 2px var(--accent-primary); transform: scale(1.15); }

/* ═══ TOGGLE SWITCH ═══ */
.toggle-switch { position: relative; display: inline-flex; align-items: center; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  width: 44px; height: 24px; background: var(--bg-tertiary);
  border-radius: var(--radius-full); cursor: pointer;
  transition: background var(--transition-fast); position: relative;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; transition: transform var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(20px); }

/* ═══ BADGES & MISC ═══ */
.badge { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.5px; }
.badge-default { background: var(--bg-tertiary); color: var(--text-secondary); }
.text-center { text-align: center; }
.text-xs { font-size: var(--text-xs); }
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--glass-border); }
.summary-table th { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.summary-table td { font-size: 14px; color: var(--text-secondary); }

/* ═══ FILTER PANEL ═══ */
.filter-panel { display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-search-wrap { position: relative; flex: 1; min-width: 200px; }
.filter-search-wrap .filter-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.filter-search-wrap input { padding-left: 36px; }
.filter-date-input { max-width: 160px; }
.filter-amount-input { max-width: 120px; }
.filter-category-select { min-height: 42px; max-width: 300px; }
.type-pills { display: flex; gap: 4px; }

@media (max-width: 768px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-date-input, .filter-amount-input { max-width: 100%; }
  .toast-container { max-width: 320px; right: 8px; }
}

/* ═══ SMS SETUP PROMPT ═══ */
.sms-prompt-card {
  position: fixed; bottom: 84px; right: 24px; z-index: 150;
  width: 340px; background: var(--bg-secondary);
  border: 1px solid var(--accent-primary); border-radius: var(--radius-xl);
  padding: 24px; box-shadow: var(--shadow-xl);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.sms-prompt-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sms-prompt-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--accent-primary-glow); color: var(--accent-primary);
  display: flex; align-items: center; justify-content: center;
}
.sms-prompt-icon svg { width: 20px; height: 20px; }
.sms-prompt-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.sms-prompt-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.sms-prompt-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (max-width: 768px) {
  .sms-prompt-card { left: 16px; right: 16px; width: auto; bottom: 80px; }
}

/* Spotlight Command Center */
.command-center {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  transition: opacity var(--transition-base);
  opacity: 0;
  pointer-events: none;
}
.command-center.active {
  opacity: 1;
  pointer-events: auto;
}
.command-center-modal {
  width: 90%;
  max-width: 580px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(-20px) scale(0.98);
  transition: transform var(--transition-spring);
}
.command-center.active .command-center-modal {
  transform: translateY(0) scale(1);
}
.command-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.command-search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}
#command-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}
#command-search-input::placeholder {
  color: var(--text-muted);
}
.command-esc-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
}
.command-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}
.command-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.command-item i {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}
.command-item:hover, .command-item.selected {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}
.command-item:hover i, .command-item.selected i {
  color: var(--accent-primary);
}
.command-item-shortcut {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Premium Glass Shimmer Loaders */
.skeleton-shimmer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
  padding: 24px;
}
.skeleton-header-shimmer {
  width: 280px;
  height: 38px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.skeleton-grid-shimmer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.skeleton-card-shimmer {
  height: 140px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}
.skeleton-body-shimmer {
  height: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

/* Linear Glass Shimmer Effect */
.skeleton-header-shimmer::after,
.skeleton-card-shimmer::after,
.skeleton-body-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  animation: shimmerAnim 1.6s infinite;
}

[data-theme="light"] .skeleton-header-shimmer::after,
[data-theme="light"] .skeleton-card-shimmer::after,
[data-theme="light"] .skeleton-body-shimmer::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(99, 102, 241, 0.04),
    transparent
  );
}

@keyframes shimmerAnim {
  100% { transform: translateX(100%); }
}
