/* ============================================================================
   product-dialog.css — ONE shared design system for every insurance product
   add-on dialog (Credit Shortfall, Excess Buyback/Reducer/Plus, Motor Gap,
   Pothole, Car Hire + the motorcycle variants).

   Replaces the bespoke ~200-570 line <style> block each dialog used to carry.
   Namespaced `pd-` so it never collides with page/shell styles. Theme-aware via
   the existing design tokens (they already resolve light/dark). Toyota red is the
   single accent; money is tabular; selection is unmistakable.
   ============================================================================ */

/* ---- root / layout ------------------------------------------------------- */
.pd {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    color: var(--text-primary);
}

.pd * { box-sizing: border-box; }

/* ---- hero (product header) ---------------------------------------------- */
.pd-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border-color);
}

.pd-hero-icon {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md, 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--toyota-red), color-mix(in srgb, var(--toyota-red) 68%, #000));
    box-shadow: 0 6px 16px rgba(var(--toyota-red-rgb), 0.28);
}

.pd-hero-text { min-width: 0; }

.pd-hero-text h3 {
    margin: 0 0 0.2rem 0;
    font-family: var(--font-display, inherit);
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.pd-hero-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ---- notes / info panels ------------------------------------------------ */
.pd-note {
    display: flex;
    gap: 0.85rem;
    padding: 0.95rem 1.05rem;
    border-radius: var(--radius-sm, 10px);
    background: var(--primary-light);
    border-left: 3px solid var(--toyota-red);
}

.pd-note-icon {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    font-size: 1.15rem;
    color: var(--toyota-red);
}

.pd-note-body { min-width: 0; }

.pd-note-body h5 {
    margin: 0 0 0.4rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pd-note-body p,
.pd-note-body li {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.pd-note-body ul {
    margin: 0;
    padding-left: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* neutral variant for broker/handling notes (no colour flood) */
.pd-note--muted {
    background: var(--surface-2);
    border-left-color: var(--border-color);
}

.pd-note--muted .pd-note-icon { color: var(--text-muted); }

/* ---- titled section ----------------------------------------------------- */
.pd-section { display: flex; flex-direction: column; }

.pd-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.85rem 0;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pd-section-title i { color: var(--toyota-red); }

/* ---- fields (label + control) ------------------------------------------- */
.pd-fields { display: flex; flex-direction: column; gap: 1.15rem; }

.pd-field { display: flex; flex-direction: column; gap: 0.4rem; }

.pd-field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pd-select,
.pd-input {
    width: 100%;
    padding: 0.68rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.3;
    transition: border-color var(--dur-fast, .15s) var(--ease, ease), box-shadow var(--dur-fast, .15s) var(--ease, ease);
}

.pd-select:focus,
.pd-input:focus {
    outline: none;
    border-color: var(--toyota-red);
    box-shadow: 0 0 0 3px rgba(var(--toyota-red-rgb), 0.13);
}

.pd-field-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---- detail / calc rows ------------------------------------------------- */
.pd-rows {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface-1);
}

.pd-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.pd-row-label { font-size: 0.88rem; color: var(--text-secondary); }

.pd-row-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* coverage / benefit bullet list */
.pd-list {
    margin: 0;
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pd-list li {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* check-marked benefit row (icon + text, no bullets) */
.pd-checks { display: flex; flex-direction: column; gap: 0.55rem; }

.pd-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pd-check i { color: var(--toyota-red); font-size: 0.95rem; }

/* ---- selectable option cards -------------------------------------------- */
.pd-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem;
}

.pd-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    padding: 1.25rem 1rem 0;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface-1);
    transition: border-color var(--dur-fast, .15s) var(--ease, ease),
                transform var(--dur-fast, .15s) var(--ease, ease),
                box-shadow var(--dur-fast, .15s) var(--ease, ease);
}

.pd-option:hover {
    border-color: var(--toyota-red);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(var(--toyota-red-rgb), 0.14);
}

.pd-option.is-selected {
    border-color: var(--toyota-red);
    background: rgba(var(--toyota-red-rgb), 0.06);
    box-shadow: 0 0 0 1px rgba(var(--toyota-red-rgb), 0.4);
}

.pd-option-check {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    transition: background var(--dur-fast, .15s) var(--ease, ease), border-color var(--dur-fast, .15s) var(--ease, ease);
}

.pd-option.is-selected .pd-option-check {
    background: var(--toyota-red);
    border-color: var(--toyota-red);
}

.pd-option-name { font-size: 0.82rem; color: var(--text-secondary); }

.pd-option-value {
    font-family: var(--font-display, inherit);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.pd-option.is-selected .pd-option-value { color: var(--toyota-red); }

.pd-option-sub { font-size: 0.72rem; color: var(--text-muted); }

/* per-card price footer — the R + amount + period MUST always stay on one line */
.pd-option-price {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    width: 100%;
    margin-top: auto;               /* pin to the bottom so multi-height cards align */
    padding: 0.6rem 0.6rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-2);
    white-space: nowrap;            /* never split "R 270,00 / month" across lines */
}

.pd-option.is-selected .pd-option-price { background: rgba(var(--toyota-red-rgb), 0.06); }

.pd-option-amount {
    font-family: var(--font-display, inherit);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--toyota-red);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pd-option-per { font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; }

/* nested detail rows INSIDE an option card (e.g. MyExcess Plus basic/write-off caps)
   — compact them so the card stays readable at 4-up without the labels wrapping badly */
.pd-option .pd-rows {
    width: 100%;
    margin-top: 0.55rem;
    padding: 0.5rem 0.65rem;
    gap: 0.3rem;
    text-align: left;
    border: none;                                   /* no box-in-box — was a bordered white card on a white card */
    background: color-mix(in srgb, var(--text-primary) 4%, transparent);
    border-radius: var(--radius-sm, 8px);
}

.pd-option .pd-row { gap: 0.5rem; }
.pd-option .pd-row-label { font-size: 0.74rem; line-height: 1.25; }
.pd-option .pd-row-value { font-size: 0.8rem; white-space: nowrap; }

/* the chosen card: unmistakable red accent, tinted inner box to match */
.pd-option.is-selected { border-width: 2px; padding-top: calc(1.25rem - 1px); }
.pd-option.is-selected .pd-rows { background: rgba(var(--toyota-red-rgb), 0.05); }

/* The old hover "Select" overlay sat on top of the card and collided with the price
   footer ("R 270,00 SELECT"). It's gone — selection is shown cleanly by the radio
   check (top-right), the red border, the lift and a red price footer on the chosen card. */
.pd-option-pick { display: none; }

/* radio check reads as an interactive target: reddens on hover, fills when chosen */
.pd-option:hover .pd-option-check { border-color: var(--toyota-red); }
.pd-option:hover { background: rgba(var(--toyota-red-rgb), 0.025); }

/* ---- Motor Gap style feature matrix (Gap 1 / Gap 3 yes-no columns) --------- */
.pd-gaps {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.4rem 1.4rem;
    justify-content: end;
    align-items: center;
}

.pd-gap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pd-gap i { font-size: 0.85rem; }
.pd-gap .pd-yes { color: var(--success, #2e7d32); }
.pd-gap .pd-no  { color: var(--text-muted); opacity: 0.75; }

/* horizontal option rows (wide list style, e.g. Motor Gap / Car Hire durations) */
.pd-option--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 1rem 1.1rem;
    gap: 1rem;
}

.pd-option--row .pd-option-price {
    width: auto;
    margin-top: 0;
    padding: 0;
    border-top: none;
    background: none;
}

/* ---- empty / message states --------------------------------------------- */
.pd-empty {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.05rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm, 10px);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.pd-empty i { color: var(--toyota-red); }

/* ---- premium summary bar ------------------------------------------------ */
.pd-premium {
    border-radius: var(--radius-md, 12px);
    padding: 0.28rem;
    background: linear-gradient(135deg, var(--toyota-red), color-mix(in srgb, var(--toyota-red) 62%, #000));
    box-shadow: 0 10px 24px rgba(var(--toyota-red-rgb), 0.24);
    animation: pd-rise var(--dur-slow, .3s) var(--ease, ease);
}

.pd-premium-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-sm, 10px);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
}

.pd-premium-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    min-width: 0;
}

.pd-premium-label-wrap > i { font-size: 1.5rem; opacity: 0.9; }

.pd-premium-label { font-size: 1rem; font-weight: 600; color: #fff; }

.pd-premium-sub { font-size: 0.74rem; opacity: 0.85; color: #fff; }

.pd-premium-figure {
    display: flex;
    align-items: baseline;
    color: #fff;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pd-premium-cur { font-size: 1.2rem; margin-right: 0.12rem; }

.pd-premium-amt {
    font-family: var(--font-display, inherit);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
}

.pd-premium-per { font-size: 0.85rem; opacity: 0.85; margin-left: 0.25rem; }

/* premium not yet available — quiet card, no red flood */
.pd-premium-empty {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 12px);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
}

.pd-premium-empty i { color: var(--toyota-red); font-size: 1.1rem; flex: 0 0 auto; }

@keyframes pd-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 600px) {
    .pd-options { grid-template-columns: 1fr; }
    .pd-premium-inner { flex-direction: column; text-align: center; }
    .pd-premium-label-wrap { flex-direction: column; text-align: center; }
    .pd-option--row { flex-direction: column; align-items: stretch; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .pd-premium { animation: none; }
    .pd-option, .pd-option-pick, .pd-select, .pd-input { transition: none; }
}
