/*
 * Red Lotus theme overrides (RFC 09 §2).
 *
 * Linked from views/client/layouts/app.blade.php. Deliberately small: the core
 * client layout already carries every structural rule the client area needs
 * inline, and this file only adds the classes the funnel screens and the site
 * cards introduce, plus a short list of tweaks on top of core.
 *
 * Everything here is built on the CSS custom properties the core layout
 * declares (--primary, --card, --border, --text, --muted, --radius…), which
 * are in turn fed from theme.json through ThemeService. Changing the palette
 * is therefore a theme.json edit and nothing else; no colour is hard-coded
 * below except where a fixed white/black is the point (text on a coloured
 * button) or where a token does not exist (the step tints).
 *
 * The layout links this file but does not depend on it: if Apache refuses the
 * symlinked path for any reason the client area still renders, it just loses
 * the funnel polish. Anything load-bearing stays inline in the views.
 *
 * Dark mode rides on :root[data-theme="dark"], which core's layout sets from
 * the pnlcs_theme cookie.
 */

/* ───────────────────────────────────────────────────────────────────────────
   1. Shared bits
   ─────────────────────────────────────────────────────────────────────── */

.rl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.rl-btn:hover { text-decoration: none; }
.rl-btn-primary { background: var(--primary); color: #fff; }
.rl-btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.rl-btn-ghost { background: var(--card); color: var(--primary); border-color: var(--border); }
.rl-btn-ghost:hover { border-color: var(--primary); background: var(--primary-light); }
.rl-btn-block { width: 100%; }
.rl-btn-lg { padding: 14px 26px; font-size: 15.5px; }

.rl-note {
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    padding: 12px 15px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    margin: 16px 0 0;
}
.rl-note p { margin: 4px 0 0; }
.rl-note-warn { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 9%, var(--card)); }

/* ───────────────────────────────────────────────────────────────────────────
   2. Screen 1 — Start your site
   ─────────────────────────────────────────────────────────────────────── */

.rl-start { max-width: 920px; margin: 0 auto; }
.rl-start-head { text-align: center; margin-bottom: 28px; }
.rl-start-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.6px; color: var(--text); margin: 0; }
.rl-start-head p { font-size: 15px; color: var(--muted); margin: 8px 0 0; }

.rl-steps-bar {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
    color: var(--muted); margin-bottom: 22px;
}
.rl-steps-bar b { color: var(--primary); }
.rl-steps-bar span { width: 26px; height: 2px; background: var(--border); display: inline-block; }

.rl-field { margin-bottom: 22px; }
.rl-field > label,
.rl-label {
    display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px;
}
.rl-label-note { font-weight: 500; color: var(--muted); margin-left: 6px; }
.rl-hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 8px 0 0; }

/* Billing-cycle radio cards. A grid that collapses to one column rather than
   core's fixed three, because two cycles should not leave a gap and five
   should not squash. */
.rl-cycles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rl-cycle {
    position: relative; display: block; cursor: pointer; text-align: center;
    padding: 16px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card); transition: border-color .14s, background .14s, box-shadow .14s;
}
.rl-cycle:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.rl-cycle input { position: absolute; opacity: 0; pointer-events: none; }
.rl-cycle:has(input:checked) {
    border-color: var(--primary); background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary) inset;
}
/* :has() is widely supported but not universal; funnel.js mirrors the state
   onto .is-on so older browsers still show the selection. */
.rl-cycle.is-on {
    border-color: var(--primary); background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary) inset;
}
.rl-cycle input:focus-visible + .rl-cycle-price { outline: 2px solid var(--primary); outline-offset: 3px; }
.rl-cycle-price { display: block; font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.rl-cycle-per { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; text-transform: capitalize; }
.rl-cycle-save {
    display: inline-block; margin-top: 7px; padding: 2px 8px; border-radius: 999px;
    font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
    background: color-mix(in srgb, var(--success) 14%, var(--card)); color: var(--success);
}

.rl-included { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 9px 22px; }
.rl-included li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.rl-included i { color: var(--primary); font-size: 15px; }

/* ───────────────────────────────────────────────────────────────────────────
   3. Screen 2 — Checkout
   ─────────────────────────────────────────────────────────────────────── */

.rl-checkout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 940px) { .rl-checkout { grid-template-columns: minmax(0, 1fr); } }
/* The summary goes first on a narrow screen: what you are buying before how
   you pay for it. */
@media (max-width: 940px) {
    .rl-checkout > .rl-checkout-aside { order: -1; }
}
.rl-checkout-aside { position: sticky; top: 80px; }

.rl-sum-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.rl-sum-row:last-of-type { border-bottom: none; }
.rl-sum-row .k { color: var(--muted); }
.rl-sum-row .v { font-weight: 600; text-align: right; word-break: break-word; }
.rl-sum-total { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0 2px; margin-top: 6px; border-top: 2px solid var(--border); font-size: 16px; font-weight: 800; }
.rl-sum-total .v { color: var(--primary); }

/* The promo field is a link until it is wanted (RFC 04 §4). */
.rl-promo-toggle { background: none; border: 0; padding: 0; margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: underline; cursor: pointer; }
.rl-promo-toggle:hover { color: var(--primary); }

.rl-terms { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 14px; background: var(--primary-light); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6; }
.rl-terms input { margin-top: 2px; flex-shrink: 0; accent-color: var(--primary); }

