/* ===========================================================================
   Plans & Pricing (subscription.html).

   Category filters sit at the top of the list rather than on a separate
   landing step, and every active plan is on screen underneath by default.
   Cards are compact: subject icon, title, two clamped lines of description,
   price, and the trial/buy buttons.

   Every selector is `sc-` prefixed and scoped to `.sc-page`, so nothing here
   reaches the rest of the site. Behaviour lives in
   static/js/subscription_plans.js.
   =========================================================================== */

.sc-page {
    --sc-ink: #0f172a;
    --sc-muted: #64748b;
    --sc-line: #e2e8f0;
    --sc-bg: #f8fafc;
    --sc-card: #ffffff;
    --sc-brand: #4f46e5;
    --sc-brand-soft: #eef2ff;
    --sc-ok: #16a34a;
    --sc-radius: 14px;
    --sc-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --sc-accent: #4f46e5;
    /* Height of the shared sticky navbar (.global-navbar): content-driven, ~60px. */
    --sc-navbar-h: 60px;

    background: var(--sc-bg);
    color: var(--sc-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 1.25rem 1rem 3rem;
}

.sc-page [hidden] { display: none !important; }

.sc-shell {
    max-width: 1180px;
    margin: 0 auto;
}

/* -- page head ---------------------------------------------------------- */

.sc-head__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    letter-spacing: -0.01em;
}

.sc-head__sub {
    margin: 0;
    color: var(--sc-muted);
    font-size: 0.95rem;
}

/* -- search ------------------------------------------------------------- */

.sc-search {
    position: relative;
    flex: 1 1 260px;
    min-width: 200px;
}

.sc-search__icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.85rem;
}

