/* ============================================================
   X-GORB Search — cookie consent
   Bottom-left card on desktop, bottom sheet on mobile.
   Uses the shared neu.css tokens when available.
   ============================================================ */

.xgc-consent {
    position: fixed;
    left: 24px;
    bottom: 24px;
    width: min(560px, calc(100% - 48px));
    z-index: 9998;
    background: var(--neu-surface, #fff);
    color: var(--neu-text, #1d1d1f);
    border: 1px solid var(--neu-line, #e3e4e9);
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(17, 18, 22, 0.18);
    padding: 22px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial,
        "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.2, 0, 0.2, 1),
                transform 220ms cubic-bezier(0.2, 0, 0.2, 1);
}

.xgc-consent.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.xgc-consent__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.xgc-consent__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.1px;
    margin: 0;
    color: var(--neu-text, #1d1d1f);
}

.xgc-consent__close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--neu-text-3, #878a93);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 160ms ease, color 160ms ease;
}

.xgc-consent__close:hover {
    background: var(--neu-surface-2, #f3f3f6);
    color: var(--neu-text, #1d1d1f);
}

.xgc-consent__body {
    color: var(--neu-text-2, #5f616b);
    font-size: 0.86rem;
    margin: 0 0 16px;
}

.xgc-consent__body a {
    color: var(--neu-brand, #6001d2);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.xgc-consent__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.xgc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border-radius: 100px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
    white-space: nowrap;
}

.xgc-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 1, 210, 0.18);
}

.xgc-btn--primary {
    background: var(--neu-brand, #6001d2);
    color: var(--neu-on-brand, #fff);
    border-color: var(--neu-brand, #6001d2);
}
.xgc-btn--primary:hover { background: var(--neu-brand-hover, #5000b3); }

.xgc-btn--ghost {
    background: transparent;
    color: var(--neu-brand, #6001d2);
    border-color: var(--neu-line, #e3e4e9);
}
.xgc-btn--ghost:hover { background: var(--neu-brand-tint, #f3edff); border-color: var(--neu-brand, #6001d2); }

.xgc-btn--text {
    background: transparent;
    color: var(--neu-text-2, #5f616b);
    padding: 0 10px;
}
.xgc-btn--text:hover { color: var(--neu-brand, #6001d2); }

.xgc-consent__meta {
    margin: 12px 0 0;
    font-size: 0.74rem;
    color: var(--neu-text-3, #878a93);
}

/* Settings view */
.xgc-consent__settings { display: none; }
.xgc-consent.is-settings .xgc-consent__summary { display: none; }
.xgc-consent.is-settings .xgc-consent__settings { display: block; }

.xgc-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--neu-line, #e3e4e9);
}

.xgc-row__copy { min-width: 0; }
.xgc-row__name { font-size: 0.86rem; font-weight: 600; color: var(--neu-text, #1d1d1f); }
.xgc-row__desc { font-size: 0.76rem; color: var(--neu-text-2, #5f616b); margin-top: 2px; }

.xgc-switch {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    border-radius: 24px;
    border: 1px solid var(--neu-line, #e3e4e9);
    background: var(--neu-surface-2, #f3f3f6);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
    margin-top: 2px;
}

.xgc-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: transform 160ms ease;
}

.xgc-switch[aria-checked="true"] {
    background: var(--neu-brand, #6001d2);
    border-color: var(--neu-brand, #6001d2);
}
.xgc-switch[aria-checked="true"]::after { transform: translateX(20px); }

.xgc-switch[aria-disabled="true"] {
    opacity: 0.75;
    cursor: default;
}

.xgc-consent__settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--neu-line, #e3e4e9);
    margin-top: 4px;
}

/* Footer trigger */
.cookie-settings-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.cookie-settings-link:hover { color: var(--neu-brand, #6001d2); }

@media (max-width: 640px) {
    .xgc-consent {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 18px 18px 0 0;
        border-bottom: 0;
        padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
        max-height: 86vh;
        overflow-y: auto;
    }

    .xgc-consent__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .xgc-consent__actions .xgc-btn--text {
        grid-column: 1 / -1;
        order: 3;
        justify-content: center;
    }

    .xgc-consent__actions .xgc-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .xgc-consent, .xgc-switch, .xgc-switch::after, .xgc-btn { transition: none !important; }
}
