/* =============================================================================
   Bangmod PDPA Cookie Consent — Frontend Banner CSS
   Version: 1.0.5
   ============================================================================= */

/* ─── CSS Variables ──────────────────────────────────────────────────────── */
:root {
    --bm-primary:        #0066CC;
    --bm-primary-dark:   #0052a3;
    --bm-primary-light:  #e6f0ff;
    --bm-accent:         #00c48c;
    --bm-danger:         #e74c3c;
    --bm-text:           #1a202c;
    --bm-text-muted:     #718096;
    --bm-bg:             #ffffff;
    --bm-bg-overlay:     rgba(0, 0, 0, 0.55);
    --bm-border:         #e2e8f0;
    --bm-shadow:         0 4px 24px rgba(0, 0, 0, 0.12);
    --bm-shadow-lg:      0 8px 40px rgba(0, 0, 0, 0.18);
    --bm-radius:         14px;
    --bm-radius-sm:      8px;
    --bm-font:           inherit;
    --bm-z-float:        99990;
    --bm-z-overlay:      99991;
    --bm-z-banner:       99993;
    --bm-z-modal:        99995;
    --bm-transition:     0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
:where(#bangmod-pdpa-banner, #bangmod-pdpa-modal, .bangmod-pdpa-floating-btn) *,
:where(#bangmod-pdpa-banner, #bangmod-pdpa-modal, .bangmod-pdpa-floating-btn) {
    box-sizing: border-box;
    font-family: var(--bm-font);
    -webkit-font-smoothing: antialiased;
}

:where(#bangmod-pdpa-banner, #bangmod-pdpa-modal, .bangmod-pdpa-floating-btn) :where(h1, h2, h3, h4, h5, h6, p, ul, ol, li, button, input, select, textarea) {
    margin: 0;
    padding: 0;
}

/* Keep WordPress themes from repainting plugin controls. */
#bangmod-pdpa-banner button,
#bangmod-pdpa-modal button,
button.bangmod-pdpa-floating-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    min-height: 0 !important;
}

/* ─── Overlay ────────────────────────────────────────────────────────────── */
#bangmod-pdpa-overlay {
    position: fixed;
    inset: 0;
    background: var(--bm-bg-overlay);
    z-index: var(--bm-z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--bm-transition), visibility var(--bm-transition);
    backdrop-filter: blur(2px);
}
#bangmod-pdpa-overlay.bm-visible {
    opacity: 1;
    visibility: visible;
}

/* ─── Banner Base ────────────────────────────────────────────────────────── */
#bangmod-pdpa-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: var(--bm-z-banner);
    padding: 18px 24px;
    background: #fff;
    border-top: 3px solid var(--bm-primary);
    box-shadow: var(--bm-shadow);
    transform: translateY(100%);
    transition: transform var(--bm-transition), opacity var(--bm-transition);
    opacity: 0;
}
#bangmod-pdpa-banner.bm-visible {
    transform: translateY(0);
    opacity: 1;
}

/* Position variants */
#bangmod-pdpa-banner.bm-pos-bottom {
    bottom: 0;
    border-top: 3px solid var(--bm-primary);
    border-bottom: none;
}
#bangmod-pdpa-banner.bm-pos-top {
    top: 0;
    border-top: none;
    border-bottom: 3px solid var(--bm-primary);
    transform: translateY(-100%);
}
#bangmod-pdpa-banner.bm-pos-top.bm-visible {
    transform: translateY(0);
}
#bangmod-pdpa-banner.bm-pos-center {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    transform: none;
    opacity: 0;
}
#bangmod-pdpa-banner.bm-pos-center.bm-visible {
    opacity: 1;
}
#bangmod-pdpa-banner.bm-pos-center .bm-banner-inner {
    background: #fff;
    border-radius: var(--bm-radius);
    padding: 32px 36px;
    max-width: 540px;
    width: calc(100% - 40px);
    box-shadow: var(--bm-shadow-lg);
    border-top: 4px solid var(--bm-primary);
    animation: bmScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