.sc-search__input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.1rem;
    border: 1px solid var(--sc-line);
    border-radius: 999px;
    background: #fff;
    font-size: 0.9rem;
    color: var(--sc-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.sc-search__input:focus {
    outline: none;
    border-color: var(--sc-brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

/* -- filter chips ------------------------------------------------------- */

.sc-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--sc-line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}

.sc-chip i { font-size: 0.8rem; color: #94a3b8; }

.sc-chip:hover {
    border-color: #c7d2fe;
    background: #f5f6ff;
}

.sc-chip.is-active {
    background: var(--sc-brand);
    border-color: var(--sc-brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, .25);
}

.sc-chip.is-active i { color: rgba(255, 255, 255, .85); }

.sc-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
}

.sc-chip.is-active .sc-chip__count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

/* -- selects ------------------------------------------------------------ */

.sc-select {
    appearance: none;
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    border: 1px solid var(--sc-line);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5z'/%3E%3C/svg%3E") no-repeat right 0.55rem center/14px;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
}

.sc-select:focus {
    outline: none;
    border-color: var(--sc-brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.sc-field__label {
    font-size: 0.78rem;
    white-space: nowrap;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sc-muted);
}

/* -- subject icon tile -------------------------------------------------- */

.sc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--sc-accent) 12%, #fff);
    color: var(--sc-accent);
    flex: none;
}

/* -- badges ------------------------------------------------------------- */

.sc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.sc-badge i { font-size: 0.65rem; }
.sc-badge--popular { background: #fef3c7; color: #b45309; }
.sc-badge--owned { background: #dcfce7; color: #15803d; }
.sc-badge--free { background: #e0f2fe; color: #0369a1; }

.sc-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--sc-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sc-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.sc-subjects__item {
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 500;
}

/* -- price -------------------------------------------------------------- */

.sc-price {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.sc-price__amount {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--sc-ink);
    letter-spacing: -0.02em;
}

.sc-price__amount--free { color: var(--sc-ok); }

.sc-price__meta {
    font-size: 0.75rem;
    color: var(--sc-muted);
    font-weight: 500;
}

/* -- call to action ----------------------------------------------------- */

.sc-cta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.sc-btn i { font-size: 0.8rem; }

.sc-btn--buy {
    background: var(--sc-cta, var(--sc-accent));
    box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
}

.sc-btn--trial {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 2px 6px rgba(40, 167, 69, .3);
}

.sc-btn--buy:hover,
.sc-btn--trial:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.sc-btn--owned {
    background: #a3a3c2;
    cursor: not-allowed;
    opacity: .9;
}

/* -- states ------------------------------------------------------------- */

.sc-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--sc-muted);
}

.sc-state i { font-size: 1.75rem; margin-bottom: 0.75rem; color: var(--sc-brand); }
.sc-state p { margin: 0.25rem 0 0; font-size: 0.95rem; }
.sc-state--error i { color: #e74c3c; }

.sc-footnote {
    margin-top: 2.5rem;
    text-align: center;
    color: var(--sc-muted);
    font-size: 0.95rem;
}

.sc-footnote .btn { margin-top: 0.5rem; }

/* -- site footer (shared by the three candidates) ----------------------- */

.sc-site-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    background: #1a1a1a;
    border-top: 1px solid #333;
    color: #ffffff;
}

.sc-site-footer p { color: #ffffff; margin-bottom: 1rem; }
.sc-site-footer .footer-links a { color: #cccccc; text-decoration: none; }
.sc-site-footer .footer-links a:hover { color: #ffffff; }

/* -- bits the engine renders inside the shared Terms dialog ------------- */

.sc-modal__trial-note { font-size: 1rem; color: #666; }
.sc-modal__feature { padding: 0.3rem 0; color: #444; }

/* ---------------------------------------------------------------------------
   Layout: the sticky filter toolbar and the card grid.
   --------------------------------------------------------------------------- */

.sc-page .sc-head { margin-bottom: 1rem; }

/* -- toolbar ------------------------------------------------------------ */

.sc-page .sc-toolbar {
    position: sticky;
    top: var(--sc-navbar-h);
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin-bottom: 1.25rem;
    background: var(--sc-bg);
    border-bottom: 1px solid var(--sc-line);
}

.sc-page .sc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 420px;
    min-width: 0;
}

.sc-page .sc-chip { flex: none; }

.sc-page .sc-chips--type { flex: 0 0 auto; }

.sc-page .sc-toolbar__right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.sc-page .sc-toolbar__count {
    font-size: 0.85rem;
    color: var(--sc-muted);
    white-space: nowrap;
}

.sc-page .sc-divider {
    width: 1px;
    height: 1.4rem;
    background: var(--sc-line);
}

/* -- grid --------------------------------------------------------------- */

.sc-page .sc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 1rem;
}

.sc-page .sc-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--sc-card);
    border: 1px solid var(--sc-line);
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.sc-page .sc-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--sc-accent) 45%, #fff);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .1);
}

.sc-page .sc-card__top {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.sc-page .sc-card__icon {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
}

.sc-page .sc-card__heading { min-width: 0; flex: 1; }

/* The category label can run to two lines in a narrow card; keep it tight so
   it does not push the title down a row. */
.sc-page .sc-card__heading .sc-tag {
    font-size: 0.66rem;
    line-height: 1.15;
}

.sc-page .sc-card__title {
    margin: 0.15rem 0 0;
    min-height: 2.5em;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--sc-ink);
}

.sc-page .sc-card__badge { margin-left: auto; }

.sc-page .sc-card__desc {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--sc-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sc-page .sc-card__price {
    padding-top: 0.5rem;
    margin-top: auto;
    border-top: 1px dashed var(--sc-line);
}

/* -- phones ------------------------------------------------------------- */

@media (max-width: 640px) {
    .sc-page .sc-toolbar {
        position: static;
        flex-direction: column;
        align-items: stretch;
    }

    /* In a column flex container `flex-basis` sizes the HEIGHT, so the desktop
       `flex: 1 1 420px` would make each chip row 420px tall. */
    .sc-page .sc-chips {
        flex: 0 0 auto;
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: none;
    }

    .sc-page .sc-chips::-webkit-scrollbar { display: none; }

    .sc-page .sc-toolbar__right { margin-left: 0; flex-wrap: wrap; }
    .sc-page .sc-search { flex: 1 1 100%; }
    .sc-page .sc-divider { display: none; }

    .sc-page .sc-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 0.75rem; }

    .sc-page .sc-card { padding: 0.85rem; }
}

/* ---------------------------------------------------------------------------
   Navbar tweaks the plans page has always carried (moved out of the template's
   inline <style>). The dropdown z-index keeps the profile menu above the
   sticky filter toolbar.
   --------------------------------------------------------------------------- */

.navbar-nav .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #667eea !important;
    background: rgba(102, 126, 234, 0.1);
}

.navbar-nav .nav-link.active {
    color: #667eea !important;
    background: rgba(102, 126, 234, 0.15);
    font-weight: 600;
}

.navbar { z-index: 1030; }

.dropdown-menu {
    z-index: 1031 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-item { transition: all 0.2s ease; }

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: #667eea;
}
