/**
 * styles.css — ShearGenius SlicePay Portal
 *
 * Branding: Matches sheargenius.com.au
 * - Headings: Playfair Display (serif)
 * - Body: Questrial (sans-serif)
 * - Primary: #D4AF37 (gold)
 * - Background: #0a0a0a (near-black)
 */

/* ════════════════════════════════════════════════════════════
   Reset & Base
   ════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #D4AF37;
  --gold-dark: #B8960B;
  --gold-light: #E8CC6E;
  --black: #0a0a0a;
  --dark: #111111;
  --dark-card: #1a1a1a;
  --dark-border: #3a3a3a;
  --dark-input: #ffffff;
  --white: #ffffff;
  --white-muted: rgba(255, 255, 255, 0.85);
  --white-faint: rgba(255, 255, 255, 0.55);
  --error: #e74c3c;
  --success: #2ecc71;
  --radius: 2px;
  --radius-lg: 4px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Questrial', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--black);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* ════════════════════════════════════════════════════════════
   Header
   ════════════════════════════════════════════════════════════ */

.sg-header {
  border-bottom: 1px solid var(--dark-border);
  padding: 1rem 2rem;
}

.sg-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sg-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 3px;
  color: var(--white);
  text-decoration: none;
}

.sg-logo:hover {
  opacity: 1;
  color: var(--gold);
}

.sg-header__tagline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  color: var(--gold);
  letter-spacing: 2px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   Hero Section
   ════════════════════════════════════════════════════════════ */

.sg-hero {
  padding: 3rem 2rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--dark-border);
  background: linear-gradient(180deg, var(--dark) 0%, var(--black) 100%);
}

.sg-hero__inner {
  max-width: 700px;
  margin: 0 auto;
}

.sg-hero__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
}

.sg-hero__subtitle {
  font-size: 1.05rem;
  color: var(--white-muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.sg-hero__subtitle strong {
  color: var(--gold);
  font-weight: 400;
}

/* Steps indicator */
.sg-hero__steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sg-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sg-step__number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--gold);
  flex-shrink: 0;
}

.sg-step__text {
  font-size: 0.8rem;
  color: var(--white-muted);
  white-space: nowrap;
}

.sg-step__divider {
  width: 24px;
  height: 1px;
  background: var(--dark-border);
}

/* ════════════════════════════════════════════════════════════
   Main Layout
   ════════════════════════════════════════════════════════════ */

.sg-main {
  flex: 1;
  padding: 2.5rem 2rem;
}

.sg-main__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2.5rem;
  align-items: start;
}

/* ════════════════════════════════════════════════════════════
   Form Column
   ════════════════════════════════════════════════════════════ */

.sg-form-column {
  min-width: 0;
}

/* Fieldset */
.sg-fieldset {
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--dark-card);
}

.sg-fieldset__legend {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sg-fieldset__badge {
  font-family: 'Questrial', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--success);
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sg-fieldset__badge svg {
  stroke: var(--success);
}

/* Field */
.sg-field {
  margin-bottom: 1rem;
  flex: 1;
}

.sg-field:last-child {
  margin-bottom: 0;
}

.sg-field--small {
  flex: 0 0 120px;
}

.sg-label {
  display: block;
  font-size: 0.82rem;
  color: var(--white);
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.sg-input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  color: #111111;
  font-family: 'Questrial', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.sg-input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

/* Autofill styling */
.sg-input:-webkit-autofill,
.sg-input:-webkit-autofill:hover,
.sg-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 30px #ffffff inset;
  -webkit-text-fill-color: #111111;
  border-color: var(--gold);
}

.sg-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.sg-input.sg-input--error {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

/* Select dropdown */
.sg-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Price input with dollar sign prefix */
.sg-input-prefix {
  position: relative;
}

.sg-input-prefix__symbol {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(0, 0, 0, 0.5);
  font-size: 0.95rem;
  pointer-events: none;
}

.sg-input--prefixed {
  padding-left: 1.75rem;
}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Field rows */
.sg-field-row {
  display: flex;
  gap: 1rem;
}

.sg-field-row--three {
  display: flex;
  gap: 1rem;
}

/* ════════════════════════════════════════════════════════════
   Square Card Container
   ════════════════════════════════════════════════════════════ */

.sg-card-container {
  min-height: 56px;
  padding: 0;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid var(--dark-border);
  overflow: hidden;
  transition: border-color 0.2s;
}

.sg-card-container:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.sg-card-loading {
  padding: 1rem;
  color: var(--white-faint);
  font-size: 0.85rem;
  text-align: center;
}

.sg-card-note {
  font-size: 0.75rem;
  color: var(--white-faint);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ════════════════════════════════════════════════════════════
   Terms Checkbox
   ════════════════════════════════════════════════════════════ */

.sg-terms {
  margin-bottom: 1.25rem;
}

.sg-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--white-muted);
  line-height: 1.5;
}

.sg-checkbox-label input[type="checkbox"] {
  display: none;
}

.sg-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  background: #ffffff;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: all 0.2s;
}

.sg-checkbox-label input:checked + .sg-checkbox-custom {
  background: var(--gold);
  border-color: var(--gold);
}

.sg-checkbox-label input:checked + .sg-checkbox-custom::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--black);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.sg-checkbox-text strong {
  color: var(--gold);
  font-weight: 400;
}

