/* public/style.css — Cartech tuto, redesigned visual (modern + premium feel). */

:root {
  /* Brand greens */
  --green-300: #5cd9a3;
  --green-400: #2dc188;
  --green-500: #00aa66;
  --green-600: #008a52;
  --green-700: #006e42;

  /* Surfaces / backgrounds */
  --surface:        #ffffff;
  --surface-soft:   #fafcfb;
  --surface-muted:  #f0f5f3;
  --surface-deep:   #021d21;
  --surface-deeper: #0d2b30;

  /* Text */
  --text:              #021d21;
  --text-soft:         #3d5659;
  --text-muted:        #6b7f82;
  --text-on-dark:      #ffffff;
  --text-on-dark-soft: rgba(255, 255, 255, 0.78);
  --text-on-dark-muted: rgba(255, 255, 255, 0.55);

  /* Borders */
  --border:        #dde3e3;
  --border-subtle: rgba(2, 29, 33, 0.06);

  /* Feedback */
  --danger:    #dc2626;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(2, 29, 33, 0.04);
  --shadow-md:  0 4px 16px rgba(2, 29, 33, 0.06), 0 1px 2px rgba(2, 29, 33, 0.04);
  --shadow-lg:  0 12px 32px rgba(2, 29, 33, 0.08), 0 2px 6px rgba(2, 29, 33, 0.04);
  --shadow-cta: 0 6px 20px rgba(0, 170, 102, 0.28);
  --shadow-cta-hover: 0 10px 28px rgba(0, 170, 102, 0.4);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 170, 102, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, var(--surface-muted) 0%, var(--surface) 35%, var(--surface) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Text", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: 580px;
  margin: 0 auto;
  padding: 32px 18px 56px;
}

/* ───── Brand header ───── */

header.brand {
  text-align: center;
  margin-bottom: 32px;
}
header.brand img {
  height: 56px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(2, 29, 33, 0.06));
}

/* ───── Hero (form state) ───── */

.hero-text {
  text-align: center;
  margin-bottom: 28px;
  padding: 0 4px;
}
.hero-text h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 12px;
}
.hero-text h1 .hero-accent {
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-400) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-text .lead {
  font-size: 16px;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.5;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 480px) {
  .hero-text h1 { font-size: 34px; }
}

/* ───── Greeting card (results state) ───── */

.greeting-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 15%, rgba(0, 170, 102, 0.35) 0%, transparent 55%),
    linear-gradient(135deg, var(--surface-deep) 0%, var(--surface-deeper) 100%);
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-lg);
}
.greeting-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--green-300);
  position: relative;
}
.greeting-card h1 {
  color: var(--text-on-dark);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 6px;
  position: relative;
}
.greeting-sub {
  color: var(--text-on-dark-soft);
  margin: 0;
  font-size: 14px;
  position: relative;
}

/* ───── Form card ───── */

.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text);
  letter-spacing: -0.005em;
}
label:first-child { margin-top: 0; }

input[type="text"] {
  width: 100%;
  padding: 15px 16px;
  font-size: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
input[type="text"]::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
input[type="text"]:hover:not(:focus) {
  border-color: #c2cccc;
}
input[type="text"]:focus {
  outline: 0;
  border-color: var(--green-500);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 170, 102, 0.15);
}
.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

/* ───── Primary CTA button ───── */

button {
  position: relative;
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-400) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 26px;
  box-shadow: var(--shadow-cta);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
button:hover:not(:disabled):not(.loading) {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-500) 100%);
  box-shadow: var(--shadow-cta-hover);
  transform: translateY(-1px);
}
button:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow: 0 2px 8px rgba(0, 170, 102, 0.25);
}
button:disabled:not(.loading) {
  background: #e7eced;
  color: #97a7a9;
  box-shadow: none;
  cursor: not-allowed;
}
button.loading {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-500) 100%);
  cursor: wait;
  opacity: 0.85;
}

