/* ============================================================
   ChessBase News - cookie banner and cookie settings dialog
   (Views/Shared/Mutter/CookieManagement.cshtml)

   Same tokens as Content/cbfront/account-forms.css and the
   backend: CB red #B51634, gradient #de0e1f -> #992721,
   Merriweather text, Montserrat buttons (both self-hosted).

   The ids (#askForCookiesBackground, #askForCookies,
   #showDetailsCookies, #cookie1-3) are used by the script in the
   partial, by Views/Page/page.cshtml and by old media rules in
   MutterMediaScreen.less; the selectors below use two ids so they
   win over those old one-id rules. px, not rem: Bootstrap 3 sets
   html{font-size:10px}.
   ============================================================ */

#askForCookiesBackground
{
    --cbc-red: #B51634;
    --cbc-darkred: #8a1128;
    --cbc-gradient: linear-gradient(135deg, #de0e1f, #992721);
    --cbc-ink: #111827;
    --cbc-text: #374151;
    --cbc-muted: #6b7280;
    --cbc-line: #e5e7eb;
    --cbc-serif: '__Merriweather_5', Merriweather, Georgia, 'Times New Roman', serif;
    --cbc-sans: 'Montserrat', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    --cbc-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.12);
}

#askForCookiesBackground *,
#askForCookiesBackground *::before,
#askForCookiesBackground *::after
{
    box-sizing: border-box;
}

/* ---------- shared bits ---------- */

#askForCookiesBackground .cbc-title
{
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-family: var(--cbc-serif);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.3;
    color: var(--cbc-ink);
}

#askForCookiesBackground .cbc-icon
{
    flex: none;
    width: 26px;
    height: 26px;
    color: var(--cbc-red);
}

#askForCookiesBackground .cbc-copy
{
    margin: 0;
    font-family: var(--cbc-serif);
    font-size: 13px;
    line-height: 1.65;
    color: var(--cbc-text);
}

#askForCookiesBackground a.cbcookiemanagement,
#askForCookiesBackground a.cbcookiemanagement:visited
{
    color: var(--cbc-red);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#askForCookiesBackground a.cbcookiemanagement:hover
{
    color: var(--cbc-darkred);
}

#askForCookiesBackground .cbc-btn
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 10px 20px;
    font-family: var(--cbc-sans);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
    color: #fff;
    background: #1a1a1a;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
}

#askForCookiesBackground .cbc-btn:hover
{
    filter: brightness(1.15);
}

#askForCookiesBackground .cbc-btn:focus-visible,
#askForCookiesBackground .cbc-close:focus-visible
{
    outline: 3px solid rgba(181, 22, 52, 0.35);
    outline-offset: 2px;
}

#askForCookiesBackground .cbc-btn-primary
{
    background: var(--cbc-gradient);
    box-shadow: 0 2px 8px rgba(181, 22, 52, 0.3);
}

#askForCookiesBackground .cbc-btn-primary:hover
{
    filter: brightness(1.08);
    box-shadow: 0 6px 16px rgba(181, 22, 52, 0.4);
}

#askForCookiesBackground .cbc-btn-ghost
{
    color: var(--cbc-text);
    background: #fff;
    border-color: #d1d5db;
}

#askForCookiesBackground .cbc-btn-ghost:hover
{
    filter: none;
    color: var(--cbc-red);
    border-color: var(--cbc-red);
}

/* ---------- banner ---------- */

#askForCookiesBackground #askForCookies
{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 10001;
    width: calc(100% - 32px);
    max-width: 1080px;
    max-height: calc(100vh - 32px);
    margin: 0 auto;
    padding: 0;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--cbc-line);
    border-radius: 14px;
    box-shadow: var(--cbc-shadow);
    animation: cbc-rise 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

#askForCookiesBackground #askForCookies::before,
#askForCookiesBackground .cbc-dialog::before
{
    content: '';
    display: block;
    height: 4px;
    background: var(--cbc-gradient);
}

#askForCookiesBackground .cbc-banner-inner
{
    display: flex;
    align-items: center;
    gap: 20px 32px;
    padding: 20px 24px 22px;
}

#askForCookiesBackground .cbc-banner-text
{
    flex: 1 1 auto;
    min-width: 0;
}

