/* new-form.css — base style adapted to project classes */

body {
  background: #fcf9f4;
  transition: background 3s ease;
}
/* Dark overlay — radial gradient keeps header/footer readable while focusing on form */
.page-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 90% 60% at 50% 45%,
    rgba(20, 20, 20, 0.22),
    rgba(20, 20, 20, 0.09)
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 3s ease;
  z-index: 1;
}
/* Active state after page load */
.page-loaded .page-overlay {
  opacity: 1;
}

/* Slightly lighter overlay on mobile so text stays readable */
@media (max-width: 768px) {
  .page-overlay {
    background: radial-gradient(
      ellipse 90% 60% at 50% 45%,
      rgba(20, 20, 20, 0.12),
      rgba(20, 20, 20, 0.05)
    );
  }
}
/* Form card animation */
.pricing-form-card {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
  transition-delay: 0.4s;
  position: relative;
  z-index: 2;
}
.page-loaded .pricing-form-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Base theme tokens */
:root {
  --bg: #fdfbf6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #eadfc8;
  --primary: #c9a227;
  --primary-hover: #b8961f;
  --danger: #d14343;
  --danger-hover: #b93737;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(0,0,0,0.08);
  --focus: 0 0 0 4px rgba(201,162,39,0.25);
  --max: 920px;
}

/* Aliases for existing class references */
:root {
  --color-bg: var(--bg);
  --color-bg-warm: var(--bg);
  --color-surface: var(--card);
  --color-text: var(--text);
  --color-text-muted: var(--muted);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-primary-light: rgba(201, 162, 39, 0.25);
  --color-border: var(--border);
  --color-border-focus: var(--primary);
  --color-accent: var(--primary);
  --color-error: var(--danger);
  --color-error-bg: #fde2e2;
  --color-success: #15803d;
  --radius-sm: 10px;
  --shadow-sm: var(--shadow);
  --shadow-form: var(--shadow);
  --shadow-lg: var(--shadow);
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 1.375rem;
  --space-2xl: 2.5rem;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 60px;
}

/* Form container — card: min(94vw, 720px) */
.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 12px;
}

.main.container.pricing-form-card {
  width: min(94vw, 720px);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== Header ========== */
.header {
  padding: 1rem 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header .container,
.header .header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  opacity: 0.9;
}

.brand__logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/* ========== Main / Typography hierarchy ========== */
.main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.375rem, 4vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.subtitle {
  margin: 0 0 1.125rem;
  color: var(--text);
  font-size: clamp(0.9375rem, 2vw, 1.0625rem);
  font-weight: 500;
  line-height: 1.5;
  max-width: 70ch;
}

/* ========== Form card (base .card) ========== */
.form {
  background: var(--card);
  border-radius: var(--radius);
  border: 2px solid rgba(201, 162, 39, 0.55);
  box-shadow: var(--shadow), 0 0 0 1px rgba(201, 162, 39, 0.15);
  padding: 18px;
  margin-bottom: var(--space-xl);
  max-width: 100%;
  overflow: hidden;
}

.form__section {
  margin-bottom: var(--space-xl);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.form__section:last-of-type {
  margin-bottom: 0;
}

.form__heading {
  flex: 0 0 100%;
  margin: 18px 0 10px;
  padding-bottom: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form__section:first-child .form__heading {
  margin-top: 0;
}

/* Two-column desktop layout; stack on mobile (< 768px) */
@media (min-width: 768px) {
  .form__section .field {
    flex: 1 1 calc(50% - var(--space-lg) / 2);
    min-width: 240px;
  }
}

.form__section .field.field--row {
  flex: 1 1 auto;
}

/* Items section spans full width */
#itemsSection {
  flex: 1 1 100%;
  min-width: 100%;
}

/* ========== Fields ========== */
.field {
  margin-bottom: var(--space-lg);
}

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

.field--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
}

.field--row .field__label {
  margin-bottom: 0;
  min-width: 120px;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

/* Inputs (base input/select) — min 44px tap targets */
.field__input,
input.field__input,
select.field__input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input:focus,
input.field__input:focus,
select.field__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.field__input::placeholder {
  color: #94a3b8;
}

.field__input--select {
  cursor: pointer;
  appearance: auto;
}

.field__hint {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.field__error {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
}

.field__group {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  font-size: 0.9375rem;
}

.radio input {
  margin: 0;
}

/* ========== Items section (select + add buttons) ========== */
#itemsSection .field__input {
  width: 100%;
  min-width: 0;
}

#itemsSection [style*="display:flex"] {
  display: flex !important;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

#itemsSection select#itemSelect,
#itemsSection #customItemInput {
  flex: 1;
  min-width: 200px;
  width: auto;
}

#itemsSection [style*="margin-top"] {
  margin-top: var(--space-md) !important;
}

