/* forms.css */

/* =========================
   ========== Base ==========
   ========================= */

:root {
  --ll-accent: #0073aa;
  --ll-accent-ink: #0b4e6f;
  --ll-danger: #e74c3c;
  --ll-muted: #6b7280;
  --ll-border: #ccc;
  --ll-bg-invalid: #fff6f6;
  --ll-gap: 14px;
  --ll-radius: 6px;
  --ll-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Generic input look (optional utility) */
.ll-input {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--ll-border);
  border-radius: 4px;
  font-size: 16px;
  background: #fff;
}

/* Field wrapper and labels */
.ll-field label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  color: #333;
  line-height: 1.25;
}

.ll-field input,
.ll-field select,
.ll-field textarea {
  width: 100%;
  box-sizing: border-box;
  background: #fff;
}

/* Focus: keyboard-friendly and consistent */
.ll-field input:focus-visible,
.ll-field select:focus-visible,
.ll-field textarea:focus-visible,
#start-page-container form input:focus-visible,
#start-page-container form select:focus-visible,
#start-page-container form textarea:focus-visible {
  outline: 3px solid rgba(0,115,170,0.25);
  outline-offset: 1px;
  border-color: var(--ll-accent);
}

/* -------------------------
   Unified error states
-------------------------- */

/* Single source of truth */
.ll-is-invalid,
.ll-field.has-error input,
.ll-field.has-error select,
.ll-field.has-error textarea,
.ll-registration-form.was-submitted input:invalid,
.ll-registration-form.was-submitted textarea:invalid,
.ll-registration-form.was-submitted select:invalid {
  border-color: var(--ll-danger) !important;
  background-color: var(--ll-bg-invalid);
}

/* Optional legacy hooks point to the same style */
.input-error,
input.invalid,
textarea.invalid,
select.invalid {
  border-color: var(--ll-danger) !important;
  background-color: var(--ll-bg-invalid);
}

.ll-error-msg {
  display: none;
  color: var(--ll-danger);
  font-weight: 700;
  margin-bottom: 10px;
}
.ll-field.has-error .ll-error-msg { display: block; }

/* Small utilities */
.save-confirm { color: #2e7d32; margin-left: 6px; font-size: 1.2em; vertical-align: middle; display: none; }
.ll-prompt-message { text-align: center; margin-bottom: 15px; }
#ll-registration-form input[name="phone"] { margin-bottom: 16px; display: block; }

/* =========================
   === Stepper & Progress ===
   ========================= */

.ll-step {
  display: none;              /* hidden by default */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ll-step.ll-step-active {
  display: grid;              /* always grid when active; columns set below */
  grid-template-columns: 1fr;
  gap: var(--ll-gap);
  opacity: 1;
  animation: llFadeIn 0.3s ease;
}

@keyframes llFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ll-progress-bar {
  width: 100%; height: 8px; margin-bottom: 20px; overflow: hidden;
  background-color: #eee; border-radius: 5px;
}
.ll-progress-indicator {
  height: 100%; width: 0; background-color: var(--ll-accent);
  transition: width 0.3s ease;
}

.ll-step-labels {
  list-style: none; padding-left: 0; margin: 0 0 10px 0;
  display: flex; justify-content: space-between;
}
.ll-step-labels li {
  flex: 1; text-align: center; font-size: 14px; font-weight: 500; color: #999; position: relative;
}
.ll-step-labels li.active,
.ll-step-labels li.completed { color: var(--ll-accent); }
.ll-step-labels li.completed { opacity: .6; }
.ll-step-labels li::after {
  content: ""; display: block; margin: 4px auto 0; width: 8px; height: 8px;
  background-color: currentColor; border-radius: 50%;
}

.ll-final-step { font-size: 1.1rem; text-align: center; padding: 2rem; }

/* =========================================
   === Step Layouts (columns by breakpoint)
   ========================================= */

/* By default, active steps are 1 column (set above). */

/* ≥720px: steps 1 & 2 use two columns */
@media (min-width: 720px) {
  .ll-step.ll-step-active[data-step="1"],
  .ll-step.ll-step-active[data-step="2"] {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* Full-width elements inside grid */
  .ll-step.ll-step-active[data-step="1"] > h3,
  .ll-step.ll-step-active[data-step="1"] > .ll-step-premium-note,
  .ll-step.ll-step-active[data-step="1"] > .ll-step-buttons,
  .ll-step.ll-step-active[data-step="2"] > h3,
  .ll-step.ll-step-active[data-step="2"] > .ll-step-premium-note,
  .ll-step.ll-step-active[data-step="2"] > .ll-step-buttons {
    grid-column: 1 / -1;
  }
}

/* Tighter spacing for fields inside grids */
.ll-step.ll-step-active[data-step="1"] > .ll-field,
.ll-step.ll-step-active[data-step="2"] > .ll-field { margin: 0; }

/* Global widths for Address (full) and Phone/Website (half) on any step */
@media (min-width: 720px) {
  /* Address spans both columns whenever the step is a 2-col grid */
  .ll-step.ll-step-active > .ll-field:has(#ll_address) {
    grid-column: 1 / -1;
  }

  /* Phone and Website take one column each */
  .ll-step.ll-step-active > .ll-field:has(#ll_phone),
  .ll-step.ll-step-active > .ll-field:has(#ll_website) {
    grid-column: auto;
  }
}

/* ==============================
   === Feature Section Layout ===
   ============================== */

.ll-feature-section {
  background-color: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin: 2rem auto;
  max-width: 1000px;
}
.ll-feature-content { opacity: 1; }

/* ==============================
   === Form Container Overrides ==
   ============================== */

#start-page-container,
#email-form-container,
#step2,
.ll-form-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: .5rem;
  box-shadow: var(--ll-shadow);
  max-width: 480px;
  margin: 1rem auto;
}

#start-page-container form label {
  display: block;
  margin-bottom: .25rem;
  font-weight: 600;
  color: #333;
}

#start-page-container form input[type="email"],
#start-page-container form input[type="text"],
#start-page-container form input[type="tel"],
#start-page-container form input[type="url"],
#start-page-container form textarea,
#start-page-container form select {
  display: block; width: 100%; box-sizing: border-box;
  padding: .75rem; margin-bottom: 1rem;
  border: 1px solid var(--ll-border);
  border-radius: .25rem;
  font: inherit;
  background: #fff;
}

/* Buttons */
#start-page-container form input[type="submit"],
#start-page-container form button[type="submit"],
#start-page-container form button {
  display: block; width: 100%;
  padding: .75rem;
  font-size: 1rem; font-weight: 600; color: #fff;
  background-color: var(--ll-accent);
  border: none; border-radius: .25rem; cursor: pointer; text-align: center;
  margin-top: .5rem;
}
#start-page-container form input[type="submit"]:hover,
#start-page-container form button[type="submit"]:hover,
#start-page-container form button:hover {
  background-color: var(--ll-accent-ink);
}

