/* CTA Templates — affiliate brand recommendation blocks
 *
 * alpha231.24.11 — owns three placement shapes (A/B/C) used by
 * CtaRenderer to surface locale-aware brand recommendations inside
 * match reports, FIFA hub pages, sport hubs, and trending posts.
 *
 * Design principles:
 *   - Mobile-first; everything fluid by default, breakpoints only
 *     where touch-friendly tap-target sizes need bigger spacing.
 *   - Self-contained namespace (.aiseo-cta, .aiseo-cta-a, .aiseo-cta-b,
 *     .aiseo-cta-c) so theme CSS doesn't leak in or out.
 *   - Visible frames on white parent bg (we burned a hotfix on
 *     /match-reports/ cards because a 1px #e5e7eb border vanished;
 *     all cards here use 1.5px #cbd5e1 minimum + dual-layer shadow).
 *   - No JS required. Sticky bar / dismissal will live in a
 *     separate cta-templates.js if/when we build that placement.
 */

/* Shared design tokens — kept inline (CSS custom prop) so the whole
 * CTA system can be themed by a parent .aiseo-cta-theme--dark wrapper
 * later without touching component CSS. */
.aiseo-cta {
    --cta-fg:        #0f172a;
    --cta-fg-muted:  #475569;
    --cta-fg-soft:   #64748b;
    --cta-bg:        #ffffff;
    --cta-bg-soft:   #f8fafc;
    --cta-border:    #cbd5e1;          /* slate-300 — visible on white */
    --cta-accent:    #1e3a8a;          /* deep blue, professional */
    --cta-accent-2:  #3b82f6;          /* lighter blue for hover */
    --cta-gold:      #f59e0b;          /* medal / star */
    --cta-shadow:    0 2px 6px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --cta-shadow-h:  0 8px 20px rgba(30, 58, 138, .14);
    --cta-radius:    14px;
    --cta-radius-sm: 10px;
    --cta-gap:       14px;
    --cta-pad:       18px;
    --cta-pad-lg:    22px;

    box-sizing: border-box;
    margin: 28px 0;
    /* alpha231.24.11.1 — iOS overflow guard. iOS Safari can leak past
     * viewport when grid children have implicit min-width: min-content. */
    max-width: 100%;
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", "Microsoft JhengHei", "PingFang TC", sans-serif;
    color: var(--cta-fg);
    line-height: 1.55;
}
.aiseo-cta *,
.aiseo-cta *::before,
.aiseo-cta *::after {
    box-sizing: inherit;
    /* Prevent grid/flex items from blowing out container on iOS */
    min-width: 0;
}

/* ─── Template A — compact pure-jump list ─────────────────────── */
.aiseo-cta--a {
    background: var(--cta-bg);
    border: 1.5px solid var(--cta-border);
    border-radius: var(--cta-radius);
    padding: var(--cta-pad);
    box-shadow: var(--cta-shadow);
}
.aiseo-cta-a__heading {
    margin: 0 0 12px;
    font-size: 1em;
    font-weight: 700;
    color: var(--cta-fg);
    letter-spacing: .01em;
}
.aiseo-cta-a__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.aiseo-cta-a__item {
    margin: 0;
    padding: 0;
}
.aiseo-cta-a__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--cta-bg-soft);
    border: 1px solid var(--cta-border);
    border-radius: var(--cta-radius-sm);
    color: var(--cta-fg);
    text-decoration: none;
    font-weight: 600;
    transition: all .18s ease;
    min-height: 44px;            /* a11y tap target */
}
.aiseo-cta-a__link:hover,
.aiseo-cta-a__link:focus-visible {
    border-color: var(--cta-accent-2);
    background: #fff;
    color: var(--cta-accent);
    box-shadow: 0 4px 10px rgba(30, 58, 138, .1);
    transform: translateX(2px);
}
.aiseo-cta-a__arrow {
    color: var(--cta-accent-2);
    font-weight: 400;
    margin-left: 12px;
    transition: transform .18s ease;
}
.aiseo-cta-a__link:hover .aiseo-cta-a__arrow {
    transform: translateX(3px);
}