#bangmod-pdpa-banner.bm-pos-bottom-left {
    bottom: 24px;
    left: 24px;
    right: auto;
    max-width: 380px;
    border-radius: var(--bm-radius);
    border-top: 3px solid var(--bm-primary);
    transform: translateY(20px) scale(0.95);
}
#bangmod-pdpa-banner.bm-pos-bottom-left.bm-visible {
    transform: translateY(0) scale(1);
}
#bangmod-pdpa-banner.bm-pos-bottom-right {
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 380px;
    border-radius: var(--bm-radius);
    border-top: 3px solid var(--bm-primary);
    transform: translateY(20px) scale(0.95);
}
#bangmod-pdpa-banner.bm-pos-bottom-right.bm-visible {
    transform: translateY(0) scale(1);
}

/* Style: box */
#bangmod-pdpa-banner.bm-style-box:not(.bm-pos-center) {
    left: 24px;
    right: 24px;
    bottom: 24px;
    border-radius: var(--bm-radius);
    max-width: 960px;
    margin: 0 auto;
}

/* ─── Banner Inner Layout ─────────────────────────────────────────────────── */
.bm-banner-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}
.bm-banner-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--bm-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bm-primary);
    font-size: 22px;
}
.bm-banner-text {
    flex: 1;
    min-width: 200px;
}
.bm-banner-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--bm-text);
    margin-bottom: 4px;
    line-height: 1.3;
}
.bm-banner-desc {
    font-size: 21px;
    color: var(--bm-text-muted);
    line-height: 1.6;
}
.bm-banner-desc a {
    color: var(--bm-primary);
    text-decoration: underline;
}
.bm-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.bm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: 2px solid transparent;
    border-radius: var(--bm-radius-sm);
    font-size: 21px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--bm-transition);
    white-space: nowrap;
    text-decoration: none;
    outline: none;
    font-family: var(--bm-font);
    line-height: 1.5;
}
.bm-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.35);
}
.bm-btn-primary {
    background: var(--bm-primary) !important;
    color: #fff !important;
    border-color: var(--bm-primary) !important;
}
.bm-btn-primary:hover {
    background: var(--bm-primary-dark) !important;
    color: #fff !important;
    border-color: var(--bm-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.35);
}
.bm-btn-primary:active {
    transform: translateY(0);
}
.bm-btn-outline {
    background: #fff !important;
    color: var(--bm-primary) !important;
    border-color: var(--bm-primary) !important;
}
.bm-btn-outline:hover {
    background: var(--bm-primary-light) !important;
    color: var(--bm-primary-dark) !important;
}
.bm-btn-ghost {
    background: #fff !important;
    color: var(--bm-text-muted) !important;
    border-color: var(--bm-border) !important;
}
.bm-btn-ghost:hover {
    background: #f7fafc !important;
    color: var(--bm-text) !important;
    border-color: #cbd5e0 !important;
}

/* ─── Settings Link in Banner ─────────────────────────────────────────────── */
.bm-settings-link {
    font-size: 21px;
    color: var(--bm-text-muted);
    text-decoration: underline;
    cursor: pointer;
    background: transparent !important;
    border: 0 !important;
    padding: 0;
    margin: 0;
    font-family: var(--bm-font);
    transition: color var(--bm-transition);
}
.bm-settings-link:hover {
    color: var(--bm-primary) !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

/* ─── Left off-canvas privacy panel ───────────────────────────────────────── */
#bangmod-pdpa-modal {
    position: fixed;
    inset: 0;
    z-index: var(--bm-z-modal);
    pointer-events: none;
    visibility: hidden;
    transition: visibility var(--bm-transition);
}
body.admin-bar #bangmod-pdpa-modal {
    top: 32px;
}
#bangmod-pdpa-modal.bm-visible {
    visibility: visible;
    pointer-events: auto;
}
.bm-modal-box {
    background: #fff;
    border-radius: 0;
    width: min(520px, calc(100vw - 24px));
    max-width: 100%;
    height: 100%;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--bm-shadow-lg);
    border-left: none;
    transform: translateX(-105%);
    transition: transform var(--bm-transition);
    scrollbar-width: thin;
    scrollbar-color: var(--bm-border) transparent;
}
#bangmod-pdpa-modal.bm-visible .bm-modal-box {
    transform: translateX(0);
}
.bm-modal-box::-webkit-scrollbar {
    width: 5px;
}
.bm-modal-box::-webkit-scrollbar-thumb {
    background: var(--bm-border);
    border-radius: 99px;
}