/* Spinner inside button */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 10px;
  margin-top: -2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ───── Error banner ───── */

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: var(--danger-text);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}
.error-banner::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: -1px;
  /* Exclamation via background SVG */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='white' d='M10 4a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V5a1 1 0 0 1 1-1zm0 11.5a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}
.error-banner .error-content {
  flex: 1;
  min-width: 0;
}
.error-banner a {
  color: var(--danger-text);
  text-decoration: underline;
  font-weight: 700;
  word-break: break-word;
}

/* ───── Product card ───── */

.product {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
}
.product:last-child { margin-bottom: 0; }

.product-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}
.product-title img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  flex-shrink: 0;
}
.product-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ───── Resource blocks (PDF / Video) ───── */

.resource-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.resource-block:first-of-type:not(:only-of-type) { /* unchanged */ }

.resource-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* PDF: single big primary button */
.pdf-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-decoration: none;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-400) 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-cta);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pdf-button:hover {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-500) 100%);
  box-shadow: var(--shadow-cta-hover);
  transform: translateY(-1px);
}
.pdf-button:active {
  transform: scale(0.985);
}
.pdf-button::after {
  content: "→";
  font-size: 20px;
  font-weight: 600;
  transition: transform 0.15s ease;
}
.pdf-button:hover::after {
  transform: translateX(2px);
}

/* PDF (multi): list of choice buttons */
.pdf-choice-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.pdf-choice-button::before {
  content: "📄";
  font-size: 22px;
  flex-shrink: 0;
}
.pdf-choice-button:hover {
  background: var(--surface);
  border-color: var(--green-500);
  color: var(--green-700);
}
.pdf-choice-button:active {
  transform: scale(0.99);
}
.pdf-choice-button:last-child { margin-bottom: 0; }

/* Video buttons (always choice-style) */
.video-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.video-button::before {
  content: "▶";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-400) 100%);
  color: #fff;
  font-size: 11px;
  padding-left: 3px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 170, 102, 0.3);
  transition: transform 0.15s ease;
}
.video-button:hover {
  background: var(--surface);
  border-color: var(--green-500);
  color: var(--green-700);
}
.video-button:hover::before {
  transform: scale(1.06);
}
.video-button:active {
  transform: scale(0.99);
}
.video-button:last-of-type { margin-bottom: 0; }

/* Helper text above multi-choice */
.choice-helper {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 10px;
  font-weight: 500;
}

/* Video iframe slot */
.video-frame-slot {
  margin-top: 14px;
}
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-deep);
  box-shadow: var(--shadow-md);
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ───── Coming soon (no resources yet) ───── */

.coming-soon {
  background: var(--surface-soft);
  border: 1.5px dashed var(--border);
  padding: 22px 18px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 14px;
  text-align: center;
  margin-top: 18px;
  line-height: 1.5;
}
.coming-soon::before {
  content: "⏳";
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}
.coming-soon a {
  color: var(--green-500);
  text-decoration: none;
  font-weight: 700;
}

/* ───── Support footer ───── */

footer.support {
  text-align: center;
  margin-top: 36px;
  font-size: 13px;
  color: var(--text-muted);
}
footer.support a {
  color: var(--green-500);
  text-decoration: none;
  font-weight: 700;
}
footer.support a:hover { text-decoration: underline; }

/* ───── Utility ───── */

[hidden] { display: none !important; }

/* Entrance animations */
#results-section:not([hidden]) {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
#error-banner:not([hidden]) {
  animation: fadeIn 0.25s ease-out;
}
.product {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.product:nth-child(2) { animation-delay: 0.05s; }
.product:nth-child(3) { animation-delay: 0.10s; }
.product:nth-child(4) { animation-delay: 0.15s; }
.product:nth-child(5) { animation-delay: 0.20s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reduced motion: keep transitions but kill entrance animations */
@media (prefers-reduced-motion: reduce) {
  #results-section, #error-banner, .product {
    animation: none !important;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
