/* ═══════════════════════════════════════════════════════════════════
   GLOBAL BUTTON SYSTEM — AbandonedAssetsOS
   ═══════════════════════════════════════════════════════════════════
   Consistent CTA styling across all pages.

   CLASSES:
   - .btn          Base button styles
   - .btn-primary  Strong brand color (rust), high contrast
   - .btn-secondary White bg, subtle border, brand text
   - .btn-outline   Transparent, border only
   - .btn-sm       Small variant
   - .btn-lg       Large variant

   MODIFIERS:
   - :hover        Darken by 10%, subtle shadow
   - :active       Scale down, press effect
   - :disabled     50% opacity, not-allowed cursor
   - .loading      Disabled state with spinner animation
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Button palette — Brand: #FF6B00 (copper/orange) */
  --btn-primary-bg: #FF6B00;
  --btn-primary-hover: #e55f00;
  --btn-primary-text: #ffffff;

  --btn-secondary-bg: #ffffff;
  --btn-secondary-border: #d8d0c4;
  --btn-secondary-text: #0a0a0a;
  --btn-secondary-hover: #f5f0e8;

  --btn-outline-border: #FF6B00;
  --btn-outline-text: #FF6B00;
  --btn-outline-hover: rgba(255, 107, 0, 0.08);

  /* Base sizing */
  --btn-padding-y: 12px;
  --btn-padding-x: 24px;
  --btn-font-size: 16px;
  --btn-font-weight: 600;
  --btn-border-radius: 8px;
  --btn-transition: all 0.15s ease;
}

/* ───────────────────────────────────────────────────────────────── */
/* BASE BUTTON STYLES */
/* ───────────────────────────────────────────────────────────────── */

.btn {
  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--btn-padding-y) var(--btn-padding-x);

  /* Typography */
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  letter-spacing: -0.01em;

  /* Visual */
  border: none;
  border-radius: var(--btn-border-radius);
  cursor: pointer;
  user-select: none;
  transition: var(--btn-transition);
  text-decoration: none;

  /* States */
  white-space: nowrap;
  position: relative;
  overflow: hidden;

  /* Accessibility */
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--btn-primary-hover);
  outline-offset: 2px;
}

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

.btn:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* ───────────────────────────────────────────────────────────────── */
/* PRIMARY BUTTON (Default, High Contrast) */
/* ───────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.2);
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  box-shadow: 0 6px 20px rgba(255, 107, 0, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.15);
  transform: translateY(0) scale(0.98);
}

/* ───────────────────────────────────────────────────────────────── */
/* SECONDARY BUTTON (Subtle, Lower Priority) */
/* ───────────────────────────────────────────────────────────────── */

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover);
  border-color: var(--btn-primary-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.btn-secondary:active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transform: translateY(0) scale(0.98);
}

/* ───────────────────────────────────────────────────────────────── */
/* OUTLINE BUTTON (Transparent, Brand Border) */
/* ───────────────────────────────────────────────────────────────── */

.btn-outline {
  background: transparent;
  color: var(--btn-outline-text);
  border: 2px solid var(--btn-outline-border);
}

.btn-outline:hover {
  background: var(--btn-outline-hover);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.1);
  transform: translateY(-1px);
}

.btn-outline:active {
  transform: translateY(0) scale(0.98);
}

/* ───────────────────────────────────────────────────────────────── */
/* SIZE VARIANTS */
/* ───────────────────────────────────────────────────────────────── */

/* Small button */
.btn-sm {
  --btn-padding-y: 6px;
  --btn-padding-x: 12px;
  --btn-font-size: 14px;
  min-height: 32px;
}

/* Large button */
.btn-lg {
  --btn-padding-y: 14px;
  --btn-padding-x: 32px;
  --btn-font-size: 18px;
  min-height: 48px;
}

/* ───────────────────────────────────────────────────────────────── */
/* BLOCK LAYOUT (Full Width) */
/* ───────────────────────────────────────────────────────────────── */

.btn-block {
  width: 100%;
  display: flex;
}

/* ───────────────────────────────────────────────────────────────── */
/* MOBILE / TOUCH TARGETS */
/* ───────────────────────────────────────────────────────────────── */

/* Ensure minimum 44px height for touch targets */
.btn {
  min-height: 44px;
}

/* On small screens, make buttons full-width with extra padding */
@media (max-width: 600px) {
  .btn-block,
  .btn.mobile-full {
    width: 100%;
    max-width: 100%;
  }

  .btn {
    min-height: 48px;
  }
}

/* ───────────────────────────────────────────────────────────────── */
/* LOADING STATE */
/* ───────────────────────────────────────────────────────────────── */

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin-loader 0.8s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin-loader {
  to {
    transform: rotate(360deg);
  }
}

/* ───────────────────────────────────────────────────────────────── */
/* BUTTON GROUPS (Stacked or Horizontal) */
/* ───────────────────────────────────────────────────────────────── */

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-group.stack {
  flex-direction: column;
}

.btn-group.stack .btn {
  width: 100%;
}

/* ───────────────────────────────────────────────────────────────── */
/* BUTTON WITH ICON */
/* ───────────────────────────────────────────────────────────────── */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-icon-only {
  padding: 12px;
  min-width: 44px;
  justify-content: center;
}

/* ───────────────────────────────────────────────────────────────── */
/* UTILITY: CENTER-ALIGN BUTTONS IN CONTAINERS */
/* ───────────────────────────────────────────────────────────────── */

.button-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.button-center.mobile-stack {
  flex-direction: column;
}

@media (max-width: 600px) {
  .button-center.mobile-stack {
    flex-direction: column;
  }

  .button-center.mobile-stack .btn {
    width: 100%;
  }
}

/* ───────────────────────────────────────────────────────────────── */
/* DARK MODE (if page uses dark bg) */
/* ───────────────────────────────────────────────────────────────── */

/* For pages with dark background (like index.html) */
.dark-bg .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

.dark-bg .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ───────────────────────────────────────────────────────────────── */
/* ACCESSIBILITY: FOCUS STATES FOR KEYBOARD USERS */
/* ───────────────────────────────────────────────────────────────── */

/* Ensure keyboard navigation is visible */
.btn:focus {
  outline: 2px solid var(--btn-primary-hover);
  outline-offset: 2px;
}

/* Don't show outline on mouse clicks (only keyboard) */
.btn:focus:not(:focus-visible) {
  outline: none;
}