/* ─── Template B — question-led contextual ─────────────────────── */
.aiseo-cta--b {
    background: linear-gradient(135deg, #fff 0%, #f1f5f9 100%);
    border: 1.5px solid var(--cta-border);
    border-radius: var(--cta-radius);
    padding: var(--cta-pad-lg);
    box-shadow: var(--cta-shadow);
}
.aiseo-cta-b__question {
    margin: 0 0 6px;
    font-size: 1.15em;
    font-weight: 700;
    color: var(--cta-fg);
    line-height: 1.4;
}
.aiseo-cta-b__lead {
    margin: 0 0 14px;
    font-size: .92em;
    color: var(--cta-fg-soft);
    font-weight: 500;
}
.aiseo-cta-b__brands {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 10px;
    width: 100%;
}
.aiseo-cta-b__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--cta-bg);
    border: 1.5px solid var(--cta-border);
    border-radius: var(--cta-radius-sm);
    color: var(--cta-fg);
    text-decoration: none;
    font-weight: 700;
    transition: all .18s ease;
    min-height: 48px;
}
.aiseo-cta-b__brand:hover,
.aiseo-cta-b__brand:focus-visible {
    border-color: var(--cta-accent-2);
    color: var(--cta-accent);
    box-shadow: var(--cta-shadow-h);
    transform: translateY(-2px);
}
.aiseo-cta-b__brand-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aiseo-cta-b__brand-arrow {
    color: var(--cta-accent-2);
    font-weight: 400;
    margin-left: 10px;
    flex-shrink: 0;
    transition: transform .18s ease;
}
.aiseo-cta-b__brand:hover .aiseo-cta-b__brand-arrow {
    transform: translateX(3px);
}

/* ─── Template C — premium trust-stack cards ─────────────────────── */
/* alpha231.24.11.3 — operator wanted: 質感 / 醒目 / 易操作 / 載入快.
 * Pure CSS upgrade — no images, no JS. Glassmorphism-lite container,
 * gradient outlines, refined logo wells, prominent CTA buttons. */
.aiseo-cta--c {
    background:
        radial-gradient(circle at top left, #eff6ff 0%, transparent 50%),
        radial-gradient(circle at bottom right, #f0f9ff 0%, transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1.5px solid var(--cta-border);
    border-radius: 18px;
    padding: 28px 22px 24px;
    box-shadow:
        0 4px 12px rgba(15, 23, 42, .06),
        0 1px 3px rgba(15, 23, 42, .04);
}
.aiseo-cta-c__heading {
    margin: 0 0 22px;
    font-size: 1.3em;
    font-weight: 800;
    color: var(--cta-fg);
    text-align: center;
    line-height: 1.3;
    letter-spacing: .01em;
}
.aiseo-cta-c__cards {
    display: grid;
    /* alpha231.24.11.1 — `min(220px, 100%)` prevents grid blowout on
     * narrow iOS viewports where 220px > available width. */
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 16px;
    width: 100%;
}
.aiseo-cta-c__card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 18px 18px;
    background:
        linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    box-shadow:
        0 2px 6px rgba(15, 23, 42, .06),
        0 1px 2px rgba(15, 23, 42, .04);
    transition:
        transform .25s cubic-bezier(.4, 0, .2, 1),
        box-shadow .25s cubic-bezier(.4, 0, .2, 1),
        border-color .2s ease;
    overflow: hidden;
}
/* Top accent line — subtle gradient that brightens on hover */
.aiseo-cta-c__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #3b82f6 100%);
    opacity: .55;
    transition: opacity .25s ease;
}
.aiseo-cta-c__card:hover {
    border-color: #93c5fd;
    box-shadow:
        0 12px 28px rgba(59, 130, 246, .15),
        0 4px 8px rgba(15, 23, 42, .06);
    transform: translateY(-4px);
}
.aiseo-cta-c__card:hover::before {
    opacity: 1;
}
/* alpha231.24.11.6 — operator: most casino logos are landscape, square
 * wells crop them awkwardly. Stack vertically: full-width logo well on
 * top, title + rating + tagline below. Each card becomes:
 *   [───── LOGO WELL (landscape) ─────]
 *   Brand Name        ⭐ 9.3
 *   Tagline...
 *   [─────── 前往查看 → ───────]      */
.aiseo-cta-c__head {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}
/* Logo well = colored container; logo img = transparent foreground.
 * alpha231.24.11.5 — separates the bg color (per-brand theme inline-styled)
 * from the img element so any logo color is visible on its branded backdrop.
 * Default fallback (when no theme_color): dark slate gradient — works for
 * white logos which were the operator's pain point. */