/* ════════════════════════════════════════════════════════════
   Error Box
   ════════════════════════════════════════════════════════════ */

.sg-error-box {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #e74c3c;
}

.sg-error-box svg {
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   Submit Button
   ════════════════════════════════════════════════════════════ */

.sg-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 2rem;
  background: var(--gold);
  color: var(--black);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-family: 'Questrial', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  text-decoration: none;
}

.sg-submit-btn:hover:not(:disabled) {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}

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

.sg-submit-btn--modal {
  margin-top: 1.5rem;
}

/* Spinner */
.sg-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}

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

/* ════════════════════════════════════════════════════════════
   Summary Column
   ════════════════════════════════════════════════════════════ */

.sg-summary-column {
  position: sticky;
  top: 2rem;
}

.sg-summary {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.sg-summary__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--dark-border);
}

.sg-summary__product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.sg-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.sg-summary__row--total {
  margin-bottom: 0.5rem;
}

.sg-summary__row--highlight {
  background: rgba(212, 175, 55, 0.08);
  margin: 0 -1.5rem;
  padding: 0.75rem 1.5rem;
}

.sg-summary__row--final {
  padding-top: 0.75rem;
}

.sg-summary__label {
  font-size: 0.85rem;
  color: var(--white-muted);
}

.sg-summary__sublabel {
  font-size: 0.75rem;
  color: var(--white-faint);
  margin-left: 0.25rem;
}

.sg-summary__value {
  font-size: 0.95rem;
  color: var(--white);
  font-weight: 400;
}

.sg-summary__value--gold {
  color: var(--gold);
  font-size: 1.15rem;
}

.sg-summary__divider {
  height: 1px;
  background: var(--dark-border);
  margin: 0.5rem 0;
}

.sg-summary__zero-interest {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gold);
  padding: 0.75rem 0;
  letter-spacing: 1px;
}

/* Weekly Breakdown Toggle */
.sg-summary__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  background: transparent;
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  color: var(--white-muted);
  font-family: 'Questrial', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sg-summary__toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.sg-summary__toggle.sg-summary__toggle--open svg {
  transform: rotate(180deg);
}

/* Weekly Breakdown Table */
.sg-breakdown {
  margin-top: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.sg-breakdown__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.sg-breakdown__table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  color: var(--white-faint);
  border-bottom: 1px solid var(--dark-border);
  font-weight: 400;
  position: sticky;
  top: 0;
  background: var(--dark-card);
}

.sg-breakdown__table td {
  padding: 0.35rem 0.5rem;
  color: var(--white-muted);
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

.sg-breakdown__table tr:last-child td {
  border-bottom: none;
}

/* Scrollbar styling for breakdown */
.sg-breakdown::-webkit-scrollbar {
  width: 4px;
}
.sg-breakdown::-webkit-scrollbar-track {
  background: transparent;
}
.sg-breakdown::-webkit-scrollbar-thumb {
  background: var(--dark-border);
  border-radius: 2px;
}

/* Trust Signals */
.sg-trust {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--dark-border);
}

.sg-trust__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--white-faint);
}

/* ════════════════════════════════════════════════════════════
   Success Modal
   ════════════════════════════════════════════════════════════ */

.sg-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.sg-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.sg-modal__content {
  position: relative;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.sg-modal__icon {
  margin-bottom: 1rem;
}

.sg-modal__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.sg-modal__message {
  color: var(--white-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.sg-modal__details {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.sg-modal__detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  min-width: 100px;
}

.sg-modal__detail span {
  font-size: 0.7rem;
  color: var(--white-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sg-modal__detail strong {
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 400;
}

.sg-modal__note {
  font-size: 0.82rem;
  color: var(--white-faint);
}

/* ════════════════════════════════════════════════════════════
   Footer
   ════════════════════════════════════════════════════════════ */

.sg-footer {
  border-top: 1px solid var(--dark-border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--white-faint);
}

.sg-footer__links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.sg-footer__links a {
  color: var(--white-faint);
  transition: color 0.2s;
}

.sg-footer__links a:hover {
  color: var(--gold);
}

/* ════════════════════════════════════════════════════════════
   Responsive
   ════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .sg-main__inner {
    grid-template-columns: 1fr;
  }

  .sg-summary-column {
    position: static;
    order: -1;
  }

  .sg-hero__title {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .sg-header {
    padding: 0.75rem 1rem;
  }

  .sg-hero {
    padding: 2rem 1rem 1.5rem;
  }

  .sg-hero__title {
    font-size: 1.75rem;
  }

  .sg-hero__steps {
    gap: 0.25rem;
  }

  .sg-step__divider {
    width: 12px;
  }

  .sg-step__text {
    font-size: 0.7rem;
  }

  .sg-main {
    padding: 1.5rem 1rem;
  }

  .sg-fieldset {
    padding: 1rem;
  }

  .sg-field-row {
    flex-direction: column;
    gap: 0;
  }

  .sg-field-row--three {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sg-field-row--three .sg-field:first-child {
    flex: 1 1 100%;
  }

  .sg-field--small {
    flex: 1 1 auto;
  }

  .sg-modal__details {
    flex-direction: column;
    align-items: center;
  }

  .sg-modal__detail {
    width: 100%;
  }

  .sg-modal__content {
    padding: 1.5rem;
  }
}
