/**
 * Cookie consent — *.hsb.xcdr.org variant
 *
 * Matches the dark futuristic palette used by pytaj.hsb.xcdr.org and
 * preloz.hsb.xcdr.org. Deep navy panel, cyan accents, subtle glow.
 * Reads cleanly as an overlay on both the dark search/translator UIs
 * and the lighter Workbench portal — the banner is its own
 * self-contained dark surface either way.
 */

:root {
    /* Local copies of the *.hsb.xcdr.org tokens so the banner works
       even on the Workbench portal whose palette doesn't define these. */
    --cc-bg:          #0a1020;
    --cc-bg-elev:     #131a2e;
    --cc-border:      rgba(100, 200, 240, 0.35);
    --cc-border-soft: rgba(80, 160, 220, 0.18);
    --cc-text:        #c7d4e5;
    --cc-text-dim:    #7a8aa3;
    --cc-accent:      #00d9ff;
    --cc-accent-2:    #5aa3ff;
    --cc-accent-glow: rgba(0, 217, 255, 0.45);
    --cc-font-stack: 'Helvetica Neue', 'Inter', system-ui, -apple-system,
                     'Segoe UI', Roboto, sans-serif;
}

/* ────────────────────────────────────────────────────────────────────
   Consent banner
   ──────────────────────────────────────────────────────────────────── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 99999;
    background:
        linear-gradient(180deg, rgba(20, 30, 50, 0.4) 0%,
                                 transparent 100%),
        var(--cc-bg);
    border-top: 1px solid var(--cc-border);
    box-shadow:
        0 -4px 32px rgba(0, 0, 0, 0.6),
        0 -1px 0 var(--cc-accent-glow);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    font-family: var(--cc-font-stack);
    color: var(--cc-text);
}

.cookie-consent-banner.cookie-consent-visible {
    transform: translateY(0);
}

.cookie-consent-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 30px;
}

.cookie-consent-header h3 {
    font-family: var(--cc-font-stack);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--cc-text);
    margin: 0 0 12px 0;
    background: linear-gradient(90deg, #ffffff, var(--cc-accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.cookie-consent-body p {
    font-size: 0.95rem;
    color: var(--cc-text);
    margin: 0 0 18px 0;
    line-height: 1.6;
    opacity: 0.9;
}

/* Option checkboxes ─────────────────────────────────────────────── */
.cookie-consent-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.cookie-option {
    display: flex;
    flex-direction: column;
    background: var(--cc-bg-elev);
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    min-width: 200px;
    border: 1px solid var(--cc-border-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cookie-option:hover {
    border-color: var(--cc-border);
    box-shadow: 0 0 12px var(--cc-accent-glow);
}

.cookie-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.cookie-option input[type="checkbox"]:checked + .cookie-option-title::before {
    background: var(--cc-accent);
    border-color: var(--cc-accent);
    box-shadow: 0 0 8px var(--cc-accent-glow);
}

.cookie-option input[type="checkbox"]:checked + .cookie-option-title::after {
    content: '✓';
    position: absolute;
    left: 4px;
    top: 1px;
    color: #0a1020;
    font-size: 12px;
    font-weight: 700;
}

.cookie-option-title {
    position: relative;
    font-weight: 600;
    color: var(--cc-text);
    padding-left: 28px;
    margin-bottom: 4px;
}

.cookie-option-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--cc-border);
    border-radius: 4px;
    background: var(--cc-bg);
    transition: all 0.2s ease;
}

.cookie-option input[type="checkbox"]:disabled + .cookie-option-title::before {
    background: var(--cc-accent);
    border-color: var(--cc-accent);
    opacity: 0.7;
}

.cookie-option input[type="checkbox"]:disabled + .cookie-option-title::after {
    content: '✓';
    position: absolute;
    left: 4px;
    top: 3px;
    color: #0a1020;
    font-size: 12px;
    font-weight: 700;
}

.cookie-option-desc {
    font-size: 0.85rem;
    color: var(--cc-text-dim);
    padding-left: 28px;
}