/* Selected items list (base .items-list / .item-row) */
#itemsListUI {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

#itemsListUI > div {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
}

#itemsListUI > div > div:first-child {
  flex: 1;
  min-width: 180px;
  font-weight: 600;
  font-size: 14px;
}

#itemsListUI > div input[type="number"] {
  width: 90px;
  min-width: 90px;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

#itemsListUI > div button {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #fde2e2;
  color: #8a1010;
  border: 1px solid #f6bcbc;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

#itemsListUI > div button:hover {
  background: #f9cfcf;
}

/* ========== Form actions / Buttons ========== */
.form__actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

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

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

/* Add item buttons (base .btn-primary) */
#addSelectedItemBtn,
#addCustomItemBtn {
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

#addSelectedItemBtn:hover,
#addCustomItemBtn:hover {
  background: var(--primary-hover);
}

/* ========== Result (base .price-box) ========== */
.result {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #fff7df;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-xl);
}

.result[hidden] {
  display: none !important;
}

.result__title {
  margin: 0 0 var(--space-md);
  font-size: 1.125rem;
  font-weight: 600;
}

.result__content {
  font-size: 0.9375rem;
}

.result__total {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
  color: var(--color-primary);
}

.result__breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-md);
}

.result__breakdown li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.result__breakdown li:last-child {
  border-bottom: none;
}

.result__note {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

/* ========== Error box (base .danger) ========== */
.error-box {
  background: #fde2e2;
  border: 1px solid #f6bcbc;
  border-radius: var(--radius);
  padding: 14px;
  color: var(--danger);
}

.error-box[hidden] {
  display: none !important;
}

.error-box p {
  margin: 0;
  font-size: 0.9375rem;
}

/* ========== Google Places Autocomplete ========== */
.pac-container {
  z-index: 99999 !important;
  border-radius: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ========== Footer ========== */
.footer {
  padding: 1.5rem 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

/* ========== Responsive — Breakpoints: 360px, 480px, 768px, 1024px ========== */
/* Tablet (768px and below) */
@media (max-width: 768px) {
  .form__section .field {
    flex: 1 1 100%;
  }

  .main.container.pricing-form-card {
    width: min(94vw, 720px);
    padding: 0 12px;
  }

  .form {
    padding: 16px;
  }

  /* Stack header on small screens */
  .header .container {
    flex-wrap: wrap;
  }

  .brand__logo {
    height: 34px;
    max-width: 150px;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .header {
    padding: 0.75rem 0;
  }

  .header .container {
    gap: 10px;
  }

  .brand__logo {
    height: 30px;
    max-width: 128px;
  }

  .main.container.pricing-form-card {
    width: min(94vw, 720px);
    padding: 0 12px;
  }

  .form {
    padding: 14px;
  }

  .page {
    padding: 16px 12px 40px;
  }

  /* Stack items section flex rows */
  #itemsSection [style*="display:flex"] {
    flex-direction: column;
    align-items: stretch;
  }

  #itemsSection select#itemSelect,
  #itemsSection #customItemInput {
    min-width: 100%;
  }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
  .brand__logo {
    height: 26px;
    max-width: 110px;
  }

  .page {
    padding: 14px 10px 36px;
  }
}

/* ===== Mobile header (≤768px): compact logo + quick actions row ===== */
@media (max-width: 768px) {
  header, .header {
    height: auto !important;
    padding: 8px 0 !important;
  }

  .header__bar {
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .brand__logo {
    height: 42px !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
  }

  .mobile-actions {
    padding: 8px 12px 12px !important;
  }

  .mobile-actions .nav,
  .mobile-actions nav {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .mobile-actions .nav a,
  .mobile-actions nav a {
    width: 100% !important;
    text-align: center !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }
}