.bm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    flex: 0 0 auto;
    background: #fff;
    z-index: 1;
    border-bottom: 1px solid var(--bm-border);
}
.bm-modal-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--bm-text);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}
.bm-modal-close {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border: 0 !important;
    background: #f7fafc !important;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--bm-text-muted);
    transition: all var(--bm-transition);
    flex-shrink: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    line-height: 1 !important;
    font-size: 0 !important;  /* hide any residual text/icon from theme */
}
.bm-modal-close svg {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    fill: var(--bm-text-muted) !important;
    color: var(--bm-text-muted) !important;
    flex-shrink: 0 !important;
    pointer-events: none;
}
.bm-modal-close:hover {
    background: #e2e8f0 !important;
    color: var(--bm-text) !important;
    transform: rotate(90deg);
}
.bm-modal-close:hover svg {
    fill: var(--bm-text) !important;
    color: var(--bm-text) !important;
}

.bm-modal-body {
    padding: 22px 24px 28px;
    overflow-y: auto;
    flex: 1 1 auto;
    overscroll-behavior: contain;
}

.bm-privacy-summary {
    padding: 16px;
    margin-bottom: 22px;
    border-radius: var(--bm-radius-sm);
    background: var(--bm-primary-light);
    color: var(--bm-text);
    font-size: 21px !important;
    line-height: 1.7;
}
.bm-privacy-summary p {
    color: inherit;
    font-size: 21px !important;
}
.bm-privacy-summary .bm-privacy-notice {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 102, 204, 0.16);
    color: var(--bm-text-muted);
    font-size: 21px !important;
}
.bm-category-heading {
    margin: 0 0 12px !important;
    color: var(--bm-text);
    font-size: 21px !important;
    font-weight: 700;
    line-height: 1.5;
}

/* ─── Category Accordion ──────────────────────────────────────────────────── */
.bm-category {
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color var(--bm-transition), box-shadow var(--bm-transition);
}
.bm-category:hover {
    border-color: var(--bm-primary);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.08);
}
.bm-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    gap: 12px;
    background: #fafbfc;
    transition: background var(--bm-transition);
}
.bm-category-header:hover {
    background: var(--bm-primary-light);
}
.bm-category-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.bm-category-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.bm-category-name {
    font-size: 21px !important;
    font-weight: 700;
    color: var(--bm-text);
    line-height: 1.4;
}
.bm-category-body {
    padding: 0 18px;
    font-size: 21px !important;
    color: var(--bm-text-muted);
    line-height: 1.65;
    max-height: 0;
    overflow: hidden;
    border-top: 0 solid var(--bm-border);
    background: #fff;
    transition:
        max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        padding    0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity    0.25s ease,
        border-top-width 0.35s;
    opacity: 0;
}
.bm-category.bm-open .bm-category-body {
    max-height: 600px;
    padding: 12px 18px 14px;
    border-top-width: 1px;
    opacity: 1;
}
.bm-category-chevron {
    font-size: 18px;
    color: var(--bm-text-muted);
    transition: transform var(--bm-transition);
    flex-shrink: 0;
}
.bm-category.bm-open .bm-category-chevron {
    transform: rotate(180deg);
}

/* ─── Toggle Switch ───────────────────────────────────────────────────────── */
.bm-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.bm-toggle-label-text {
    font-size: 21px;
    color: var(--bm-text-muted);
    font-weight: 600;
    white-space: nowrap;
}
.bm-always-on-label {
    font-size: 14px;
    color: var(--bm-accent);
    font-weight: 600;
    background: rgba(0, 196, 140, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.4;
}
.bm-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.bm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.bm-switch-slider {
    position: absolute;
    inset: 0;
    background: #e2e8f0;
    border-radius: 24px;
    transition: background var(--bm-transition);
    cursor: pointer;
}
.bm-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform var(--bm-transition);
}
.bm-switch input:checked + .bm-switch-slider {
    background: var(--bm-primary);
}
.bm-switch input:checked + .bm-switch-slider::before {
    transform: translateX(20px);
}
.bm-switch input:focus-visible + .bm-switch-slider {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.35);
}

