/**
 * Confidențialitate și cookie-uri — banner, panou de preferințe, pagină.
 *
 * Regula de aur a bannerului: „Refuz” și „Accept” au aceeași geometrie,
 * aceeași tipografie și aceeași suprafață de clic. Diferă doar culoarea,
 * amândouă peste pragul AA. Un buton de refuz mai mic, mai palid sau
 * ascuns sub „Setări” e exact tiparul pe care autoritățile îl sancționează.
 *
 * @package ANPCDEFP
 * @since 2.9.0
 */

/* =========================================================================
   Banner
   ========================================================================= */
/* `display: flex` din clasele de mai jos bate regula `[hidden] { display:
   none }` din foaia browserului — fără declarația asta, bannerul și panoul
   s-ar vedea chiar și ascunse. Prima linie din fișier, ca să nu se piardă. */
.consent-banner[hidden],
.consent-panel[hidden] {
    display: none;
}


.consent-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1200;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.consent-banner__inner {
    pointer-events: auto;
    width: 100%;
    max-width: 940px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 20px 24px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 32px -8px rgba(26, 26, 46, 0.22), 0 2px 8px rgba(26, 26, 46, 0.08);

    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.consent-banner.is-visible .consent-banner__inner {
    opacity: 1;
    transform: none;
}

.consent-banner__text {
    flex: 1 1 auto;
    min-width: 0;
}

.consent-banner__title {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}

.consent-banner__text p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.consent-banner__text a {
    color: var(--brand-purple);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.consent-banner__text a:hover {
    color: var(--brand-purple-dark);
}

.consent-banner__actions {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
}

/* Cele două butoane sunt identice ca formă și mărime — vezi nota de sus. */
.consent-btn {
    min-width: 120px;
    padding: 12px 24px;
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.consent-btn--ghost {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

.consent-btn--ghost:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.consent-btn--solid {
    background: var(--brand-purple);
    color: var(--white);
}

.consent-btn--solid:hover {
    background: var(--brand-purple-dark);
}

.consent-btn:focus-visible {
    outline: 3px solid var(--brand-purple);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .consent-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .consent-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 18px 18px 20px;
    }

    .consent-banner__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .consent-btn {
        min-width: 0;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .consent-banner__inner {
        transition: none;
        transform: none;
    }
}

/* =========================================================================
   Panou de preferințe
   ========================================================================= */

.consent-panel {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.consent-panel__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.5);
}

.consent-panel__dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.consent-panel__head,
.consent-panel__foot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
}

.consent-panel__head {
    border-bottom: 1px solid var(--border-light);
}

.consent-panel__foot {
    justify-content: space-between;
    border-top: 1px solid var(--border-light);
    background: var(--gray-50);
}

.consent-panel__title {
    flex: 1 1 auto;
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.consent-panel__close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
}

.consent-panel__close:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.consent-panel__close:focus-visible {
    outline: 3px solid var(--brand-purple);
    outline-offset: 2px;
}

.consent-panel__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 22px 18px;
}

.consent-panel__link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--brand-purple);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.consent-group {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.consent-group:last-child {
    border-bottom: none;
}

.consent-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.consent-group__label {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.consent-group__always {
    flex: 0 0 auto;
    padding: 4px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--gray-100);
    border-radius: var(--radius-full);
}

.consent-group__summary {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Comutator — nebifat implicit, în marcaj și în CSS. Un comutator care
   arată pornit înainte de alegere e consimțământ presupus, adică nul. */
.consent-switch {
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.consent-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.consent-switch__track {
    display: block;
    width: 46px;
    height: 26px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: background-color 0.16s ease;
}

.consent-switch__track::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    margin: 3px;
    background: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    transition: transform 0.16s ease;
}

.consent-switch input:checked + .consent-switch__track {
    background: var(--brand-purple);
}

.consent-switch input:checked + .consent-switch__track::after {
    transform: translateX(20px);
}

.consent-switch input:focus-visible + .consent-switch__track {
    outline: 3px solid var(--brand-purple);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .consent-switch__track,
    .consent-switch__track::after {
        transition: none;
    }
}

/* =========================================================================
   Pagina de informare
   ========================================================================= */

.gdpr-lead {
    margin: 0 0 28px;
    padding: 20px 24px;
    background: var(--brand-purple-50);
    border-left: 4px solid var(--brand-purple);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--text-primary);
}

.gdpr-lead p {
    margin: 0 0 10px;
}

.gdpr-lead p:last-child {
    margin-bottom: 0;
}

.gdpr-section {
    margin: 0 0 44px;
    scroll-margin-top: calc(var(--total-header) + 20px);
}

.gdpr-section > h2 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gdpr-section__intro {
    margin: 0 0 22px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* --- starea curentă a alegerii --- */

.gdpr-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin: 0 0 26px;
    padding: 18px 22px;
    background: var(--gray-50);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.gdpr-state__text {
    flex: 1 1 260px;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.gdpr-state__value {
    display: inline-block;
    padding: 2px 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--gray-200);
    color: var(--text-primary);
}

.gdpr-state__value.is-on {
    background: rgba(137, 179, 58, 0.18);
    color: #3d5218;
}

.gdpr-state__value.is-off {
    background: var(--gray-200);
    color: var(--text-primary);
}

/* --- grup de categorie --- */

.gdpr-cat {
    margin: 0 0 30px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gdpr-cat__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 14px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-light);
}

.gdpr-cat__name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gdpr-cat__flag {
    padding: 3px 11px;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.gdpr-cat__flag--free {
    background: var(--gray-200);
    color: var(--text-secondary);
}

.gdpr-cat__flag--consent {
    background: var(--brand-purple-100);
    color: var(--brand-purple);
}

.gdpr-cat__summary {
    flex: 1 0 100%;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- tabelul --- */

.gdpr-table-wrap {
    overflow-x: auto;
}

.gdpr-table {
    width: 100%;
    min-width: 660px;
    border-collapse: collapse;
    font-size: 0.9375rem;
    table-layout: fixed;
}

/* Numele cookie-urilor sunt scurte, scopul are nevoie de aer. Fără
   lățimi fixe, „La ce folosește” se strânge într-o coloană de trei
   cuvinte pe rând. */
.gdpr-table col.gdpr-col--key      { width: 28%; }
.gdpr-table col.gdpr-col--provider { width: 20%; }
.gdpr-table col.gdpr-col--purpose  { width: 35%; }
.gdpr-table col.gdpr-col--duration { width: 17%; }

.gdpr-table th,
.gdpr-table td {
    padding: 13px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-light);
}

.gdpr-table tr:last-child td {
    border-bottom: none;
}

.gdpr-table th {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.gdpr-table td {
    line-height: 1.6;
    color: var(--text-secondary);
}

.gdpr-table__key {
    display: block;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    /* break-word, nu anywhere: rupe doar când chiar nu încape, ca
       „anpcdefp_consent” să nu se taie în două degeaba. */
    overflow-wrap: break-word;
}

.gdpr-table__type {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 9px;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--doc-tile-bg);
    color: var(--doc-tile-ink);
    white-space: nowrap;
}

.gdpr-table__provider {
    font-weight: 500;
    color: var(--text-primary);
}

.gdpr-table__note {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Fără nowrap: duratele nu sunt toate „6 luni”, unele sunt fraze
   („până le ștergi din browser”), iar o singură frază nerupăbilă
   împinge tot tabelul în afara coloanei de conținut. */
.gdpr-table__duration {
    overflow-wrap: break-word;
}

@media (max-width: 900px) {
    .gdpr-table,
    .gdpr-table tbody,
    .gdpr-table tr,
    .gdpr-table td {
        display: block;
        width: 100%;
    }

    .gdpr-table {
        min-width: 0;
        table-layout: auto;
    }

    .gdpr-table colgroup {
        display: none;
    }

    .gdpr-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .gdpr-table tr {
        padding: 14px 18px;
        border-bottom: 1px solid var(--border-light);
    }

    .gdpr-table tr:last-child {
        border-bottom: none;
    }

    .gdpr-table td {
        padding: 5px 0;
        border: none;
    }

    .gdpr-table td:first-child {
        margin-bottom: 4px;
    }

    .gdpr-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        font-family: var(--font-display);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
    }

    .gdpr-table td:first-child[data-label]::before {
        content: none;
    }
}

/* --- fișe (terți, drepturi, contact) --- */

.gdpr-cards {
    display: grid;
    gap: 14px;
    margin: 0 0 24px;
}

.gdpr-card {
    padding: 18px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.gdpr-card__title {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gdpr-card__meta {
    margin: 0 0 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.gdpr-card p {
    margin: 0 0 8px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.gdpr-card p:last-child {
    margin-bottom: 0;
}

.gdpr-card a {
    color: var(--brand-purple);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.gdpr-rights {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}

.gdpr-rights li {
    position: relative;
    padding-left: 30px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.gdpr-rights li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    background: var(--brand-purple);
    border-radius: var(--radius-full);
}

.gdpr-rights strong {
    color: var(--text-primary);
}

.gdpr-contact {
    padding: 22px 24px;
    background: var(--brand-purple-50);
    border-radius: var(--radius-lg);
}

.gdpr-contact dl {
    display: grid;
    grid-template-columns: minmax(150px, auto) 1fr;
    gap: 10px 20px;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.gdpr-contact dt {
    font-weight: 600;
    color: var(--text-primary);
}

.gdpr-contact dd {
    margin: 0;
    color: var(--text-secondary);
}

.gdpr-contact a {
    color: var(--brand-purple);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

@media (max-width: 620px) {
    .gdpr-contact dl {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .gdpr-contact dd {
        margin-bottom: 10px;
    }
}

.gdpr-updated {
    margin: 34px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Butonul din subsol care redeschide panoul — arată ca celelalte linkuri
   juridice, ca să nu pară un intrus. */
.footer__legal .consent-reopen {
    padding: 0;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* =========================================================================
   Conviețuirea cu `.prose`
   =========================================================================
   Pagina de informare stă într-un <article class="entry-content prose">,
   iar tema dă acolo stiluri generice pentru h2/h3/p/ul/li/table
   (style.css, blocul de la ~4615). Sunt potrivite pentru text scris de
   editor în WordPress, dar componentele de mai sus sunt randate din
   registru și își aduc propriul ritm.

   Problema e de specificitate, nu de ordine: `.prose h3` are (0,1,1), iar
   `.gdpr-card__title` doar (0,1,0) — deci regula generică învinge oricât
   de jos ar sta a mea în fișier. Așa apărea golul de 2rem în capul
   fiecărui card, plus buline duble la lista de drepturi și paddingul
   temei în tabele.

   Le neutralizăm punctual, sub `.entry-content`, DOAR pe componentele
   noastre. `.prose` rămâne neatins: restul paginilor scriu în el și au
   nevoie de ritmul lui.
   ========================================================================= */

/* --- titluri de componentă: fără marginile de text curgător --- */

.entry-content .gdpr-card__title,
.entry-content .gdpr-cat__name {
    margin: 0 0 6px;
    font-size: 1rem;
}

.entry-content .gdpr-cat__name {
    margin: 0;
    font-size: 1.125rem;
}

.entry-content .gdpr-section > h2 {
    margin: 0 0 6px;
}

/* --- paragrafe de componentă --- */

.entry-content .gdpr-section__intro {
    margin: 0 0 22px;
}

.entry-content .gdpr-cat__summary,
.entry-content .gdpr-card p:last-child,
.entry-content .gdpr-state__text {
    margin-bottom: 0;
}

.entry-content .gdpr-card p {
    margin-bottom: 8px;
}

.entry-content .gdpr-lead p:last-child {
    margin-bottom: 0;
}

/* --- lista de drepturi: fără bulinele și indentarea din .prose --- */

.entry-content .gdpr-rights {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.entry-content .gdpr-rights li {
    margin-bottom: 0; /* distanța o dă `gap`-ul din grid */
}

/* --- tabelul: paddingul, fundalul și hover-ul din .prose nu se aplică --- */

.entry-content .gdpr-table {
    margin: 0;
    font-size: 0.9375rem;
}

.entry-content .gdpr-table th {
    padding: 13px 16px;
    background: none;
    border-bottom: 1px solid var(--border-light);
}

.entry-content .gdpr-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
}

.entry-content .gdpr-table tr:last-child td {
    border-bottom: none;
}

.entry-content .gdpr-table tr:hover {
    background: none;
}

@media (max-width: 900px) {
    .entry-content .gdpr-table td {
        padding: 5px 0;
        border-bottom: none;
    }

    .entry-content .gdpr-table tr {
        padding: 14px 18px;
        border-bottom: 1px solid var(--border-light);
    }

    .entry-content .gdpr-table tr:last-child {
        border-bottom: none;
    }
}

/* --- lista de contact --- */

.entry-content .gdpr-contact dd {
    margin: 0;
}

/* --- ultimul paragraf --- */

.entry-content .gdpr-updated {
    margin: 34px 0 0;
}

/* --- blocul pliat cu ce ține de panoul de administrare --- */

.gdpr-admin {
    margin: 0 0 30px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gdpr-admin__summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 14px 20px;
    background: var(--gray-50);
    cursor: pointer;
    list-style: none;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.gdpr-admin__summary::-webkit-details-marker { display: none; }

/* Iconița vine din marcaj, ca la section-nav__toggle — nu dintr-o glifă
   pusă prin `content`, care ar lăsa un pătrat gol dacă Font Awesome nu
   se încarcă. */
.gdpr-admin__caret {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.16s ease;
}

.gdpr-admin[open] .gdpr-admin__caret {
    transform: rotate(90deg);
}

.gdpr-admin__summary:hover {
    color: var(--text-primary);
}

.gdpr-admin__summary:focus-visible {
    outline: 3px solid var(--brand-purple);
    outline-offset: -3px;
}

.gdpr-admin__label { flex: 1 1 auto; }

.gdpr-admin__count {
    flex: 0 0 auto;
    font-family: var(--font-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.gdpr-admin__body {
    border-top: 1px solid var(--border-light);
}

.entry-content .gdpr-admin__intro {
    margin: 0;
    padding: 16px 20px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

@media (prefers-reduced-motion: reduce) {
    .gdpr-admin__caret { transition: none; }
}
