/* ── Consent banner ──
 * .lp-cb-box  → corner positions (Complianz-style card)
 * .lp-cb-bar  → full-width top/bottom bar
 * Colors come from inline CSS vars set in Controllers\Front\CookieBar.
 */
#lp-cookie-bar {
    position: fixed;
    z-index: 999998;
    box-sizing: border-box;
    background: var(--lp-cb-bg, #1f2937);
    color: var(--lp-cb-color, #ffffff);
    font-size: 14px;
    line-height: 1.6;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
#lp-cookie-bar *,
#lp-cookie-bar *::before,
#lp-cookie-bar *::after {
    box-sizing: border-box;
}

/* Vertical position */
#lp-cookie-bar.lp-cb-bottom { bottom: 0; top: auto; }
#lp-cookie-bar.lp-cb-top    { top: 0; bottom: auto; }

/* ── Bar layout (full width) ── */
#lp-cookie-bar.lp-cb-bar {
    left: 0;
    right: 0;
    width: 100%;
    padding: 16px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "header  header"
        "body    buttons"
        "links   links";
    column-gap: 24px;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
}
#lp-cookie-bar.lp-cb-bar.lp-cb-top { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); }
#lp-cookie-bar.lp-cb-bar .lp-cb-header  { grid-area: header; }
#lp-cookie-bar.lp-cb-bar .lp-cb-body    { grid-area: body; }
#lp-cookie-bar.lp-cb-bar .lp-cb-buttons { grid-area: buttons; }
#lp-cookie-bar.lp-cb-bar .lp-cb-links   { grid-area: links; }
#lp-cookie-bar.lp-cb-bar.lp-cb-expanded {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "body" "buttons" "links";
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Box layout (corners) ── */
#lp-cookie-bar.lp-cb-box {
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 20px 22px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
#lp-cookie-bar.lp-cb-box.lp-cb-left   { left: 16px; right: auto; }
#lp-cookie-bar.lp-cb-box.lp-cb-right  { right: 16px; left: auto; }
#lp-cookie-bar.lp-cb-box.lp-cb-bottom { bottom: 16px; }
#lp-cookie-bar.lp-cb-box.lp-cb-top    { top: 16px; }

/* Hidden state */
#lp-cookie-bar.lp-cb-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}
#lp-cookie-bar.lp-cb-top.lp-cb-hidden {
    transform: translateY(-20px);
}

/* ── Header ── */
.lp-cb-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 24px;
    margin-bottom: 10px;
}
.lp-cb-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--lp-cb-color, #ffffff);
}
#lp-cookie-bar .lp-cb-close {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--lp-cb-color, #ffffff);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
#lp-cookie-bar .lp-cb-close:hover,
#lp-cookie-bar .lp-cb-close:focus-visible { opacity: 1; }
#lp-cookie-bar.lp-cb-bar .lp-cb-header { justify-content: flex-start; margin-bottom: 4px; }
#lp-cookie-bar.lp-cb-bar .lp-cb-close  { right: 0; }

/* ── Message ── */
.lp-cb-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--lp-cb-color, #ffffff);
}

/* ── Preferences panel ── */
.lp-cb-categories {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lp-cb-categories[hidden] { display: none; }
.lp-cb-category {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.14);
}
.lp-cb-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    cursor: pointer;
}
div.lp-cb-category-head { cursor: default; }
/* Themes style <label>/<p> colors; keep everything on the banner's own text color. */
#lp-cookie-bar label,
#lp-cookie-bar p,
#lp-cookie-bar .lp-cb-category-name {
    color: var(--lp-cb-color, #ffffff);
}
.lp-cb-category-name { font-weight: 600; }
.lp-cb-always {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.8;
}
.lp-cb-category-desc {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    opacity: 0.85;
}

/* Consent ID (consent log) */
.lp-cb-consent-id {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.85;
    overflow-wrap: anywhere;
}
.lp-cb-consent-id[hidden] { display: none; }
#lp-cookie-bar .lp-cb-consent-id code {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(127, 127, 127, 0.18);
    color: inherit;
    font-size: 12px;
    user-select: all;
}