/* ───────────────────────────────────────────────────────────────────────────
   4. The invoice, when it is the last step of the funnel
   ─────────────────────────────────────────────────────────────────────── */

.rl-pay-lead {
    border-radius: var(--radius); padding: 22px 26px; margin-bottom: 22px; color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--primary) 60%, transparent);
}
.rl-pay-lead-in { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.rl-pay-lead h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.rl-pay-lead p { margin: 5px 0 0; font-size: 13.5px; line-height: 1.55; opacity: .92; max-width: 54ch; }
.rl-pay-step { flex-shrink: 0; font-size: 12px; font-weight: 800; letter-spacing: .5px; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.18); }
.rl-pay-right { margin-left: auto; text-align: right; }
.rl-pay-amount { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.6px; white-space: nowrap; }
.rl-pay-jump { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; color: #fff; text-decoration: underline; }
.rl-pay-jump:hover { color: #fff; }
@media (max-width: 640px) { .rl-pay-right { margin-left: 0; text-align: left; } }

/* ───────────────────────────────────────────────────────────────────────────
   5. Screen 3 — provisioning progress
   ─────────────────────────────────────────────────────────────────────── */

.rl-prog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); padding: 26px 28px; margin-bottom: 24px; }
.rl-prog-head { display: flex; align-items: flex-start; gap: 16px; }
.rl-prog-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.rl-prog-head p { margin: 5px 0 0; font-size: 13.5px; color: var(--muted); }

.rl-spin {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--primary);
    animation: rl-spin 900ms linear infinite;
}
@keyframes rl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rl-spin { animation-duration: 3s; } }

.rl-tick {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--success); color: #fff; font-size: 18px; font-weight: 800;
}

.rl-steps { list-style: none; margin: 22px 0 0; padding: 0; }
.rl-step { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rl-step:last-child { border-bottom: none; }
.rl-step-mark { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); background: var(--card); position: relative; }
.rl-step-label { flex: 1; color: var(--muted); }
.rl-step-state { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }

.rl-step[data-done="1"] .rl-step-mark { background: var(--success); border-color: var(--success); }
.rl-step[data-done="1"] .rl-step-mark::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.rl-step[data-done="1"] .rl-step-label { color: var(--text); font-weight: 600; }
.rl-step[data-done="1"] .rl-step-state { color: var(--success); }

/* The first step that is not done is the one in progress. */
.rl-step.is-working .rl-step-mark { border-color: var(--primary); border-top-color: transparent; animation: rl-spin 900ms linear infinite; }
.rl-step.is-working .rl-step-label { color: var(--text); font-weight: 600; }
.rl-step.is-working .rl-step-state { color: var(--primary); }

.rl-prog-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 22px; }
.rl-prog-hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 14px 0 0; }
.rl-prog-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0 0; font-size: 13px; }
.rl-prog-meta dt { color: var(--muted); font-weight: 600; }
.rl-prog-meta dd { margin: 0; font-weight: 700; }
.rl-prog-meta code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--primary-light); color: var(--primary); padding: 2px 9px; border-radius: 6px; }

/* ───────────────────────────────────────────────────────────────────────────
   6. Dashboard — site cards (RFC 09 §2)
   ─────────────────────────────────────────────────────────────────────── */

.rl-sites-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.rl-sites-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }

.rl-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; margin-bottom: 28px; }
.rl-site {
    display: flex; flex-direction: column; gap: 14px; padding: 20px 22px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
    box-shadow: var(--shadow); transition: transform .16s, box-shadow .16s, border-color .16s;
}
.rl-site:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.rl-site-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rl-site-name { font-size: 16px; font-weight: 800; letter-spacing: -.3px; color: var(--text); word-break: break-all; line-height: 1.25; }
.rl-site-name a { color: inherit; text-decoration: none; }
.rl-site-name a:hover { color: var(--primary); }
.rl-site-plan { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.rl-pill { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.rl-pill-live { background: color-mix(in srgb, var(--success) 14%, var(--card)); color: var(--success); }
.rl-pill-building { background: color-mix(in srgb, var(--warning) 16%, var(--card)); color: var(--warning); }
.rl-pill-off { background: var(--primary-light); color: var(--muted); }
.rl-pill-updates { background: color-mix(in srgb, var(--info) 14%, var(--card)); color: var(--info); text-transform: none; letter-spacing: 0; }

.rl-site-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.rl-site-actions .rl-btn { padding: 8px 14px; font-size: 12.5px; }
.rl-site-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); }

.rl-empty { text-align: center; padding: 44px 24px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--card); }
.rl-empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: var(--text); }
.rl-empty p { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }

/* ───────────────────────────────────────────────────────────────────────────
   7. Small corrections to core
   ─────────────────────────────────────────────────────────────────────── */

/* Core's client layout prints three fixed light-grey hairlines in the invoice
   totals block (#f1f5f9), which vanish in dark mode. */
:root[data-theme="dark"] .pn-card-body div[style*="#f1f5f9"] { border-bottom-color: var(--border) !important; }

/* Core's invoice gateway tabs have no focus ring. */
.gw-tab:focus-visible,
.pn-pay-option:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* The theme's one typographic liberty: tighter headings than core's default. */
.pn-page-title, .pn-card-title { letter-spacing: -.3px; }
