/* Campaign TH Cookie Consent — public styles */
:root {
    --ctcc-primary: #0a3d62;
    --ctcc-secondary: #3c6382;
    --ctcc-text: #1e272e;
    --ctcc-bg: #ffffff;
    --ctcc-btn-text: #ffffff;
    --ctcc-radius: 8px;
}

#ctcc-root[hidden] { display: none; }
#ctcc-root *, #ctcc-root *::before, #ctcc-root *::after { box-sizing: border-box; }

/* Banner --------------------------------------------------------------- */
.ctcc-banner {
    position: fixed;
    z-index: 999999;
    background: var(--ctcc-bg);
    color: var(--ctcc-text);
    border-radius: var(--ctcc-radius);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
    padding: 22px 24px;
    max-width: 460px;
    width: calc(100% - 32px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "IBM Plex Sans Thai", "Sarabun", system-ui, sans-serif;
    line-height: 1.55;
    font-size: 14px;
    animation: ctcc-pop .35s ease;
}

@keyframes ctcc-pop {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

#ctcc-root[data-position="bottom-left"] .ctcc-banner { bottom: 16px; left: 16px; }
#ctcc-root[data-position="bottom-right"] .ctcc-banner { bottom: 16px; right: 16px; }
#ctcc-root[data-position="bottom-center"] .ctcc-banner { bottom: 16px; left: 50%; transform: translateX(-50%); }
#ctcc-root[data-position="top"] .ctcc-banner { top: 16px; left: 50%; transform: translateX(-50%); }
#ctcc-root[data-position="center"] .ctcc-banner { top: 50%; left: 50%; transform: translate(-50%, -50%); }

#ctcc-root[data-layout="bar"] .ctcc-banner {
    max-width: none;
    width: 100%;
    left: 0;
    right: 0;
    border-radius: 0;
    bottom: 0;
    transform: none;
}
#ctcc-root[data-layout="bar"][data-position="top"] .ctcc-banner { top: 0; bottom: auto; }

.ctcc-banner__title { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--ctcc-primary); }
.ctcc-banner__desc { margin: 0 0 14px; color: var(--ctcc-text); font-size: 12px; line-height: 1.6; }
.ctcc-banner__desc a { color: var(--ctcc-primary); text-decoration: underline; }
.ctcc-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ctcc-banner__powered { margin: 12px 0 0; font-size: 11px; color: #94a3b8; text-align: right; }

/* Buttons ------------------------------------------------------------- */
.ctcc-btn {
    appearance: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: calc(var(--ctcc-radius) - 2px);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    transition: filter .15s ease, transform .15s ease;
}
.ctcc-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.ctcc-btn--primary { background: var(--ctcc-primary); color: var(--ctcc-btn-text); }
.ctcc-btn--secondary { background: var(--ctcc-secondary); color: var(--ctcc-btn-text); }
.ctcc-btn--ghost { background: transparent; color: var(--ctcc-primary); border-color: var(--ctcc-primary); }

/* Modal --------------------------------------------------------------- */
.ctcc-modal { position: fixed; inset: 0; z-index: 1000000; }
.ctcc-modal[hidden] { display: none; }
.ctcc-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.ctcc-modal__panel {
    position: relative;
    background: var(--ctcc-bg);
    color: var(--ctcc-text);
    width: min(560px, calc(100% - 24px));
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    margin: 30px auto;
    padding: 28px 28px 24px;
    border-radius: var(--ctcc-radius);
    box-shadow: 0 25px 60px rgba(15, 23, 42, .35);
    animation: ctcc-pop .3s ease;
}
.ctcc-modal__close { position: absolute; top: 10px; right: 12px; background: transparent; border: 0; font-size: 26px; cursor: pointer; color: #94a3b8; }
.ctcc-modal__title { margin: 0 0 6px; color: var(--ctcc-primary); font-size: 20px; }
.ctcc-modal__desc { margin: 0 0 16px; }

.ctcc-cats { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 24px; }
.ctcc-cat { background: #f6f8fb; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 14px; }
.ctcc-cat__head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-weight: 600; }
.ctcc-cat__head::-webkit-details-marker { display: none; }
.ctcc-cat__name { color: var(--ctcc-text); }
.ctcc-cat__toggle em { font-style: normal; color: var(--ctcc-secondary); font-size: 12px; font-weight: 600; }
.ctcc-cat__desc { margin: 8px 0 0; font-size: 13px; color: #475569; }

.ctcc-modal__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Toggle switch ------------------------------------------------------- */
.ctcc-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.ctcc-switch input { opacity: 0; width: 0; height: 0; }
.ctcc-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 22px; transition: background .2s ease; }
.ctcc-slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ctcc-switch input:checked + .ctcc-slider { background: var(--ctcc-primary); }
.ctcc-switch input:checked + .ctcc-slider::before { transform: translateX(18px); }

/* Floating revoke ----------------------------------------------------- */
.ctcc-revoke {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 999998;
    background: var(--ctcc-primary);
    color: var(--ctcc-btn-text);
    border: 0;
    border-radius: 999px;
    padding: 10px 16px 10px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .25);
}
.ctcc-revoke__icon { font-size: 18px; }
.ctcc-revoke[hidden] { display: none; }

@media (max-width: 480px) {
    .ctcc-banner { padding: 18px; }
    .ctcc-banner__actions .ctcc-btn { flex: 1; }
    .ctcc-revoke__label { display: none; }
}
