/**
 * Dionis Cookie Manager — Frontend Styles
 * Design: compact bar + wide modal (inspirat MedicHub / CookieYes)
 *
 * Culorile = variabile CSS injectate din PHP (cc_get_css_variables()).
 * Nu modifica culorile direct — Admin → Dionis Cookie Manager → Culori & Aspect.
 *
 * @author Dionis Agency | office@dionisdigital.ro
 */

/* ══════════════════════════════════════════════════════════════════
   UTILITARE
══════════════════════════════════════════════════════════════════ */

.cc-hidden { display: none !important; }

.cc-sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ══════════════════════════════════════════════════════════════════
   BANNER — bara compactă
══════════════════════════════════════════════════════════════════ */

.cc-banner {
    position: fixed;
    z-index: 999998;
    left: 0; right: 0;
    background: var(--cc-banner-bg, #ffffff);
    color: var(--cc-banner-text, #1a1a1a);
    border-top: 1px solid rgba(0,0,0,.09);
    box-shadow: 0 -2px 12px rgba(0,0,0,.07);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.5;
    box-sizing: border-box;
    transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s ease;
}

/* Poziție jos (default) */
.cc-banner--bottom-bar,
.cc-banner--bottom-left,
.cc-banner--bottom-right {
    bottom: 0;
    transform: translateY(100%);
    opacity: 0;
}

/* Poziție sus */
.cc-banner--top-bar {
    top: 0; bottom: auto;
    border-top: none;
    border-bottom: 1px solid rgba(0,0,0,.09);
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    transform: translateY(-100%);
    opacity: 0;
}

.cc-banner.cc-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ── Inner layout ─────────────────────────────────────────────────── */

.cc-banner__inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 20px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: nowrap;
    min-height: 52px;
}

/* Logo */
.cc-banner__brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.cc-logo__img {
    display: block;
    max-height: 28px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
}

.cc-logo--text {
    font-weight: 700;
    font-size: 14px;
    color: var(--cc-banner-text, #1a1a1a);
    white-space: nowrap;
}

/* Separator vizual după logo */
.cc-banner__brand::after {
    content: '';
    display: block;
    width: 1px;
    height: 22px;
    background: rgba(0,0,0,.12);
    margin-left: 14px;
}

/* Conținut text */
.cc-banner__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cc-banner__title {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--cc-banner-text, #1a1a1a);
    display: block;
    line-height: 1.3;
}

.cc-banner__text {
    font-size: 12.5px;
    color: var(--cc-banner-text, #1a1a1a);
    opacity: .72;
    display: block;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* Butoane banner — proporționale cu textul */
.cc-banner__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   BUTOANE
══════════════════════════════════════════════════════════════════ */

.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
    border: 1.5px solid transparent;
    transition: filter .15s, transform .1s, background .15s;
    text-decoration: none;
    box-sizing: border-box;
    letter-spacing: .01em;
}

.cc-btn:hover  { filter: brightness(.93); }
.cc-btn:active { transform: scale(.97); }
.cc-btn:focus-visible {
    outline: 2px solid var(--cc-btn-accept-bg, #2563eb);
    outline-offset: 2px;
}

/* Outline (Personalizați) */
.cc-btn--outline {
    background: transparent;
    border-color: var(--cc-btn-accept-bg, #2563eb);
    color: var(--cc-btn-accept-bg, #2563eb);
}
.cc-btn--outline:hover {
    background: var(--cc-btn-accept-bg, #2563eb);
    color: #fff;
    filter: none;
}

/* Săgeată în butonul Personalizați */
.cc-btn__arrow { flex-shrink: 0; }

/* Reject */
.cc-btn--reject {
    background: var(--cc-btn-reject-bg, #f3f4f6);
    color: var(--cc-btn-reject-text, #374151);
    border-color: transparent;
}

/* Accept */
.cc-btn--accept {
    background: var(--cc-btn-accept-bg, #2563eb);
    color: var(--cc-btn-accept-text, #ffffff);
    border-color: transparent;
}

/* Save (modal footer) */
.cc-btn--save {
    background: var(--cc-btn-accept-bg, #2563eb);
    color: var(--cc-btn-accept-text, #ffffff);
    border-color: transparent;
    padding: 10px 24px;
    font-size: 13.5px;
    border-radius: 6px;
}

/* ══════════════════════════════════════════════════════════════════
   OVERLAY
══════════════════════════════════════════════════════════════════ */

.cc-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: var(--cc-overlay-bg, rgba(0,0,0,.45));
    animation: cc-fade-in .2s ease;
}

@keyframes cc-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ══════════════════════════════════════════════════════════════════
   MODAL — panel full-width sticky bottom (CookieYes style)
══════════════════════════════════════════════════════════════════ */

.cc-modal {
    position: fixed;
    z-index: 999999;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 32px rgba(0,0,0,.12);
    animation: cc-modal-up .28s cubic-bezier(.4,0,.2,1);
    box-sizing: border-box;
    overflow: hidden;
}

@keyframes cc-modal-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header modal ─────────────────────────────────────────────────── */

.cc-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px 12px;
    border-bottom: 1px solid #efefef;
    flex-shrink: 0;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    align-self: center;
}

.cc-modal__header-brand {
    flex-shrink: 0;
}

.cc-modal__header-brand .cc-logo__img {
    max-height: 26px;
}

.cc-modal__header-text { flex: 1; min-width: 0; }

.cc-modal__title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin: 0;
    line-height: 1.3;
}

.cc-modal__close {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 6px;
    border-radius: 5px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    margin-left: auto;
}
.cc-modal__close:hover {
    background: #f3f4f6 !important;
    color: #374151;
}

/* ── Body modal ───────────────────────────────────────────────────── */

.cc-modal__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    width: 100%;
    box-sizing: border-box;
}

.cc-modal__intro {
    font-size: 13px;
    color: #6b7280;
    margin: 0 auto;
    padding: 12px 32px 10px;
    line-height: 1.55;
    border-bottom: 1px solid #f5f5f5;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Footer modal ─────────────────────────────────────────────────── */

.cc-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px 14px;
    border-top: 1px solid #efefef;
    flex-shrink: 0;
    gap: 12px;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    align-self: center;
}

/* Powered by */
.cc-powered-by {
    font-size: 11.5px;
    color: #adb5bd;
}
.cc-powered-by__link {
    color: #adb5bd;
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}
.cc-powered-by__link:hover { color: #6b7280; }

/* ══════════════════════════════════════════════════════════════════
   CATEGORII — stil CookieYes (chevron-right, fără background)
══════════════════════════════════════════════════════════════════ */

.cc-categories {
    padding: 0 32px;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.cc-category {
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 0 10px;
}
.cc-category:last-child { border-bottom: none; }

/* Rândul principal: chevron+nume | toggle */
.cc-category__row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 0 0;
}

/* Butonul accordion — fără background, doar text bold */
/* Folosim #cookie-consent-modal pentru specificitate > tema site-ului */
#cookie-consent-modal .cc-category__btn {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    padding: 0 !important;
    text-align: left;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    width: auto;
    outline: none;
}

#cookie-consent-modal .cc-category__btn:hover,
#cookie-consent-modal .cc-category__btn:focus {
    background: none !important;
    background-color: transparent !important;
}

#cookie-consent-modal .cc-category__btn:hover .cc-category__name {
    color: var(--cc-btn-accept-bg, #2563eb);
}

#cookie-consent-modal .cc-category__btn--no-expand {
    cursor: default;
    pointer-events: none;
}

/* Chevron → dreapta implicit, rotit 90° când e deschis */
.cc-category__chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #9ca3af;
    transition: transform .2s ease;
    width: 14px;
    margin-top: 1px;
}
.cc-category__btn[aria-expanded="true"] .cc-category__chevron {
    transform: rotate(90deg);
}
.cc-category__btn--no-expand .cc-category__chevron {
    opacity: 0;
    width: 14px;
}

.cc-category__name {
    flex: 1;
    transition: color .15s;
}

/* Număr cookie-uri */
.cc-category__count {
    font-size: 11px;
    font-weight: 500;
    color: #b0b7c3;
    background: #f5f5f5;
    padding: 1px 6px;
    border-radius: 20px;
    margin-left: 4px;
}

/* Descriere — mereu vizibilă, sub rând */
.cc-category__desc {
    font-size: 13px;
    color: #6b7280;
    margin: 5px 0 12px 20px;
    line-height: 1.5;
}

/* Tabel cookie-uri */
.cc-category__cookies {
    margin: 0 0 12px 20px;
}

/* ── Toggle switch ────────────────────────────────────────────────── */

.cc-category__toggle-wrap {
    flex-shrink: 0;
    padding-top: 1px;
}

.cc-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.cc-toggle__input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    pointer-events: none;
}

.cc-toggle__track {
    position: relative;
    display: block;
    width: 42px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: background .2s ease;
}

.cc-toggle__thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: transform .2s ease;
}

.cc-toggle__input:checked + .cc-toggle__track {
    background: var(--cc-toggle-active, #2563eb);
}
.cc-toggle__input:checked + .cc-toggle__track .cc-toggle__thumb {
    transform: translateX(18px);
}
.cc-toggle__input:focus-visible + .cc-toggle__track {
    outline: 2px solid var(--cc-toggle-active, #2563eb);
    outline-offset: 2px;
}

/* "Întotdeauna activ" */
.cc-always-active {
    font-size: 12px;
    font-weight: 600;
    color: #16a34a;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

/* ══════════════════════════════════════════════════════════════════
   TABEL COOKIE-URI
══════════════════════════════════════════════════════════════════ */

.cc-table-scroll {
    overflow-x: auto;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    -webkit-overflow-scrolling: touch;
}

.cc-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 400px;
}

.cc-cookie-table th {
    background: #fafafa;
    color: #9ca3af;
    font-weight: 600;
    text-align: left;
    padding: 7px 12px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .04em;
}

.cc-cookie-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #fafafa;
    color: #374151;
    vertical-align: top;
    line-height: 1.4;
}

.cc-cookie-table tr:last-child td { border-bottom: none; }
.cc-cookie-table tbody tr:hover td { background: #fafafe; }

.cc-code {
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    font-size: 11px;
    background: #f3f4f6;
    padding: 2px 5px;
    border-radius: 3px;
    color: #374151;
    white-space: nowrap;
}

.cc-nowrap { white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════
   ICON FOOTER (schimbă preferințe) — 30×30px
══════════════════════════════════════════════════════════════════ */

.cc-footer-link {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 999990;
}

#cc-footer-link-wrap .cc-footer-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    background: var(--cc-btn-accept-bg, #2563eb) !important;
    color: var(--cc-btn-accept-text, #ffffff) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.20) !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: box-shadow .2s, transform .15s;
    padding: 0 !important;
    line-height: 1 !important;
    min-width: unset !important;
    min-height: unset !important;
}

#cc-footer-link-wrap .cc-footer-icon svg {
    display: block;
    flex-shrink: 0;
}

#cc-footer-link-wrap .cc-footer-icon:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.28) !important;
    transform: scale(1.1);
    background: var(--cc-btn-accept-bg, #2563eb) !important;
}

#cc-footer-link-wrap .cc-footer-icon:focus-visible {
    outline: 2px solid var(--cc-btn-accept-bg, #2563eb);
    outline-offset: 3px;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* Banner: stivuire verticală pe telefon */
    .cc-banner__inner {
        flex-wrap: wrap;
        padding: 10px 14px 12px;
        gap: 8px;
        min-height: unset;
    }

    .cc-banner__brand { width: 100%; }
    .cc-banner__brand::after { display: none; }
    .cc-banner__content { width: 100%; }
    .cc-banner__text { -webkit-line-clamp: 2; }

    .cc-banner__actions {
        width: 100%;
        flex-direction: column;
        gap: 6px;
    }
    .cc-banner__actions .cc-btn { width: 100%; justify-content: center; }

    /* Modal: max-height mai mare pe telefon */
    .cc-modal {
        max-height: 85vh;
        border-radius: 10px 10px 0 0;
    }

    /* Categorii: padding mai mic pe mobil */
    .cc-categories {
        padding: 0 16px;
        max-width: 100%;
    }
    .cc-modal__intro  { padding: 10px 16px 8px; max-width: 100%; }
    .cc-modal__header { padding: 12px 16px 10px; max-width: 100%; }
    .cc-modal__footer { padding: 10px 16px 12px; max-width: 100%; }

    .cc-footer-link { bottom: 12px; left: 12px; }
}

@media (max-width: 480px) {
    .cc-category__desc { margin-left: 0; }
    .cc-category__cookies { margin-left: 0; }
}

/* ══════════════════════════════════════════════════════════════════
   SHORTCODE [cookie_table] — Politică Cookie
   Folosit în pagina de Politică Cookie — stiluri standalone,
   independente de tema activă.
══════════════════════════════════════════════════════════════════ */

.cc-policy-wrap {
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    color: inherit;
}

.cc-policy-section {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid #f0f0f0;
}

.cc-policy-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cc-policy-cat-title {
    font-size: 18px;
    font-weight: 700;
    color: inherit;
    margin: 0 0 8px;
    padding: 0;
}

.cc-policy-cat-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 16px;
    line-height: 1.6;
    max-width: 720px;
}

/* Tabel responsive */
.cc-policy-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.cc-policy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 480px;
    background: #fff;
}

.cc-policy-table thead tr {
    background: #f9fafb;
}

.cc-policy-table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.cc-policy-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: top;
    line-height: 1.5;
}

.cc-policy-table tbody tr:last-child td {
    border-bottom: none;
}

.cc-policy-table tbody tr:hover td {
    background: #fafafa;
}

.cc-policy-cookie-name {
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    font-size: 12.5px;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1f2937;
    white-space: nowrap;
}

.cc-policy-provider {
    color: #6b7280;
    white-space: nowrap;
}

.cc-policy-nowrap {
    white-space: nowrap;
    color: #6b7280;
}

.cc-policy-description {
    color: #374151;
    max-width: 400px;
}

.cc-policy-empty {
    color: #9ca3af;
    font-style: italic;
    padding: 16px 0;
}

/* Print styles */
@media print {
    .cc-policy-table-wrap {
        overflow: visible;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    .cc-policy-table {
        min-width: 0;
        font-size: 11pt;
    }
    .cc-policy-section { page-break-inside: avoid; }
}

/* ══════════════════════════════════════════════════════════════════
   POLISH FINAL — Cross-browser & Accesibilitate
══════════════════════════════════════════════════════════════════ */

/* Focus visible consistent cross-browser */
.cc-btn:focus-visible,
.cc-toggle__input:focus-visible + .cc-toggle__track,
.cc-category__btn:focus-visible,
.cc-modal__close:focus-visible,
.cc-footer-icon:focus-visible {
    outline: 2px solid var(--cc-btn-accept-bg, #2563eb);
    outline-offset: 2px;
}

/* Prevenire FOUC (Flash of Unstyled Content) — banner ascuns by default */
#cookie-consent-banner,
#cookie-consent-modal,
#cc-modal-overlay,
#cc-footer-link-wrap {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* High contrast mode support */
@media (forced-colors: active) {
    .cc-btn,
    .cc-footer-icon {
        forced-color-adjust: none;
    }
    .cc-toggle__track {
        border: 2px solid ButtonText;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cc-banner,
    .cc-modal,
    .cc-overlay,
    .cc-toggle__track,
    .cc-toggle__thumb,
    .cc-category__chevron,
    .cc-footer-icon {
        transition: none !important;
        animation: none !important;
    }
}

/* Safari: fix pentru position:fixed în iframe */
@supports (-webkit-touch-callout: none) {
    .cc-banner {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}