/*
 * Button Styles – 4D King Results
 *
 * Covers download button, draw navigation buttons,
 * loading spinner, and centring utility.
 */

/* -------------------------------------------------------------------------- */
/*  1. Download Button (block‑level flex, always centrable)                   */
/* -------------------------------------------------------------------------- */
.download-btn {
  display: flex;                        /* block‑level flex so we can use margin auto */
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;                   /* shrink to content width */
  max-width: 90%;                       /* prevent touching edges on tiny screens */
  margin: 0;                            /* reset default margin */
  background: var(--primary-red);
  color: var(--white);
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* SVG inside the button must be inline‑flex and not overridden by global reset */
.download-btn svg {
  display: block;               /* already the global reset, but ensure it behaves */
  flex-shrink: 0;
}

/* Hover and active states */
.download-btn:hover {
  background: var(--primary-hover, #a00000);
  transform: translateY(-1px);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn:disabled,
.download-btn.loading {
  opacity: 0.7;
  cursor: progress;
  transform: none;
}

/* -------------------------------------------------------------------------- */
/*  2. Centring Utility – add .center‑btn to any button to centre it          */
/* -------------------------------------------------------------------------- */
.center-btn {
  display: flex;                /* keep flex alignment */
  margin-left: auto;
  margin-right: auto;
}

/* If you specifically want extra top/bottom space, add it here */
.download-btn.center-btn {
  margin-top: 20px;
  margin-bottom: 20px;
}

/* -------------------------------------------------------------------------- */
/*  3. Loading Spinner                                                        */
/* -------------------------------------------------------------------------- */
.download-btn .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 0.7s linear infinite;
}

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

/* -------------------------------------------------------------------------- */
/*  4. Draw Navigation Buttons (Previous / Next)                              */
/* -------------------------------------------------------------------------- */
.draw-nav-btn {
  display: inline-block;
  padding: 8px 10px;
  border: 2px solid var(--primary-red);
  color: var(--primary-red);
  border-radius: 30px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.draw-nav-btn:hover {
  background: var(--primary-red);
  color: var(--white);
}

.draw-nav-btn.disabled,
span.draw-nav-btn {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

/* -------------------------------------------------------------------------- */
/*  5. Reload Button (used in some navigation)                                */
/* -------------------------------------------------------------------------- */
.reload-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 30px;
  background: var(--white);
  color: var(--primary-red);
  border: 3px solid var(--primary-red);
  border-radius: 30px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  gap: 6px;
}

.reload-btn:hover {
  background: var(--primary-red);
  color: var(--white);
}

/* -------------------------------------------------------------------------- */
/*  6. Responsive                                                             */
/* -------------------------------------------------------------------------- */

/* --- Tablet (≤1024px) --- */
@media (max-width: 1024px) {
  .download-btn {
    max-width: 100%;
  }
}

/* --- Mobile (≤480px) --- */
@media (max-width: 480px) {
  .download-btn,
  .reload-btn {
    width: 100%;
    max-width: 100%;
    text-align: center;
    justify-content: center;
  }
  .draw-nav-btn {
    padding: 8px 12px;
  }

  .download-btn.center-btn {
    margin: 15px auto;
  }

  /* Ensure comfortable tap targets (~44px) once buttons stack full-width */
  .draw-nav-btn {
    padding: 14px 24px;
  }

  .reload-btn {
    padding: 14px 24px;
  }
}