#askForCookiesBackground .cbc-actions
{
    flex: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- settings dialog ---------- */

#askForCookiesBackground #showDetailsCookies
{
    position: fixed;
    inset: 0;
    z-index: 10002;
    width: auto;
    max-width: none;
    padding: 24px 16px;
    overflow-y: auto;
    background: rgba(17, 24, 39, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: cbc-fade 0.25s ease-out;
}

#askForCookiesBackground .cbc-dialog
{
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 4vh auto;
    overflow: hidden;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--cbc-shadow);
    animation: cbc-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#askForCookiesBackground .cbc-dialog:focus
{
    outline: none;
}

#askForCookiesBackground .cbc-dialog-head
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}

#askForCookiesBackground .cbc-close
{
    flex: none;
    width: 36px;
    height: 36px;
    margin: -4px -8px 0 0;
    padding: 0;
    font-family: var(--cbc-sans);
    font-size: 24px;
    line-height: 1;
    color: var(--cbc-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

#askForCookiesBackground .cbc-close:hover
{
    color: var(--cbc-ink);
    background: #f3f4f6;
}

#askForCookiesBackground .cbc-dialog-body
{
    padding: 4px 24px 8px;
}

#askForCookiesBackground .cbc-dialog-body > .cbc-copy
{
    margin-bottom: 18px;
}

#askForCookiesBackground .cbc-option
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 10px;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid var(--cbc-line);
    border-radius: 10px;
}

#askForCookiesBackground .cbc-option-title
{
    display: block;
    margin: 0 0 2px;
    font-family: var(--cbc-sans);
    font-weight: 700;
    /* 15px, not 14: at 14px bold Montserrat on a normal (1x) screen joins the dot of the "i"
       to its stem ("Technlcally", "Cookles") */
    font-size: 15px;
    color: var(--cbc-ink);
    cursor: pointer;
}

#askForCookiesBackground .cbc-option.is-locked .cbc-option-title
{
    cursor: default;
}

#askForCookiesBackground .cbc-option-desc
{
    font-family: var(--cbc-serif);
    font-size: 12px;
    line-height: 1.55;
    color: var(--cbc-muted);
}

/* checkbox drawn as a switch; it stays a real checkbox for the script */
#askForCookiesBackground input.cbc-switch
{
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    margin: 0;
    padding: 0;
    background: #d1d5db;
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#askForCookiesBackground input.cbc-switch::before
{
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#askForCookiesBackground input.cbc-switch:checked
{
    background: var(--cbc-red);
}

#askForCookiesBackground input.cbc-switch:checked::before
{
    transform: translateX(20px);
}

#askForCookiesBackground input.cbc-switch:disabled
{
    opacity: 0.5;
    cursor: not-allowed;
}

#askForCookiesBackground input.cbc-switch:focus-visible
{
    outline: 3px solid rgba(181, 22, 52, 0.35);
    outline-offset: 2px;
}

#askForCookiesBackground .cbc-dialog-foot
{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 22px;
}

html.cbc-lock,
html.cbc-lock body
{
    overflow: hidden;
}

@keyframes cbc-rise
{
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

@keyframes cbc-fade
{
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- small screens ---------- */

@media (max-width: 900px)
{
    #askForCookiesBackground .cbc-banner-inner
    {
        flex-direction: column;
        align-items: stretch;
    }

    #askForCookiesBackground .cbc-actions
    {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    /* details under the two main buttons, full width */
    #askForCookiesBackground .cbc-actions .cbc-btn-ghost
    {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media (max-width: 560px)
{
    #askForCookiesBackground #askForCookies
    {
        bottom: 8px;
        width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
        border-radius: 12px;
    }

    #askForCookiesBackground .cbc-banner-inner
    {
        gap: 14px;
        padding: 16px 16px 16px;
    }

    #askForCookiesBackground .cbc-copy
    {
        font-size: 12px;
        line-height: 1.6;
    }

    #askForCookiesBackground .cbc-btn
    {
        padding: 10px 12px;
        white-space: normal;
    }

    #askForCookiesBackground #showDetailsCookies
    {
        padding: 8px;
    }

    #askForCookiesBackground .cbc-dialog
    {
        margin: 0 auto;
        border-radius: 12px;
    }

    #askForCookiesBackground .cbc-dialog-head,
    #askForCookiesBackground .cbc-dialog-body,
    #askForCookiesBackground .cbc-dialog-foot
    {
        padding-left: 16px;
        padding-right: 16px;
    }

    #askForCookiesBackground .cbc-dialog-foot
    {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce)
{
    #askForCookiesBackground #askForCookies,
    #askForCookiesBackground #showDetailsCookies,
    #askForCookiesBackground .cbc-dialog
    {
        animation: none;
    }

    #askForCookiesBackground *,
    #askForCookiesBackground *::before
    {
        transition: none !important;
    }
}

@media print
{
    #askForCookiesBackground
    {
        display: none !important;
    }
}
