/* =============================================================
   v2.css — Marketing-v2-aligned styling for the app preview.
   Activated by adding the `v2` class to a container element:
   - In app.html the class is on <body> (set by ?v2=1 URL param,
     settings toggle, or hard-coded as default).
   - In resources.html the class is on the iPhone preview container
     (.iphone) so v2 styling only affects the preview, not the
     surrounding Manager UI.
   All selectors are scoped to `.v2 …` so default styling outside
   the activation point stays untouched.

   Source of truth for tokens: public/marketing-v2/marketing.css
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Jost:wght@400;500;600;700&display=swap');

.v2 {
    /* Color palette (mirrors marketing-v2 :root) */
    --sg-orange: #FF882F;
    --sg-orange-deep: #C85E10;
    --sg-blue: #00BBE8;
    --sg-dt: #2B4051;
    --sg-bg: #F4F4F4;
    --sg-panel: #F5F7F9;
    --sg-ink: #111111;
    --sg-body: #333333;
    --sg-muted: #475569;
    --sg-quiet: #94A3B8;
    --sg-line: #E5E5E5;
    --sg-line-strong: #CBD5E1;
    --sg-success: #2E8B4A;
    --sg-success-deep: #1F6B36;
    --sg-danger: #D32F2F;

    /* Font tokens */
    --sg-font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --sg-font-display: 'Manrope', system-ui, sans-serif;
    --sg-font-logo: 'Jost', 'Futura PT', 'Futura', 'Avenir Next', sans-serif;

    font-family: var(--sg-font-body);
    color: var(--sg-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Make EVERY descendant use Manrope by default. Specific components below
   may set heavier weights or display font, but all inherit the family. */
.v2 *:not(.material-icons-outlined):not(.material-icons):not(.material-symbols-outlined) {
    font-family: var(--sg-font-body);
}

/* ---------- Headings ---------- */
.v2 h1, .v2 h2, .v2 h3, .v2 h4,
.v2 .topic-h, .v2 .resource-heading {
    font-family: var(--sg-font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--sg-ink);
    text-wrap: balance;
}

/* Section heading inside the topic content area — keep prominent but
   trim vertical space so it doesn't dominate the page. */
.v2 main h2,
.v2 main h3,
.v2 .resource-heading {
    font-size: 26px;
    line-height: 1.15;
    margin: 8px 0 12px;
}

/* ---------- Body text ---------- */
.v2 .resource-text {
    color: var(--sg-body);
    font-family: var(--sg-font-body);
}

.v2 .resource-text p {
    font-size: 16px;
    line-height: 1.55;
    color: var(--sg-body);
    text-wrap: pretty;
    margin: 10px 0;
}

.v2 .resource-text strong {
    color: var(--sg-ink);
    font-weight: 700;
}

/* ---------- Image captions ---------- */
.v2 .image-caption,
.v2 figcaption {
    font-family: var(--sg-font-body);
    font-size: 13px;
    color: var(--sg-muted);
    line-height: 1.45;
    font-style: normal;
    margin-top: 8px;
}

/* ---------- Bulleted variants (checkmark / arrows) — keep glyphs but adjust spacing ---------- */
.v2 .resource-text ul.bullet-check li,
.v2 .resource-text ul.bullet-arrows li {
    font-size: 16px;
    line-height: 1.5;
}

/* ---------- Tables (oil-color comparison style) ---------- */
.v2 .resource-text table td {
    font-size: 15.5px;
    line-height: 1.5;
    color: var(--sg-body);
}

.v2 .resource-text table tr + tr td {
    border-top: 1px solid var(--sg-line);
}

/* ---------- Continue / Previous buttons (.button.button-next / .button-prev)
   Keep the app's existing colors (CONTINUE green, PREVIOUS dark slate) —
   v2 only adjusts typography, rounding, and padding for a marketing feel. */
.v2 button.button,
.v2 button.button-next,
.v2 button.button-prev {
    font-family: var(--sg-font-display);
    font-weight: 800;
    letter-spacing: 0.02em;
    border-radius: 12px;
    padding: 18px 26px;
    font-size: 14px;
    transition: filter 180ms;
}

.v2 button.button-next:hover,
.v2 button.button-prev:hover { filter: brightness(1.06); }

/* ---------- Image rounding ---------- */
.v2 main img,
.v2 .resource-image img,
.v2 .resource-text table td img {
    border-radius: 14px;
}

/* Smaller rounding for the table drop thumbnails (they're tiny) */
.v2 .resource-text table td img {
    border-radius: 10px;
}

/* ---------- Header (DriveTrak bar) — keep brand mark but match logo font ---------- */
.v2 .app-header-brand,
.v2 .app-header h1 {
    font-family: var(--sg-font-logo);
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* ---------- Breadcrumb bar ---------- */
.v2 .app-breadcrumb-bar {
    font-family: var(--sg-font-body);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ---------- Footer nav (Home/Lessons/Scheduler/Notifications) ---------- */
.v2 .app-footer-nav,
.v2 .app-footer-nav .nav-label {
    font-family: var(--sg-font-body);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.02em;
}

/* ---------- Question component (inline QUESTION) ----------
   Mirrors marketing-v2 .sg-qz pattern (see marketing.css line 656+):
   compact white-bg options that shift to green (correct) / red (wrong)
   border + tint after submit. Custom check / X badges in place of native
   radios. Feedback block uses left-border accent + tinted bg. */

.v2 .resource-question { margin: 16px 0; }

.v2 .question-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--sg-line);
    border-radius: 16px;
    padding: 18px;
}

.v2 .question-card > p:first-child {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--sg-ink);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0;
    /* No text-wrap: balance — let the prompt use the full card width */
}