/* ─── Modal Footer ────────────────────────────────────────────────────────── */
.bm-modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--bm-border);
    flex: 0 0 auto;
    background: #fff;
    z-index: 1;
}
.bm-modal-footer .bm-btn {
    flex: 1;
    min-width: 120px;
}
.bm-modal-links {
    width: 100%;
    display: flex;
    gap: 16px;
    justify-content: center;
    padding-top: 4px;
}
.bm-modal-links a {
    font-size: 20px;
    color: var(--bm-text-muted);
    text-decoration: underline;
}
.bm-modal-links a:hover {
    color: var(--bm-primary) !important;
    background: transparent !important;
}

/* ─── Floating Button (Pill Style) ───────────────────────────────────────── */
.bangmod-pdpa-floating-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: var(--bm-z-float);
    height: 44px;
    padding: 0 20px;
    border-radius: 100px;
    background: var(--bm-primary) !important;
    color: #fff !important;
    border: 0 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(0, 102, 204, 0.38);
    transition: all var(--bm-transition);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.92);
    white-space: nowrap;
    font-size: 16px !important;
    font-weight: 600 !important;
    font-family: var(--bm-font);
    line-height: 1 !important;
    letter-spacing: 0 !important;
}
.bangmod-pdpa-floating-btn svg { display: none !important; } /* hide JS-injected cookie svg */
.bangmod-pdpa-floating-btn.bm-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.bangmod-pdpa-floating-btn:hover {
    background: var(--bm-primary-dark) !important;
    color: #fff !important;
    transform: translateY(-2px) scale(1);
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.45);
}
.bangmod-pdpa-floating-btn:active {
    transform: translateY(0) scale(0.97);
}
@keyframes bmFloatPulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(0, 102, 204, 0.38); }
    50%       { box-shadow: 0 4px 24px rgba(0, 102, 204, 0.6); }
}
.bangmod-pdpa-floating-btn.bm-visible {
    animation: bmFloatPulse 3s ease-in-out 1.5s 3;
}

.bangmod-pdpa-floating-btn span {
    display: block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile: keep pill but scale slightly smaller */
@media (max-width: 560px) {
    .bangmod-pdpa-floating-btn {
        bottom: 16px;
        left: 16px;
        height: 40px;
        padding: 0 16px;
        font-size: 13.5px !important;
    }
    .bangmod-pdpa-floating-btn span {
        max-width: 110px;
    }
}

/* ─── Consent Settings Link ───────────────────────────────────────────── */
.bangmod-pdpa-open-settings {
    cursor: pointer;
    color: inherit;
    text-decoration: underline;
    background: none;
    border: none;
    font: inherit;
    padding: 0;
}
.bangmod-pdpa-open-settings:hover {
    color: var(--bm-primary);
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes bmSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bmScaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes bmFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #bangmod-pdpa-banner {
        padding: 16px 16px;
    }
    .bm-banner-inner {
        gap: 14px;
    }
    .bm-banner-icon {
        display: none;
    }
    .bm-banner-actions {
        width: 100%;
        justify-content: stretch;
    }
    .bm-banner-actions .bm-btn {
        flex: 1;
    }
    .bm-banner-actions .bm-settings-link {
        width: 100%;
        text-align: center;
        padding: 4px 0;
    }
    .bm-modal-header,
    .bm-modal-body,
    .bm-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    #bangmod-pdpa-banner.bm-pos-bottom-left,
    #bangmod-pdpa-banner.bm-pos-bottom-right {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
    .bm-modal-footer .bm-btn {
        min-width: 80px;
    }
}
@media (max-width: 782px) {
    body.admin-bar #bangmod-pdpa-modal {
        top: 46px;
    }
}
@media (max-width: 480px) {
    .bm-banner-title { font-size: 22px; }
    .bm-banner-desc  { font-size: 21px; }
    .bm-modal-header h2 { font-size: 24px; }
    .bm-modal-footer { flex-direction: column; }
    .bm-modal-footer .bm-btn { width: 100%; }
    .bm-modal-box {
        width: 100vw;
    }
}

/* ─── High Contrast Mode ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #bangmod-pdpa-banner,
    #bangmod-pdpa-modal,
    .bangmod-pdpa-floating-btn,
    .bm-btn,
    .bm-switch-slider,
    .bm-category-chevron {
        transition: none !important;
        animation: none !important;
    }
}