/* Footer + links ────────────────────────────────────────────────── */
.cookie-consent-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.cookie-consent-link {
    color: var(--cc-accent);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.cookie-consent-link:hover {
    color: var(--cc-accent-2);
    border-bottom-color: var(--cc-accent-2);
}

.cookie-consent-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons ───────────────────────────────────────────────────────── */
.cookie-btn {
    font-family: var(--cc-font-stack);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-btn-primary {
    background: linear-gradient(135deg, var(--cc-accent) 0%, var(--cc-accent-2) 100%);
    color: #050810;
    border-color: var(--cc-accent);
}

.cookie-btn-primary:hover {
    box-shadow: 0 0 16px var(--cc-accent-glow);
    transform: translateY(-1px);
}

.cookie-btn-secondary {
    background: var(--cc-bg-elev);
    color: var(--cc-text);
    border-color: var(--cc-border-soft);
}

.cookie-btn-secondary:hover {
    background: var(--cc-bg);
    border-color: var(--cc-border);
    color: var(--cc-accent);
}

/* Settings button (post-consent, fixed bottom-left) ─────────────── */
.cookie-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99998;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cc-bg);
    color: var(--cc-accent);
    border: 1px solid var(--cc-border);
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.cookie-settings-btn:hover {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5),
                0 0 14px var(--cc-accent-glow);
    transform: scale(1.08);
}

/* Embed placeholders for blocked iframes ────────────────────────── */
.embed-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cc-bg-elev);
    border: 1px dashed var(--cc-border);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    font-family: var(--cc-font-stack);
}

.embed-placeholder.embed-loaded {
    border: none;
    background: transparent;
}

.embed-placeholder.embed-loaded .embed-placeholder-inner > *:not(iframe) {
    display: none;
}

.embed-placeholder.embed-loaded iframe {
    display: block !important;
}

.embed-placeholder-inner {
    text-align: center;
    padding: 30px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.embed-placeholder-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.embed-placeholder-text {
    font-size: 0.95rem;
    color: var(--cc-text);
    max-width: 420px;
    margin: 0 0 18px 0;
    line-height: 1.5;
}

.embed-placeholder-btn {
    font-family: var(--cc-font-stack);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 11px 28px;
    background: linear-gradient(135deg, var(--cc-accent) 0%, var(--cc-accent-2) 100%);
    color: #050810;
    border: 1px solid var(--cc-accent);
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.embed-placeholder-btn:hover {
    box-shadow: 0 0 16px var(--cc-accent-glow);
}

.embed-placeholder-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--cc-text-dim);
    cursor: pointer;
}

.embed-placeholder-remember input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--cc-accent);
}

/* YouTube branding — keep red because users recognise it */
.embed-youtube .embed-placeholder-inner {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.15) 0%,
                                          rgba(10, 16, 32, 0.6) 100%);
}

/* Google Maps branding — same idea with Google blue */
.embed-maps .embed-placeholder-inner {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.18) 0%,
                                          rgba(10, 16, 32, 0.6) 100%);
}

/* Responsive ────────────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
    .cookie-consent-inner {
        padding: 20px;
    }
    .cookie-consent-options {
        flex-direction: column;
    }
    .cookie-option {
        min-width: 100%;
    }
    .cookie-consent-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .cookie-consent-buttons {
        flex-direction: column;
    }
    .cookie-btn {
        width: 100%;
        text-align: center;
    }
    .cookie-consent-link {
        text-align: center;
    }
}

/* Print — hide all chrome */
@media print {
    .cookie-consent-banner,
    .cookie-settings-btn,
    .embed-placeholder {
        display: none !important;
    }
}

/* ===================================================================
 * Consent-gated app surfaces
 *
 * Elements marked with `data-consent-required` get the .consent-blocked
 * class until the user accepts analytics consent (level ≥ 20).
 *
 * Effect: clicks, text selection, drag-and-drop — all input events
 * suppressed. Visual: 50% opacity + slight desaturation so users see
 * the gated state without losing readability of the underlying UI.
 *
 * The cookie-consent banner itself is OUTSIDE any data-consent-required
 * surface, so it stays fully interactive.
 * =================================================================== */
[data-consent-required].consent-blocked {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0.55;
    filter: grayscale(0.35);
    /* Smooth the transition when the user accepts and the block lifts. */
    transition: opacity 0.25s ease-out, filter 0.25s ease-out;
}
/* Children must also disable pointer events; pointer-events: none on a
 * parent normally suffices, but iframes are a special case — some
 * browsers ignore the parent rule. Belt-and-braces. */
[data-consent-required].consent-blocked iframe,
[data-consent-required].consent-blocked input,
[data-consent-required].consent-blocked textarea,
[data-consent-required].consent-blocked button,
[data-consent-required].consent-blocked select,
[data-consent-required].consent-blocked a {
    pointer-events: none !important;
}
