/*
 * hub-components.css
 *
 * SharedUI partial component styles for vertical hub pages (Stage 4.0.1
 * partials: _HubProductPicker, _BotAgentComparisonTable, _PricingCardsBlock).
 *
 * Architecture: vertical-agnostic — uses only --brand-primary /
 * --brand-primary-light (set per-vertical by _SharedLayout :root) +
 * Bootstrap 5.3 built-in tokens (--bs-*).
 *
 * Loaded after vertical-specific CSS (e.g. medical.css) and after
 * full-footer.css. Unique .sb-* namespace prevents conflicts.
 *
 * Stage 4.0.6 — first stylesheet for SharedUI partials.
 */

/* ============================================================
 * Shared button base — used in HubProductPicker + PricingCardsBlock
 * ============================================================ */

.sb-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: var(--bs-border-radius);
    border: 2px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
}

.sb-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.sb-btn-primary {
    background-color: var(--brand-primary);
    color: var(--bs-white);
    border-color: var(--brand-primary);
}

.sb-btn-primary:hover {
    background-color: var(--brand-primary-light);
    border-color: var(--brand-primary-light);
    color: var(--bs-white);
}

.sb-btn-secondary {
    background-color: transparent;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.sb-btn-secondary:hover {
    background-color: var(--brand-primary);
    color: var(--bs-white);
}

/* ============================================================
 * Hub Product Picker — 2-card layout (Bot vs Agent)
 * ============================================================ */

.sb-product-picker {
    padding: 4rem 0;
    background-color: var(--bs-tertiary-bg);
}

.sb-product-picker-heading {
    text-align: center;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--bs-body-color);
}

.sb-product-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 768px) {
    .sb-product-picker-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.sb-product-card {
    background-color: var(--bs-white);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.sb-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.sb-product-card-header {
    margin-bottom: 1rem;
}

.sb-product-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-body-color);
    margin: 0;
}

.sb-product-card-description {
    color: var(--bs-secondary-color);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Optional: subtle accent strip on Bot vs Agent cards */
.sb-product-card-bot {
    border-top: 4px solid var(--brand-primary);
}

.sb-product-card-agent {
    border-top: 4px solid var(--brand-primary-light);
}

/* ============================================================
 * Bot vs Agent Comparison Table
 * ============================================================ */

.sb-comparison {
    padding: 4rem 1.5rem;
}

.sb-comparison-heading {
    text-align: center;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--bs-body-color);
}

.sb-comparison-table {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--bs-white);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
}

.sb-comparison-table thead th {
    background-color: var(--bs-tertiary-bg);
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: left;
    color: var(--bs-body-color);
    border-bottom: 2px solid var(--bs-border-color);
}

.sb-comparison-table thead th:nth-child(2),
.sb-comparison-table thead th:nth-child(3) {
    text-align: center;
    width: 22%;
}

.sb-comparison-table tbody th {
    padding: 0.875rem 1.25rem;
    font-weight: 500;
    text-align: left;
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color);
}

.sb-comparison-table tbody tr:last-child th,
.sb-comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.sb-comparison-cell {
    padding: 0.875rem 1.25rem;
    text-align: center;
    font-size: 1.125rem;
    border-bottom: 1px solid var(--bs-border-color);
    vertical-align: middle;
}

.sb-comparison-cell.yes {
    color: var(--brand-primary);
    font-weight: 700;
}

.sb-comparison-cell.no {
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.sb-comparison-note {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    margin-top: 0.25rem;
    font-weight: 400;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .sb-comparison-table thead th,
    .sb-comparison-table tbody th,
    .sb-comparison-cell {
        padding: 0.75rem 0.625rem;
        font-size: 0.85rem;
    }
    .sb-comparison-note {
        font-size: 0.7rem;
    }
}

/* ============================================================
 * Pricing Cards Block — 3-tier grid with featured middle tier
 * ============================================================ */

.sb-pricing {
    padding: 4rem 1.5rem;
    background-color: var(--bs-tertiary-bg);
}

.sb-pricing-loading,
.sb-pricing-fallback-note {
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
    margin: 2rem auto;
}

.sb-pricing-fallback-note {
    margin-top: 1.5rem;
    font-style: italic;
}

.sb-pricing-grid {
    /* Flex + centre so a 5-card set (3 + 2) centres its last row instead of
       leaving an empty third column on the right. */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1120px;
    margin: 0 auto;
}

.sb-pricing-grid > .sb-pricing-card {
    flex: 1 1 300px;
    max-width: 340px;
}

@media (max-width: 900px) {
    .sb-pricing-grid {
        max-width: 480px;
    }
}

/* ------------------------------------------------------------
 * Premium pricing cards (redesign 2026-07): layered elevation,
 * gradient accent on the featured tier, serif price/tier accents
 * (Fraunces), SVG check bullets, and a filled/outline CTA hierarchy.
 * ------------------------------------------------------------ */

.sb-pricing-card {
    background-color: var(--bs-white);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 2.25rem 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    text-align: center;
    box-shadow: 0 2px 10px rgba(20, 24, 51, 0.05);
    transition: box-shadow 0.22s ease, transform 0.22s ease;
    position: relative;
}

.sb-pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(20, 24, 51, 0.13);
}

