/**
 * buttons.css - Consolidated button styles
 * Replaces: .cta-button, .calc-btn-primary/secondary/ghost,
 * .primary-btn, .secondary-btn, .icon-btn, .add-button,
 * .pricing-btn-primary/secondary, .gradient-btn, .questionnaire-btn
 */

/* ==========================================================================
   CTA Button - Gradient background, shadow, hover lift
   ========================================================================== */

.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-gradient);
  color: var(--text-on-brand);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-primary-sm);
  transition: all 0.2s;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.btn-cta:active {
  transform: translateY(0);
  box-shadow: var(--shadow-primary-sm);
}

.btn-cta.primary {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-cta.secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  box-shadow: none;
}

.btn-cta.secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-cta.large {
  padding: 1.25rem 2.5rem;
  font-size: 1.2rem;
}

/* CTA variants used on homepage & feature pages */
.cta-primary {
  padding: 1.1rem 2.5rem;
  font-size: 1.1rem;
}

.cta-large {
  padding: 1.25rem 3rem;
  font-size: 1.15rem;
}

/* ==========================================================================
   Secondary Button - Outlined with primary color border
   ========================================================================== */

.secondary-button {
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-block;
  background: transparent;
}

.secondary-button:hover {
  background: var(--color-primary);
  color: var(--text-inverse);
}

/* ==========================================================================
   Primary Button - Solid primary background
   ========================================================================== */

.btn-primary,
a.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary:hover,
a.btn-primary:hover {
  background: var(--color-primary-hover);
}

/* ==========================================================================
   Secondary Button - Outlined/light background
   ========================================================================== */

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-secondary);
}

/* ==========================================================================
   Ghost Button - Transparent background
   ========================================================================== */

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover,
.btn-icon:hover {
  background: var(--bg-tertiary);
}

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

/* ==========================================================================
   Icon Button - Small square icon button
   ========================================================================== */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.btn-icon:hover { color: var(--text-primary); }

.btn-icon.danger:hover {
  background: var(--color-error-bg);
  color: var(--color-error-light);
}

/* ==========================================================================
   Shared Button States
   ========================================================================== */

.btn-cta:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-icon:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   Action Buttons (inline table actions)
   ========================================================================== */

.action-btn {
  padding: 0.4rem 0.6rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
}

.update-btn,
.save-btn {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.update-btn:hover,
.save-btn:hover {
  background: var(--color-success-border);
}

.edit-btn,
.edit-icon-btn {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}

.edit-btn:hover,
.edit-icon-btn:hover {
  background: var(--color-info-border);
}

.history-btn,
.cancel-edit-btn {
  background: var(--bg-tertiary);
}

.history-btn:hover,
.cancel-edit-btn:hover {
  background: var(--bg-muted);
}

.history-btn { color: var(--color-secondary); }

.delete-btn,
.delete-icon-btn {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.delete-btn:hover,
.delete-icon-btn:hover {
  background: var(--color-error-border);
}

.view-btn {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.view-btn:hover {
  background: var(--color-warning-border);
}

/* Icon variants (history modal inline actions) */
.history-icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  padding: 0;
}

/* NOTE: .edit-icon-btn merged with .edit-btn above */
/* NOTE: .delete-icon-btn merged with .delete-btn above */
/* NOTE: .save-btn merged with .update-btn above */

.cancel-edit-btn { color: var(--text-muted); }

/* ==========================================================================
   Component Button Overrides
   ========================================================================== */

/* -- cancel-btn: overrides on top of btn-secondary -- */
.cancel-btn {
  padding: 0.75rem 1rem;
  border: none;
}

/* -- submit-btn: overrides on top of btn-primary -- */
.submit-btn {
  padding: 0.75rem 1rem;
}

/* -- add-entry-btn: overrides on top of btn-primary -- */
.add-entry-btn {
  padding: 0.5rem 1rem;
  height: fit-content;
}

/* -- position-collapse-btn: overrides on top of btn-ghost -- */
.position-collapse-btn {
  padding: 4px;
  font-size: 14px;
}

.position-collapse-btn:hover {
  background: transparent;
  color: var(--text-secondary);
}

/* -- position-transaction-btn / account-action-btn: overrides on top of btn-icon -- */
.position-transaction-btn,
.account-action-btn {
  width: auto;
  height: auto;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

/* -- generate-first-snapshot-btn: overrides on top of btn-cta -- */
.no-snapshot-welcome-card .generate-first-snapshot-btn {
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  box-shadow: var(--shadow-primary);
}

.no-snapshot-welcome-card .generate-first-snapshot-btn:hover:not(:disabled) {
  box-shadow: var(--shadow-primary-glow);
}

.no-snapshot-welcome-card .generate-first-snapshot-btn:disabled {
  opacity: 0.7;
}

.no-snapshot-welcome-card .generate-first-snapshot-btn .spinner {
  animation: spin 1s linear infinite;
}

/* -- premium-upgrade-btn: overrides on top of btn-cta -- */
.premium-upgrade-btn {
  font-weight: 500;
  box-shadow: none;
}

/* NOTE: .premium-features-card .premium-upgrade-btn is in cards.css */

/* -- retry-btn: overrides on top of btn-primary -- */
.retry-btn {
  margin-top: 0.5rem;
}

/* -- view-analysis-btn: overrides on top of btn-cta -- */
.view-analysis-btn {
  display: flex;
  width: calc(100% - 2rem);
  margin: 0 auto;
  padding: 0.875rem;
  background: var(--gradient-btn-primary);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  box-shadow: none;
}

.view-analysis-btn:hover {
  box-shadow: var(--shadow-info-lg);
}

.view-analysis-btn.disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0.8;
}

.view-analysis-btn.disabled:hover {
  transform: translateY(-1px);
  background: var(--color-primary);
  color: var(--text-inverse);
  opacity: 1;
}

/* -- show-more-btn: overrides on top of btn-secondary -- */
.show-more-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* -- show-advanced-btn: overrides on top of btn-ghost -- */
.show-advanced-btn {
  color: var(--color-primary);
  font-size: 0.875rem;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
}

.show-advanced-btn:hover {
  background: transparent;
  text-decoration: underline;
}

/* -- goal-mark-complete-btn: overrides on top of btn-cta -- */
.goal-mark-complete-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--gradient-btn-success);
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-success-sm);
  animation: gentlePulse 2s ease-in-out infinite;
}

