/* AI Subscriptions: page-specific pieces on top of ai-analysis.css and top-models.css */

:root { --green: #26e6a4; --orange: #ffaa00; }

/* Page-wide search in the sticky top bar */
.top-nav { gap: 20px; }
.q-wrap { position: relative; flex: 1; max-width: 560px; }
.q-wrap > .bi-search { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
#q { width: 100%; padding: 6px 150px 6px 44px; line-height: 1.2; border-radius: 22px; border: 1px solid rgba(247, 147, 26, 0.45); background: rgba(247, 147, 26, 0.05); color: var(--text-main); font-family: inherit; font-size: 1rem; }
#q::placeholder { color: var(--text-muted); }
#q:focus { outline: none; border-color: var(--primary); background: rgba(247, 147, 26, 0.09); }
#q::-webkit-search-cancel-button { display: none; }
#qClear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; color: var(--text-dim); cursor: pointer; }
#qClear:hover { color: var(--ink); background: rgba(var(--fg), 0.08); }
.q-info { position: absolute; right: 44px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; pointer-events: none; }
.q-info strong { color: var(--text-main); font-weight: 600; }
.q-empty { color: var(--text-dim); padding: 18px 6px; }

/* Value board: one more column than Top Models */
.sub-head, .s-row { grid-template-columns: 36px minmax(200px, 1.3fr) 1fr 1fr 0.8fr 0.8fr; }
.s-row .b-provider { white-space: normal; }
.s-price { color: var(--primary); font-weight: 700; margin-left: 6px; white-space: nowrap; }
.s-price small { color: var(--text-muted); font-weight: 400; }
.b-fill.val { background: var(--frontier); }
.b-fill.mult { background: var(--lane-2); }
.b-fill.iq2 { background: var(--lane-0); }
.b-fill.ext { background: var(--lane-6); }
.b-free { font-size: 0.76rem; color: var(--green); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-free b { font-weight: 600; }
.b-free small { color: var(--text-muted); }
.b-free.none { color: var(--text-muted); opacity: 0.7; }
.kind-tag { font-size: 0.62rem; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--card-border); border-radius: 6px; padding: 0 5px; margin-left: 6px; vertical-align: 2px; }
.ex-icons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; font-size: 0.78rem; color: var(--text-dim); }
.ex-icons i { opacity: 0.9; }
.ex-icons i.part { opacity: 0.4; }

/* Scenario buttons above the value ranking */
.scen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.scen button { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--surface); color: var(--text-dim); font-family: inherit; font-size: 0.95rem; font-weight: 600; text-align: center; cursor: pointer; transition: all 0.2s ease; }
.scen button i { font-size: 1.25rem; color: var(--primary); }
.scen button:hover { color: var(--text-main); border-color: rgba(247, 147, 26, 0.45); }
.scen button.on { color: #0f111a; background: var(--primary); border-color: var(--primary); }
.scen button.on i { color: #0f111a; }
.scen-desc { font-size: 0.88rem; color: var(--text-dim); margin-bottom: 16px; min-height: 1.4em; }
.scen-desc strong { color: var(--text-main); font-weight: 600; }
@media (max-width: 768px) {
    .top-nav { gap: 10px; }
    .top-nav .logo-link span, .top-nav .nav-date { display: none; }
    #q { padding-right: 96px; font-size: 0.9rem; }
}
@media (max-width: 768px) { .scen { grid-template-columns: 1fr 1fr; } .scen button { font-size: 0.85rem; padding: 12px; } }

/* Unlimited coding */
.unl-list { display: grid; gap: 10px; }
.unl-chips { margin-bottom: 12px; }
.unl-chips .f-chip small { color: var(--text-muted); }
.unl {
    display: grid;
    grid-template-columns: 34px minmax(200px, 1fr) minmax(220px, 1.2fr) minmax(160px, 1fr);
    gap: 16px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px 18px;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.2s ease;
}
.unl-list.in .unl { opacity: 1; transform: none; }
.unl:hover { border-color: rgba(38, 230, 164, 0.45); }
.unl-rank { font-size: 1.1rem; font-weight: 700; color: var(--text-dim); }
.unl-plan { font-size: 0.95rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.unl-plan > small { display: block; font-weight: 400; color: var(--text-dim); font-size: 0.8rem; }
.unl-amount { font-size: 0.8rem; color: var(--text-main); margin-top: 1px; }
.unl-model { font-size: 0.95rem; color: var(--green); font-weight: 600; }
.unl-model small { color: var(--text-muted); font-weight: 400; }
.unl-bar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.unl-fill { height: 8px; border-radius: 0 4px 4px 0; background: var(--green); width: 0; transition: width 0.8s cubic-bezier(.2, .9, .3, 1); }
.unl-bar span { font-size: 0.8rem; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unl-bar span.na { color: var(--text-muted); font-weight: 400; }
.unl-fill.spd { background: var(--lane-0); }
.unl-bar span small { color: var(--text-muted); font-weight: 400; }
.unl-note { font-size: 0.82rem; color: var(--text-dim); }
.unl-note b { color: var(--text-main); font-weight: 600; }
.unl-empty { color: var(--text-dim); padding: 20px 0; }
@media (max-width: 768px) {
    .unl { grid-template-columns: 26px 1fr; gap: 6px 10px; }
    .unl-rank { grid-row: span 3; align-self: start; }
}
@media (prefers-reduced-motion: reduce) { .unl, .unl-fill { transition: none !important; } }

/* Feature matrix */
/* When the table fits the width it has no scroll box and the header row sticks to the page under the menus (--stick-top is set
   by the script). When it is too wide it scrolls inside its own box, and the header sticks to the top of that box instead. */
.feat-wrap { max-height: 78vh; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(247, 147, 26, 0.45) transparent; }
.feat-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.feat-wrap::-webkit-scrollbar-track { background: transparent; }
.feat-wrap::-webkit-scrollbar-thumb { background: rgba(247, 147, 26, 0.35); border-radius: 8px; }
.feat-wrap::-webkit-scrollbar-thumb:hover { background: rgba(247, 147, 26, 0.6); }
.feat-wrap.fits { max-height: none; overflow: visible; }
.feat-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.feat-wrap.fits .feat-matrix thead th { top: var(--stick-top, 0px); }
.feat-matrix thead th:first-child { z-index: 3; }
.feat-matrix td:first-child { z-index: 1; }
.feat-th { cursor: pointer; transition: color 0.2s ease; }
.feat-th:hover { color: var(--text-main); }
.feat-th.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--primary); }
.feat-th.on i { color: var(--ink); }
.feat-note { font-size: 0.85rem; color: var(--text-dim); margin: -12px 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 30px; }
.feat-note strong { color: var(--text-main); font-weight: 600; }
.plan-link { color: inherit; text-decoration: none; }
.plan-link:hover { color: var(--accent); }
.s-row, .feat-matrix tbody td { cursor: pointer; }
.feat-matrix td:first-child { white-space: nowrap; }
.feat-matrix td:first-child small { color: var(--text-muted); margin-left: 4px; }
.feat-matrix th i { font-size: 1rem; display: block; margin-bottom: 4px; color: var(--primary); }
.feat-matrix th { min-width: 74px; }
.fm-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--green, #26e6a4); }
.fm-dot.part { background: transparent; border: 2px solid var(--green, #26e6a4); opacity: 0.8; }
.fm-dot.none { width: 5px; height: 5px; background: rgba(var(--fg), 0.12); }
.feat-matrix tr:hover td { background: rgba(var(--fg), 0.03); }

/* Feature pop-up */
.feat-modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; padding: 22px 24px; border-radius: 18px; border: 1px solid var(--card-border); background: var(--surface); color: var(--text-main); font-family: inherit; line-height: 1.55; }
.feat-modal::backdrop { background: rgba(5, 6, 10, 0.72); backdrop-filter: blur(3px); }
.feat-modal[open] { animation: fmodIn 0.22s ease-out; }
@keyframes fmodIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.fmod-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.fmod-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; color: var(--primary); background: rgba(247, 147, 26, 0.12); }
.fmod-kicker { font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--primary); }
.fmod-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.fmod-title small { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }
.fmod-close { margin-left: auto; flex: none; background: transparent; border: 1px solid var(--card-border); color: var(--text-dim); border-radius: 10px; width: 32px; height: 32px; cursor: pointer; }
.fmod-close:hover { color: var(--ink); border-color: rgba(var(--fg), 0.3); }
.fmod-status { display: inline-block; font-size: 0.75rem; font-weight: 600; border-radius: 10px; padding: 2px 10px; border: 1px solid currentColor; margin-bottom: 6px; }
.fmod-status.s-yes { color: var(--green); }
.fmod-status.s-part { color: var(--orange); }
.fmod-status.s-no { color: var(--text-muted); }
.feat-modal h4 { font-size: 0.72rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin: 14px 0 4px; }
.feat-modal p { font-size: 0.92rem; color: var(--text-main); }
.feat-modal p b { color: var(--ink); font-weight: 600; }
.fmod-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 16px; font-size: 0.85rem; color: var(--accent); text-decoration: none; }
.fmod-link:hover { text-decoration: underline; }
.feat-matrix tbody td[data-f]:hover .fm-dot { transform: scale(1.35); }
.fm-dot { transition: transform 0.15s ease; }