.sb-pricing-card-featured {
    border: 2px solid var(--brand-primary);
    box-shadow: 0 18px 44px rgba(27, 37, 102, 0.20);
}

@media (max-width: 900px) {
    .sb-pricing-card-featured {
        transform: none;
    }
}

.sb-pricing-card-header {
    margin-bottom: 1.25rem;
    width: 100%;
}

.sb-pricing-tier-name {
    font-family: "Fraunces", "Heebo", Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0.25rem 0 0.35rem;
}

.sb-pricing-description {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin: 0.5rem 0 0;
    line-height: 1.5;
    min-height: 2.5em;
}

.sb-pricing-amount {
    /* Fixed height + bottom-aligned content so the price baseline (and the
       bullets below it) line up across every card regardless of whether the
       tier shows a "from" prefix, a $0, or a custom label. */
    min-height: 4.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    margin: 0.5rem 0 0.35rem;
    line-height: 1;
    color: var(--bs-body-color);
}

.sb-pricing-price-line {
    display: block;
    white-space: nowrap;
}

.sb-pricing-from {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    margin-bottom: 0.35rem;
    text-transform: lowercase;
}

.sb-pricing-currency {
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--bs-body-color);
    vertical-align: top;
    margin-inline-end: 0.1rem;
}

.sb-pricing-card .sb-pricing-amount bdi {
    font-family: "Fraunces", Georgia, serif;
    font-size: 3rem;
    font-weight: 600;
    color: var(--bs-body-color);
    letter-spacing: -0.01em;
}

.sb-pricing-period {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    margin-inline-start: 0.15rem;
}

/* Vertical-discount strike-through + "save X%" badge. Rendered only when a
   per-vertical discount is configured (DiscountVisible + effective < base). */
.sb-pricing-strike {
    color: var(--bs-secondary-color);
    text-decoration: line-through;
    font-size: 1rem;
    opacity: 0.75;
    margin-bottom: 0.15rem;
}

.sb-pricing-discount-badge {
    display: inline-block;
    margin: 0.15rem 0 0.35rem;
    padding: 0.15rem 0.6rem;
    background-color: rgba(21, 163, 74, 0.12);
    color: #15803d;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sb-pricing-custom {
    /* Body font (not the serif used for numeric prices): a long localised word
       like RU "Индивидуально" overflows / mid-word-breaks in wide Fraunces. */
    display: inline-block;
    max-width: 100%;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--bs-body-color);
    line-height: 1.15;
}

.sb-pricing-bullets {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    width: 100%;
    text-align: start;
}