/* Field focus (split from button hover to avoid bleed) */
#start-page-container form input[type="email"]:focus-visible,
#start-page-container form input[type="text"]:focus-visible,
#start-page-container form input[type="tel"]:focus-visible,
#start-page-container form input[type="url"]:focus-visible,
#start-page-container form textarea:focus-visible,
#start-page-container form select:focus-visible {
  outline: 3px solid rgba(0,115,170,0.25);
  outline-offset: 1px;
  border-color: var(--ll-accent);
}

#start-page-container .error,
#start-page-container .form-error { color: #cc0000; font-size: .875rem; margin-bottom: 1rem; }

/* =========================
   ===== Login Form =========
   ========================= */

#custom-login-form {
  max-width: 320px;
  margin: 0 auto;
  display: flex; flex-direction: column;
}
#custom-login-form label { font-weight: 700; margin-bottom: 5px; }
#custom-login-form input[type="text"],
#custom-login-form input[type="password"] {
  padding: 8px; margin-bottom: 15px; width: 100%;
  box-sizing: border-box; border: 1px solid var(--ll-border); border-radius: 4px;
  background: #fff;
}
#custom-login-form input:focus-visible {
  outline: 3px solid rgba(0,115,170,0.25);
  outline-offset: 1px;
  border-color: var(--ll-accent);
}

.password-wrapper { position: relative; display: inline-block; width: 100%; }
.toggle-password, .toggle-password-icon {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  cursor: pointer; color: #666;
}
.toggle-password:hover, .toggle-password-icon:hover { color: #000; }
.lost-password-link {
  text-align: center; display: block; margin-top: 10px;
  font-size: 14px; color: var(--ll-accent); text-decoration: none;
}
.lost-password-link:hover { text-decoration: underline; }
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] { padding-right: 34px; }

/* =========================
   ===== Premium bits ======
   ========================= */

.ll-label-required { font-weight: 500; color: #c0392b; font-size: .85em; margin-left: 8px; }
.ll-label-premium  { font-style: italic; color: var(--ll-danger); font-size: .85em; margin-left: 8px; }

.ll-premium-step-note,
.ll-step-premium-note {
  margin-top: 12px;
  font-size: 13px;
  opacity: .85;
  color: var(--ll-muted);
  border-top: 1px dashed #e5e7eb;
  padding-top: 8px;
}

/* Ensure premium note, headings, and buttons span across both columns in any active grid step */
@media (min-width: 720px) {
  .ll-step.ll-step-active > .ll-premium-step-note,
  .ll-step.ll-step-active > .ll-step-premium-note,
  .ll-step.ll-step-active > .ll-step-buttons,
  .ll-step.ll-step-active > h3 {
    grid-column: 1 / -1;
  }
}

/* =========================
   ===== Media helpers =====
   ========================= */

.ll-img-64 {
  height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

/* Accessible visually-hidden file input */
.ll-file-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* =========================
   ==== Custom Upload Buttons ====
   ========================= */

/* Base style for all upload buttons */
.ll-upload-button {
  display: inline-block;
  background: var(--ll-accent);
  color: #fff;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  width: auto;              /* prevent full-width stretch */
  min-width: 150px;         /* reasonable base width */
  transition: background 0.2s ease;
}

.ll-upload-button:hover {
  background: var(--ll-accent-ink);
  color: #fff;              /* keep white text on hover */
}

/* Upload Logo button — extra specificity (if needed to override .ll-field label styles) */
.ll-field label.ll-upload-button[data-role="logo"] {
  color: #fff !important;   /* ensures label text stays white */
  justify-self: start;      /* aligns left in grid if applicable */
}


/* =========================
   ===== Motion safety =====
   ========================= */
@media (prefers-reduced-motion: reduce) {
  .ll-step,
  .ll-progress-indicator {
    transition: none !important;
    animation: none !important;
  }
}


/* Logo thumb + remove "×" */
.ll-logo-thumb {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.ll-logo-thumb img {
  height: 64px;
  width: auto;
  max-width: 100%;
  border-radius: 8px;
  display: block;
}
.ll-remove-logo {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #ccc;
  color: #333;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  padding: 0;
}
.ll-remove-logo:hover {
  background: var(--ll-danger);
  border-color: var(--ll-danger);
  color: #fff;
}