/* Deals */
.deal-chips { margin-bottom: 14px; }
.deals { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.deal {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}
.deals.in .deal { opacity: 1; transform: none; }
.deal.hot { border-color: rgba(247, 147, 26, 0.55); background: linear-gradient(180deg, rgba(247, 147, 26, 0.07), var(--surface) 60%); }
.deal-head { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--primary); }
.deal-head .verdict { margin-left: auto; letter-spacing: 0.5px; border-radius: 10px; padding: 1px 8px; font-size: 0.68rem; border: 1px solid currentColor; }
.verdict.v-great { color: var(--green, #26e6a4); }
.verdict.v-good { color: var(--accent); }
.verdict.v-ok { color: var(--text-dim); }
.verdict.v-risky { color: var(--orange, #ffaa00); }
.deal-title { font-size: 1.12rem; font-weight: 700; color: var(--ink); line-height: 1.25; }
.deal-price { font-size: 0.9rem; color: var(--text-main); }
.deal-price b { color: var(--primary); }
.deal p { font-size: 0.86rem; color: var(--text-dim); }
.deal p strong { color: var(--text-main); font-weight: 600; }
.deal-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.76rem; color: var(--text-muted); padding-top: 8px; border-top: 1px solid rgba(var(--fg), 0.05); }
.deal-meta a { color: var(--accent); text-decoration: none; }
.deal-meta a:hover { text-decoration: underline; }

/* Popularity bars reuse .u-row from top-models.css with a wider name column */
#popBars .u-row { grid-template-columns: 170px 1fr; }
.method-list { margin: 6px 0 0 18px; font-size: 0.88rem; color: var(--text-dim); }
.method-list li { margin-bottom: 3px; }

@media (prefers-reduced-motion: reduce) { .deal { transition: none !important; } }

@media (max-width: 768px) {
    .sub-head, .s-row { grid-template-columns: 26px 1fr 1fr 1fr 1fr; }
    .sub-head > span:nth-child(2) { display: none; }
    .s-row { min-height: 84px; grid-template-areas: "rank name name name name" "rank val mult iq ext"; }
    .s-row .b-bar.val-bar { grid-area: val; }
    .s-row .b-bar.mult-bar { grid-area: mult; }
    .s-row .b-bar.iq-bar { grid-area: iq; }
    .s-row .b-bar.ext-bar { grid-area: ext; }
    #popBars .u-row { grid-template-columns: 110px 1fr; }
    .deals { grid-template-columns: 1fr; }
}

/* Bright skin */
:root[data-theme="light"] .feat-modal::backdrop { background: rgba(230, 234, 242, 0.75); }
:root[data-theme="light"] .feat-modal { box-shadow: 0 20px 50px rgba(20, 24, 40, 0.18); }
:root[data-theme="light"] .scen button { box-shadow: 0 1px 3px rgba(20, 24, 40, 0.06); }