.sb-pricing-bullet {
    position: relative;
    padding-block: 0.4rem;
    padding-inline-start: 1.7rem;
    color: var(--bs-body-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

.sb-pricing-bullet::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.5rem;
    width: 1.1rem;
    height: 1.1rem;
    /* Filled circle-check, brand primary (#1B2566). Symmetric — no RTL flip. */
    background: no-repeat center / contain
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231B2566'%3E%3Cpath d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.7-9.3l-4.5 4.5a1 1 0 01-1.4 0L5.3 10.7a1 1 0 011.4-1.4l1.8 1.8 3.8-3.8a1 1 0 011.4 1.4z'/%3E%3C/svg%3E");
}

.sb-pricing-bullet-negative {
    color: var(--bs-secondary-color);
    opacity: 0.7;
}

.sb-pricing-bullet-negative::before {
    /* Muted circle-x for excluded features. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239aa0b0'%3E%3Cpath d='M10 2a8 8 0 100 16 8 8 0 000-16zm3 10.6L11.4 14 10 12.6 8.6 14 7 12.6 8.4 11 7 9.4 8.6 8 10 9.4 11.4 8 13 9.4 11.6 11 13 12.6z'/%3E%3C/svg%3E");
}

.sb-pricing-bullet-strong {
    font-weight: 700;
}

.sb-pricing-card .sb-btn {
    width: 100%;
    margin-top: auto;
}

/* CTA hierarchy: featured tier keeps the filled primary button; every other
   tier renders it as an outline so the recommended plan draws the eye. */
.sb-pricing-card:not(.sb-pricing-card-featured) .sb-btn-primary {
    background-color: transparent;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.sb-pricing-card:not(.sb-pricing-card-featured) .sb-btn-primary:hover {
    background-color: var(--brand-primary);
    color: var(--bs-white);
}

.sb-pricing-popular-badge {
    position: absolute;
    top: -0.8rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
    color: var(--bs-white);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(27, 37, 102, 0.35);
    z-index: 1;
}

/* ============================================================
 * Wave 4 — Accessibility additions
 * Applied globally across all SharedLayout consumers (6 verticals).
 * ============================================================ */

/* WCAG AA — visible focus indicator for keyboard users.
   :focus-visible (not :focus) к avoid showing ring on mouse click.
   2px ring + 2px offset for clear contrast on any background. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand-primary, #1B2566);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Respect prefers-reduced-motion — disable animations/transitions for
   users who selected reduced motion в OS settings. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
 * Glossary — premium searchable reference index. A scannable card
 * grid with a serif (Fraunces) term, a per-vertical brand accent, an
 * accent rail, depth + reward-on-hover, and a sticky icon search.
 * Shared across every vertical + www glossary page, all langs.
 *
 * PER-VERTICAL COLOUR: each vertical stylesheet defines only its OWN
 * primary var (--med-primary / --edu-primary / …); www sets
 * --brand-primary. Since a host loads exactly one of those, the var()
 * fallback chain below resolves to whichever is defined → the glossary
 * paints itself in that vertical's brand with zero per-site edits.
 * color-mix() derives every tint/glow from that single accent.
 * ============================================================ */
.glossary-wrap {
    --gloss-accent:
        var(--med-primary,
        var(--edu-primary,
        var(--legal-primary,
        var(--sales-primary,
        var(--fitness-primary,
        var(--business-primary,
        var(--hospitality-primary,
        var(--event-primary,
        var(--beauty-primary,
        var(--brand-primary, #1B2566))))))))));
    --gloss-ink: var(--bs-body-color, #141833);
    --gloss-slate: var(--bs-secondary-color, #5b6577);
    --gloss-surface: var(--bs-white, #fff);
    --gloss-hairline: var(--bs-border-color, #e6e8f0);
    max-width: 1120px;
    margin: 0 auto;
}

.glossary-toolbar {
    position: sticky;
    top: 12px;
    z-index: 5;
    margin: 0 0 2rem;
    display: flex;
    justify-content: center;
    padding-block: 6px;
}

.glossary-search {
    width: 100%;
    max-width: 520px;
    padding: 0.85rem 1.3rem 0.85rem 3rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--gloss-ink);
    background-color: var(--gloss-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a91a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1.1rem center;
    border: 1px solid var(--gloss-hairline);
    border-radius: 999px;
    box-shadow: 0 2px 10px -4px rgba(20, 24, 51, 0.12);
    transition: border-color .18s ease, box-shadow .18s ease;
}
[dir="rtl"] .glossary-search {
    padding: 0.85rem 3rem 0.85rem 1.3rem;
    background-position: right 1.1rem center;
}
.glossary-search::placeholder { color: #8a91a3; }
.glossary-search:focus {
    outline: none;
    border-color: var(--gloss-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--gloss-accent) 16%, transparent);
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
    align-items: start;
}
@media (max-width: 720px) { .glossary-grid { grid-template-columns: 1fr; } }

.glossary-card {
    position: relative;
    background:
        linear-gradient(180deg, var(--gloss-surface),
        color-mix(in srgb, var(--gloss-accent) 3%, var(--gloss-surface)));
    border: 1px solid var(--gloss-hairline);
    border-inline-start: 3px solid color-mix(in srgb, var(--gloss-accent) 32%, var(--gloss-hairline));
    border-radius: 14px;
    padding: 1.4rem 1.5rem 1.45rem;
    box-shadow: 0 1px 2px rgba(20, 24, 51, 0.04);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.glossary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px -16px color-mix(in srgb, var(--gloss-accent) 45%, transparent);
    border-color: color-mix(in srgb, var(--gloss-accent) 30%, var(--gloss-hairline));
    border-inline-start-color: var(--gloss-accent);
}
.glossary-card:target {
    border-inline-start-color: var(--gloss-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gloss-accent) 55%, transparent);
}

.glossary-term {
    font-family: "Fraunces", "Heebo", Georgia, serif;
    font-size: 1.22rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
    margin: 0 0 0.7rem;
    padding-bottom: 0.55rem;
    color: var(--gloss-accent);
    position: relative;
}
[dir="rtl"] .glossary-term { font-family: "Heebo", sans-serif; font-weight: 700; }
.glossary-term::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--gloss-accent) 60%, transparent);
}
.glossary-def {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.62;
    color: var(--gloss-slate);
}
.glossary-empty {
    grid-column: 1 / -1;
    text-align: center; padding: 2.5rem 1rem;
    color: var(--gloss-slate);
    font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
    .glossary-card { transition: none; }
    .glossary-card:hover { transform: none; }
}

/* ── Accessibility: keyboard focus-visible baseline (WCAG 2.4.7) ──────────
   Only shows on keyboard navigation (not mouse click), so it improves
   a11y without changing the mouse-hover look. Applies platform-wide. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}
/* On dark surfaces, a white ring reads better than blue. */
[data-hero-dark] a:focus-visible,
[data-hero-dark] button:focus-visible,
.hub-hero a:focus-visible,
.hub-hero button:focus-visible {
    outline-color: #ffffff;
}
