/* ============================================================================
   Insaite Consent — CSS escopado com prefixo .ic-* para evitar colisão
   com Bootstrap/temas do site. Vanilla CSS, ~3KB minificado.
   ============================================================================ */

.ic-root {
    /* --ic-primary é setado inline via PHP a partir de INS_CONSENT_PRIMARY_COLOR */
    --ic-primary: #dd9947;
    --ic-primary-dark: #b87a36;
    --ic-bg: #ffffff;
    --ic-text: #222222;
    --ic-text-muted: #555555;
    --ic-border: #e6e6e6;
    --ic-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    position: fixed;
    z-index: 999999; /* acima do whatsapp-float (~999) e qualquer overlay do tema */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ic-text);
    font-size: 14px;
    line-height: 1.5;
}
.ic-root[hidden] { display: none !important; }

/* ─── Posicionamento do banner inicial ─────────────────────────────────── */
.ic-pos-bottom-left   { left: 16px;  right: auto;  bottom: 16px; }
.ic-pos-bottom-right  { left: auto;  right: 16px;  bottom: 16px; }
.ic-pos-bottom-center { left: 50%; transform: translateX(-50%); bottom: 16px; right: auto; }

/* ─── Banner inicial ────────────────────────────────────────────────────── */
.ic-banner {
    background: var(--ic-bg);
    border: 1px solid var(--ic-border);
    border-radius: 12px;
    box-shadow: var(--ic-shadow);
    padding: 20px 22px;
    max-width: 460px;
    width: calc(100vw - 32px);
    box-sizing: border-box;
}
.ic-banner[hidden] { display: none; }
.ic-banner__title {
    font-size: 16px;
    margin: 0 0 8px;
    font-weight: 600;
    color: var(--ic-text);
}
.ic-banner__text {
    margin: 0 0 14px;
    color: var(--ic-text-muted);
    font-size: 13.5px;
}
.ic-banner__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ─── Modal de personalização ──────────────────────────────────────────── */
.ic-modal {
    position: fixed;
    inset: 0;
    z-index: 1; /* dentro do .ic-root, que já tem z-index alto */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.ic-modal[hidden] { display: none; }
.ic-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.ic-modal__dialog {
    position: relative;
    background: var(--ic-bg);
    border-radius: 12px;
    box-shadow: var(--ic-shadow);
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ic-modal__header,
.ic-modal__footer {
    padding: 18px 22px;
    border-bottom: 1px solid var(--ic-border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ic-modal__footer {
    border-bottom: none;
    border-top: 1px solid var(--ic-border);
    justify-content: flex-end;
    flex-wrap: wrap;
}
.ic-modal__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    flex: 1;
}
.ic-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--ic-text-muted);
    cursor: pointer;
    padding: 0 4px;
}
.ic-modal__close:hover { color: var(--ic-text); }
.ic-modal__body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
}
.ic-modal__intro {
    margin: 0 0 14px;
    color: var(--ic-text-muted);
    font-size: 13.5px;
}

/* ─── Lista de categorias ───────────────────────────────────────────────── */
.ic-cats { list-style: none; margin: 0; padding: 0; }
.ic-cat { padding: 14px 0; border-bottom: 1px solid var(--ic-border); }
.ic-cat:last-child { border-bottom: none; }
.ic-cat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.ic-cat__title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
}
.ic-cat__desc {
    margin: 0;
    color: var(--ic-text-muted);
    font-size: 12.5px;
}

/* ─── Switch (button role=switch) ──────────────────────────────────────── */
.ic-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.ic-switch[disabled] { cursor: not-allowed; opacity: 0.7; }
.ic-switch__track {
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: #cccccc;
    position: relative;
    transition: background 0.18s ease;
    flex-shrink: 0;
}
.ic-switch__track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.ic-switch[aria-checked="true"] .ic-switch__track {
    background: var(--ic-primary);
}
.ic-switch[aria-checked="true"] .ic-switch__track::after {
    transform: translateX(16px);
}
.ic-switch--locked .ic-switch__track { background: var(--ic-primary); opacity: 0.55; }
.ic-switch__label {
    font-size: 12px;
    color: var(--ic-text-muted);
    white-space: nowrap;
}

/* ─── Botões ───────────────────────────────────────────────────────────── */
.ic-btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    line-height: 1.2;
}
.ic-btn--primary {
    background: var(--ic-primary);
    color: #ffffff; /* texto branco sobre primary → contraste WCAG AA OK */
    border-color: var(--ic-primary);
}
.ic-btn--primary:hover { background: var(--ic-primary-dark); border-color: var(--ic-primary-dark); }
.ic-btn--ghost {
    background: transparent;
    color: var(--ic-text);
    border-color: var(--ic-border);
}
.ic-btn--ghost:hover { background: #f7f7f7; }
.ic-btn:focus-visible {
    outline: 2px solid var(--ic-primary);
    outline-offset: 2px;
}

/* ─── Links inline ─────────────────────────────────────────────────────── */
.ic-link {
    color: var(--ic-primary-dark);
    text-decoration: underline;
}
.ic-link:hover { color: var(--ic-primary); }

/* ─── Responsivo mobile ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ic-banner {
        max-width: 100%;
        padding: 16px 18px;
    }
    .ic-banner__actions {
        justify-content: stretch;
    }
    .ic-banner__actions .ic-btn { flex: 1 1 auto; min-width: 0; }
    .ic-modal__header,
    .ic-modal__body,
    .ic-modal__footer { padding: 14px 16px; }
    .ic-pos-bottom-left,
    .ic-pos-bottom-right,
    .ic-pos-bottom-center {
        left: 8px;
        right: 8px;
        bottom: 8px;
        transform: none;
    }
}