.goal-mark-complete-btn:hover {
  background: var(--gradient-btn-success-hover);
  box-shadow: var(--shadow-success);
  transform: translateY(-1px);
  animation: none;
}

.goal-mark-complete-btn:active {
  transform: translateY(0);
}

@keyframes gentlePulse {
  0%, 100% {
    box-shadow: var(--shadow-success-sm);
  }
  50% {
    box-shadow: var(--shadow-success);
  }
}

/* -- refresh/backfill-snapshot-btn: overrides on top of btn-secondary -- */
.refresh-snapshot-btn,
.backfill-snapshot-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-primary-soft);
  background: linear-gradient(135deg, var(--bg-primary-subtle) 0%, var(--bg-secondary-subtle) 100%);
  color: var(--color-primary);
  gap: 4px;
}

.refresh-snapshot-btn:hover:not(:disabled),
.backfill-snapshot-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--bg-info-subtle) 0%, var(--bg-info-subtle) 100%);
  border-color: var(--border-info-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-info-sm);
}

.refresh-snapshot-btn:disabled,
.backfill-snapshot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.refresh-snapshot-btn:disabled {
  animation: spin 1s linear infinite;
}

/* -- goals-add-button: overrides on top of btn-secondary -- */
.goals-add-button {
  padding: 0.625rem 1.125rem;
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  gap: 0.375rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

.goals-add-button:hover {
  border-color: var(--border-secondary);
  background: var(--bg-secondary);
}

.goals-add-button span:first-child {
  font-size: 1.125rem;
}

@media (max-width: 768px) {
  .goals-add-button {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Tab Buttons — Shared tab/mode toggle pattern
   ========================================================================== */

.tab-btn,
.mode-tab,
.tier-filter-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.tab-btn:hover,
.mode-tab:hover,
.tier-filter-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.tab-btn.active,
.mode-tab.active,
.tier-filter-btn.active {
  background: var(--color-primary);
  color: var(--text-inverse);
  border-color: var(--color-primary);
}

/* Tier filter specific active colors */
.tier-filter-btn.tier-platinum.active { background: var(--color-tier-platinum-bg); color: var(--color-tier-platinum-text); border-color: var(--color-tier-platinum-border); }
.tier-filter-btn.tier-gold.active { background: var(--color-tier-gold-bg); color: var(--color-tier-gold-text); border-color: var(--color-tier-gold-border); }
.tier-filter-btn.tier-silver.active { background: var(--color-tier-silver-bg); color: var(--color-tier-silver-text); border-color: var(--color-tier-silver-border); }
.tier-filter-btn.tier-bronze.active { background: var(--color-tier-bronze-bg); color: var(--color-tier-bronze-text); border-color: var(--color-tier-bronze-border); }

/* Quick Add FAB Button (mobile) */
.quick-add-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--text-inverse);
  border: none;
  box-shadow: var(--shadow-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 100;
}

.quick-add-fab:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-primary-lg);
}