/* Toggle switch */
.lp-cb-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 38px;
    height: 22px;
}
.lp-cb-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.lp-cb-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.45);
    transition: background 0.2s;
}
.lp-cb-slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s;
}
.lp-cb-switch input:checked + .lp-cb-slider { background: var(--lp-cb-btn-bg, #7c3aed); }
.lp-cb-switch input:checked + .lp-cb-slider::before { transform: translateX(16px); }
.lp-cb-switch input:focus-visible + .lp-cb-slider { outline: 2px solid var(--lp-cb-btn-bg, #7c3aed); outline-offset: 2px; }

/* ── Buttons ── */
.lp-cb-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.lp-cb-box .lp-cb-buttons > * { flex: 1 1 0; }
.lp-cb-bar .lp-cb-buttons { margin-top: 0; flex-shrink: 0; }
.lp-cb-bar.lp-cb-expanded .lp-cb-buttons { margin-top: 14px; justify-content: flex-end; }
.lp-cb-buttons [hidden] { display: none; }

#lp-cookie-bar .lp-cb-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
#lp-cookie-bar .lp-cb-btn:hover { opacity: 0.85; }
#lp-cookie-bar .lp-cb-btn:focus-visible { outline: 2px solid var(--lp-cb-color, #ffffff); outline-offset: 2px; }

/* Accept — filled with button color */
#lp-cookie-bar .lp-cb-btn-accept {
    background: var(--lp-cb-btn-bg, #7c3aed);
    color: var(--lp-cb-btn-color, #ffffff);
    border: 1px solid transparent;
}

/* Deny + preferences — outline using text color */
#lp-cookie-bar .lp-cb-btn-deny,
#lp-cookie-bar .lp-cb-btn-secondary {
    background: transparent;
    color: var(--lp-cb-color, #ffffff);
    border: 1px solid currentColor;
}

/* ── Links ── */
.lp-cb-links {
    margin-top: 10px;
    text-align: center;
}
.lp-cb-bar .lp-cb-links { text-align: left; margin-top: 6px; }
#lp-cookie-bar .lp-cb-learn-more {
    color: var(--lp-cb-color, #ffffff);
    text-decoration: underline;
    font-size: 13px;
}
#lp-cookie-bar .lp-cb-learn-more:hover { opacity: 0.8; }
/* Geo-targeting: several links, cookie-bar.js shows the ones the visitor's rule lists. */
.lp-cb-links [hidden] { display: none; }
#lp-cookie-bar .lp-cb-learn-more:not([hidden]) ~ .lp-cb-learn-more:not([hidden]) { margin-left: 14px; }

/* ── Manage consent (reopen) button ──
 * Like Complianz's default ("Hover on Desktop - Hide on Mobile"): tucked below
 * the screen edge with only a sliver showing, slides up on hover/focus, hidden
 * on touch screens. [legal_pages_manage_consent] on the cookie policy page is
 * the always-visible way to change consent. */
.lp-cb-manage {
    position: fixed;
    bottom: -28px;
    z-index: 999997;
    height: 40px;
    padding: 0 16px 6px;
    border: 0;
    border-radius: 8px 8px 0 0;
    background: var(--lp-cb-bg, #1f2937);
    color: var(--lp-cb-color, #ffffff);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
    transition: bottom 0.3s ease;
}
/* ID selector so theme `button:hover` styles (e.g. Astra's blue) don't win. */
#lp-cb-manage:hover,
#lp-cb-manage:focus-visible {
    bottom: 0;
    background: var(--lp-cb-bg, #1f2937);
    color: var(--lp-cb-color, #ffffff);
}
.lp-cb-manage[hidden] { display: none; }
.lp-cb-manage-left  { left: 40px; }
.lp-cb-manage-right { right: 40px; }

@media (hover: none), (max-width: 600px) {
    .lp-cb-manage { display: none; }
}

/* ── Blocked content (CookieBlocker) ── */
iframe.lp-blocked-iframe { display: none !important; }
.lp-blocked-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 200px;
    padding: 24px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    text-align: center;
    font-size: 14px;
}
.lp-blocked-placeholder p { margin: 0; }
.lp-blocked-accept {
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #1f2937;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ── [legal_pages_dnsmpi_form]: the theme styles the button (wp-element-button) ── */
.lp-dnsmpi { margin: 1em 0; }
.lp-dnsmpi [hidden] { display: none !important; }
.lp-dnsmpi-button { cursor: pointer; }
.lp-dnsmpi-consent-id code { user-select: all; }

/* ── Responsive ── */
@media (max-width: 600px) {
    #lp-cookie-bar.lp-cb-box {
        left: 8px;
        right: 8px;
        bottom: 8px;
        top: auto;
        width: auto;
        max-width: none;
    }
    #lp-cookie-bar.lp-cb-bar {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "body" "buttons" "links";
    }
    #lp-cookie-bar.lp-cb-bar .lp-cb-buttons { margin-top: 12px; }
    .lp-cb-buttons { flex-wrap: wrap; }
    .lp-cb-buttons > * { flex: 1 1 auto; }
}