/* Multiple-choice answer list. Scoped with :not(.fitb-dropdown-list) so the
   FITB dropdown's <ul class="fitb-dropdown-list"> isn't forced to display: flex,
   which overrode its default `display: none` and made all dropdowns render
   open by default. */
.v2 .question-card ul:not(.fitb-dropdown-list) {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.v2 .question-card ul:not(.fitb-dropdown-list) li { margin: 0; padding: 0; }

.v2 .question-card ul:not(.fitb-dropdown-list) li { width: 100%; }

.v2 .question-card ul li label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--sg-line);
    background: #fff;
    font-size: 14px;
    line-height: 1.35;
    color: var(--sg-ink);
    cursor: pointer;
    transition: background 150ms, border-color 150ms, color 150ms;
    width: 100%;
    box-sizing: border-box;
}

.v2 .question-card ul li label:hover { border-color: var(--sg-line-strong); }

/* Hide the native radio; we draw a custom indicator on the input itself */
.v2 .question-card ul li label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    max-width: 16px;
    min-height: 16px;
    max-height: 16px;
    margin: 1px 0 0;
    padding: 0;
    border: 1.5px solid var(--sg-line-strong);
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
    flex-grow: 0;
    cursor: pointer;
    position: relative;
    transition: border-color 150ms, background 150ms;
    box-sizing: border-box;
}

.v2 .question-card ul li label input[type="radio"]:checked {
    border-color: var(--sg-orange);
    background: var(--sg-orange);
    box-shadow: inset 0 0 0 3px #fff;
}

/* After-submit states — the renderer doesn't add classes to the LI, so we
   detect submit state by the inline color on .question-feedback (`color: green`
   for correct, `color: red` for wrong) and use :has() to walk up to the
   chosen option (input:checked). The selected radio swaps to a green check
   or red X badge, mirroring marketing-v2 .sg-qz__badge--check / --x. */

/* Correct: green-tinted card + green check badge on the chosen answer */
.v2 .question-card:has(.question-feedback[style*="color: green"]) ul li label:has(input:checked) {
    border-color: #27ae60;
    background: #eafaf1;
    color: #1a7a44;
}

.v2 .question-card:has(.question-feedback[style*="color: green"]) ul li label:has(input:checked) input[type="radio"] {
    border-color: #27ae60;
    background-color: #27ae60;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l4 4 10-10'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 70% 70%;
    box-shadow: none;
}