@media (min-width: 768px) {
  .quick-add-fab {
    display: none;
  }
}

/* ==========================================================================
   Share Buttons (moved from shared-styles.css)
   ========================================================================== */

.share-buttons {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  display: inline-block;
  width: auto;
  max-width: 100%;
}

.share-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.share-buttons-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
  background: var(--bg-primary);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.share-twitter:hover {
  background: #1da1f2;
  color: white;
  border-color: #1da1f2;
}

.share-facebook:hover {
  background: #4267b2;
  color: white;
  border-color: #4267b2;
}

.share-linkedin:hover {
  background: #0077b5;
  color: white;
  border-color: #0077b5;
}

.share-whatsapp:hover {
  background: #25d366;
  color: white;
  border-color: #25d366;
}

.share-email:hover {
  background: #ea4335;
  color: white;
  border-color: #ea4335;
}

.share-copy:hover {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.copy-feedback {
  font-size: 0.8rem;
  color: var(--color-success);
  margin-top: 0.5rem;
  font-weight: 500;
}

@media (max-width: 480px) {
  .share-buttons-row {
    justify-content: center;
  }

  .share-btn {
    width: 44px;
    height: 44px;
  }
}

/* ==========================================================================
   Goals Expand Button (moved from shared-styles.css)
   ========================================================================== */

.goals-expand-btn {
  font-size: 11px;
  padding: 6px 8px;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  gap: 3px;
}

.goals-expand-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-muted);
}

/* ==========================================================================
   Goals Update Progress Button (moved from shared-styles.css)
   ========================================================================== */

.goals-update-progress-btn {
  background: none;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}

.goals-update-progress-btn:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* NOTE: .account-action-btn merged with .position-transaction-btn above */

/* ==========================================================================
   Paycheck Advisor Submit Button (moved from shared-styles.css)
   ========================================================================== */

.paycheck-advisor-submit-button {
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
}

.paycheck-advisor-submit-button:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: none;
}

.paycheck-advisor-submit-button:disabled {
  opacity: 0.5;
}

/* ==========================================================================
   Time Range Button (moved from portfolio-sections.css)
   ========================================================================== */

.time-range-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-range-btn:hover {
  color: var(--color-primary);
  background: var(--bg-primary-subtle);
}

.time-range-btn.active {
  color: var(--text-inverse);
  background: var(--color-primary);
  box-shadow: var(--shadow-primary-subtle);
}

/* ==========================================================================
   Sector / Region Toggle Buttons (moved from portfolio-sections.css)
   ========================================================================== */

.sector-toggle-btn,
.region-toggle-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 12px;
  background: transparent;
  border: none;
  padding: 8px 0 4px;
  margin-top: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.2s ease;
}

.sector-toggle-btn:hover,
.region-toggle-btn:hover {
  text-decoration: underline;
}

.sector-toggle-btn { color: var(--color-primary); }
.region-toggle-btn { color: var(--color-info); }

/* ==========================================================================
   Danger Button - Solid error background (from expenses.css)
   ========================================================================== */

.btn-danger {
  background: var(--color-error);
  color: var(--text-inverse);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   Leave Button - Outline danger variant (from expenses.css)
   ========================================================================== */

.btn-leave {
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--color-error);
  color: var(--color-error);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-leave:hover {
  background: var(--color-error-bg);
}

/* ==========================================================================
   Small Icon Buttons - remove/deactivate (from expenses.css)
   ========================================================================== */

.remove-btn,
.deactivate-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--color-error-bg);
  color: var(--color-error);
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
}

.copy-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
}

/* ==========================================================================
   Settlement Buttons (from expenses.css)
   ========================================================================== */

.settlements-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settlements-export-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.settlement-delete-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s ease;
}

.settlement-delete-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
}

.settlement-delete-btn.confirm {
  background: var(--color-error);
  color: var(--text-inverse);
}