.aiseo-cta-c__logo-well {
    /* alpha231.24.11.6 — full-width landscape banner for horizontal logos.
     * 5:2 aspect ratio gives wide canvas; padding ensures logo doesn't
     * touch edges; height bounded to keep cards aligned across grid. */
    width: 100%;
    aspect-ratio: 5 / 2;
    max-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 10px 14px;
    /* Default fallback bg — dark gradient, white logos pop */
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
    border: 1px solid rgba(15, 23, 42, .15);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .15),
        inset 0 -1px 2px rgba(0, 0, 0, .15),
        0 2px 4px rgba(15, 23, 42, .1);
    overflow: hidden;
}
.aiseo-cta-c__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.aiseo-cta-c__titleblock {
    /* alpha231.24.11.6 — now full-width row below the landscape logo well.
     * Layout: title on left, rating chip on right. */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.aiseo-cta-c__title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 800;
    color: var(--cta-fg);
    line-height: 1.25;
    overflow-wrap: anywhere;
    flex: 1;
    min-width: 0;
}
.aiseo-cta-c__rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fef3c7;          /* amber-100 — gentle highlight chip */
    border-radius: 999px;
    font-size: .88em;
    color: #92400e;               /* amber-800 */
    font-weight: 700;
    flex-shrink: 0;
}
.aiseo-cta-c__star {
    color: var(--cta-gold);
    font-size: 1em;
    line-height: 1;
}
.aiseo-cta-c__tagline {
    margin: 0;
    font-size: .92em;
    color: var(--cta-fg-muted);
    line-height: 1.5;
    /* Clamp to 2 lines so cards stay aligned even with varying tagline lengths */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.aiseo-cta-c__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: auto;       /* push CTA to bottom of flex card */
    padding: 13px 18px;
    background:
        linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #4f46e5 100%);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1em;
    text-decoration: none;
    letter-spacing: .02em;
    box-shadow:
        0 4px 10px rgba(37, 99, 235, .25),
        inset 0 1px 0 rgba(255, 255, 255, .15);
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
    min-height: 46px;
    position: relative;
    overflow: hidden;
}
.aiseo-cta-c__cta::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .25) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform .6s ease;
}
.aiseo-cta-c__cta:hover,
.aiseo-cta-c__cta:focus-visible {
    transform: translateY(-2px);
    box-shadow:
        0 8px 18px rgba(37, 99, 235, .35),
        inset 0 1px 0 rgba(255, 255, 255, .2);
    filter: brightness(1.08);
    color: #fff;
}
.aiseo-cta-c__cta:hover::after {
    transform: translateX(100%);
}

/* ─── Inline disclaimer (embedded inside every CTA block) ──────── */
.aiseo-cta__disclaimer-inline {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px dashed var(--cta-border);
    font-size: .78em;
    color: var(--cta-fg-soft);
    text-align: center;
    line-height: 1.5;
    letter-spacing: .01em;
}

/* ─── Full footer disclaimer (use once per page) ──────────────── */
.aiseo-cta-disclaimer-full {
    margin: 36px 0 24px;
    padding: 16px 20px;
    background: #fff7ed;             /* amber-50 */
    border: 1px solid #fed7aa;       /* amber-200 */
    border-radius: 10px;
    color: #7c2d12;                  /* amber-900 */
    font-size: .88em;
    line-height: 1.65;
    text-align: left;
}
.aiseo-cta-disclaimer-full strong {
    color: #9a3412;                  /* amber-800 */
}

/* ─── Responsive tweaks ───────────────────────────────────────── */
/* alpha231.24.11.1 — bumped breakpoint 540 → 600 to catch iPhone landscape
 * + small Android. Forces single column on all phones, removes the
 * narrow 2-col case where Chinese brand names wrap awkwardly. */
@media (max-width: 600px) {
    .aiseo-cta {
        --cta-pad: 14px;
        --cta-pad-lg: 16px;
        margin: 22px 0;
    }
    .aiseo-cta-c__heading {
        font-size: 1.05em;
    }
    .aiseo-cta-c__cards {
        grid-template-columns: 1fr;
    }
    .aiseo-cta-b__brands {
        grid-template-columns: 1fr;
    }
    .aiseo-cta-c__logo-well {
        /* Mobile: aspect-ratio still landscape but allow more height since
         * cards are full-width on phones. */
        max-height: 130px;
        padding: 8px 12px;
    }
    .aiseo-cta-c__card {
        padding: 20px 14px 14px;
    }
    .aiseo-cta-c__title {
        font-size: 1em;
    }
    .aiseo-cta-c__tagline {
        font-size: .88em;
    }
    .aiseo-cta--c {
        padding: 22px 14px 14px;
    }
}

/* alpha231.24.11.1 — extra tightening for iPhone SE / older Androids
 * <= 380px viewport, where even 14px padding feels cramped. */
@media (max-width: 380px) {
    .aiseo-cta {
        --cta-pad: 12px;
        --cta-pad-lg: 14px;
    }
    .aiseo-cta--c {
        padding: 20px 12px 12px;
    }
    .aiseo-cta-c__card {
        padding: 18px 12px 12px;
    }
    .aiseo-cta-c__heading {
        font-size: 1em;
    }
    .aiseo-cta-c__head {
        gap: 10px;
    }
    .aiseo-cta-c__logo-well {
        max-height: 110px;
        padding: 6px 10px;
    }
}

/* ─── Reduced motion preference ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .aiseo-cta-a__link,
    .aiseo-cta-a__arrow,
    .aiseo-cta-b__brand,
    .aiseo-cta-b__brand-arrow,
    .aiseo-cta-c__card,
    .aiseo-cta-c__cta {
        transition: none;
    }
    .aiseo-cta-a__link:hover,
    .aiseo-cta-b__brand:hover,
    .aiseo-cta-c__card:hover,
    .aiseo-cta-c__cta:hover {
        transform: none;
    }
}