/* Wrong: red-tinted card + red X badge on the chosen (incorrect) answer */
.v2 .question-card:has(.question-feedback[style*="color: red"]) ul li label:has(input:checked) {
    border-color: #e74c3c;
    background: #fdecea;
    color: #c0392b;
}

.v2 .question-card:has(.question-feedback[style*="color: red"]) ul li label:has(input:checked) input[type="radio"] {
    border-color: #e74c3c;
    background-color: #e74c3c;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round'><path d='M6 6l12 12M18 6L6 18'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60% 60%;
    box-shadow: none;
}

/* Legacy class-based hooks kept in case the renderer adds them later */
.v2 .question-card ul li.is-right label,
.v2 .question-card ul li.correct label {
    border-color: #27ae60;
    background: #eafaf1;
    color: #1a7a44;
}

.v2 .question-card ul li.is-wrong label,
.v2 .question-card ul li.wrong label,
.v2 .question-card ul li.incorrect label {
    border-color: #e74c3c;
    background: #fdecea;
    color: #c0392b;
}

/* Submit Answer button — outlined / ghost style, lighter weight than the
   primary nav buttons so focus stays on the answer choices. */
.v2 .question-card .action-button {
    align-self: flex-start;
    background: transparent;
    color: var(--sg-ink);
    border: 1.5px solid var(--sg-ink);
    padding: 9px 18px;
    border-radius: 999px;
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 150ms, color 150ms;
    margin-top: 4px;
}

.v2 .question-card .action-button:hover {
    background: var(--sg-ink);
    color: #fff;
}

.v2 .question-card .action-button:disabled {
    color: var(--sg-line-strong);
    border-color: var(--sg-line-strong);
    background: transparent;
    cursor: default;
}

/* Feedback block — left-border accent, tinted bg, kicker title */
.v2 .question-card .question-feedback:not(:empty) {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    border-left: 3px solid var(--sg-line-strong);
    background: var(--sg-panel);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--sg-body);
}

/* The renderer signals correct/wrong via inline `style="color: green"` (or red).
   We hook on those attribute values to apply the marketing-style tinted card. */
.v2 .question-card .question-feedback[style*="color: green"],
.v2 .question-card .question-feedback[style*="color:green"],
.v2 .question-card .question-feedback.ok,
.v2 .question-card .question-feedback.correct,
.v2 .question-card .question-feedback.right {
    background: #eafaf1 !important;
    border-left-color: #27ae60 !important;
    color: #1a7a44 !important;
}

.v2 .question-card .question-feedback[style*="color: red"],
.v2 .question-card .question-feedback[style*="color:red"],
.v2 .question-card .question-feedback.wrong,
.v2 .question-card .question-feedback.warn,
.v2 .question-card .question-feedback.incorrect {
    background: #fdecea !important;
    border-left-color: #e74c3c !important;
    color: #8a2a1f !important;
}

.v2 .question-card .question-feedback[style*="color: green"] strong,
.v2 .question-card .question-feedback[style*="color:green"] strong {
    color: #1a7a44 !important;
}

.v2 .question-card .question-feedback[style*="color: red"] strong,
.v2 .question-card .question-feedback[style*="color:red"] strong {
    color: #8a2a1f !important;
}

.v2 .question-card .question-feedback strong {
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.01em;
    display: block;
    margin-bottom: 2px;
}

.v2 .question-card .question-feedback p {
    margin: 2px 0 0;
}

/* ---------- Checklist callout ---------- */
.v2 .resource-text-checklist {
    font-family: var(--sg-font-body);
}

.v2 .resource-text-checklist .resource-inner::before {
    font-family: var(--sg-font-display);
    font-weight: 800;
}

/* ---------- Gene quote ---------- */
.v2 .resource-text-quote-speech .resource-inner {
    font-family: var(--sg-font-body);
}

/* ---------- Marketing-style accent: subtle orange accent for "important" callouts ---------- */
.v2 .resource-text-important {
    border-left-color: var(--sg-orange);
    background: rgba(255, 136, 47, 0.08);
}
