/* =====================================================
   Cookie Consent (GDPR/CCPA) — External stylesheet
   Dynamic values are injected via CSS custom properties
   declared in an inline :root{} block in the template.
   ===================================================== */

/* ---- Overlay ---- */
#cc-banner-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99998;
    backdrop-filter: blur(2px);
}

/* ---- BASE banner ---- */
#cc-banner {
    display: none;
    position: fixed;
    z-index: 99999;
    background: var(--cc-bg);
    color: var(--cc-fg);
    font-size: var(--cc-font);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

/* ===================================================
   LAYOUT: BAR
   Full-width stripe, horizontal content
   =================================================== */
#cc-banner.cc-layout-bar {
    left: 0; right: 0;
    padding: 16px 28px;
    box-shadow: 0 -3px 20px rgba(0,0,0,0.25);
    border-radius: 0;
}
#cc-banner.cc-layout-bar.cc-pos-bottom { bottom: 0; }
#cc-banner.cc-layout-bar.cc-pos-top    { top: 0; box-shadow: 0 3px 20px rgba(0,0,0,0.25); }

#cc-banner.cc-layout-bar .cc-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}
#cc-banner.cc-layout-bar .cc-content {
    flex: 1;
    min-width: 240px;
}
#cc-banner.cc-layout-bar .cc-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}
#cc-banner.cc-layout-bar .cc-title {
    font-weight: 700;
    font-size: var(--cc-font-title);
    margin-bottom: 4px;
}
#cc-banner.cc-layout-bar .cc-desc {
    opacity: 0.85;
    line-height: 1.5;
    margin: 0;
}

/* ===================================================
   LAYOUT: BOX
   Compact card in a corner
   =================================================== */
#cc-banner.cc-layout-box {
    width: 340px;
    max-width: calc(100vw - 24px);
    padding: 20px;
    border-radius: var(--cc-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
}
#cc-banner.cc-layout-box.cc-pos-center       { left: 50%; top: 50%; transform: translate(-50%, -50%); }
#cc-banner.cc-layout-box.cc-pos-top          { right: 16px; top: 16px; }
#cc-banner.cc-layout-box.cc-pos-bottom       { right: 16px; bottom: 16px; }
#cc-banner.cc-layout-box.cc-pos-bottom_right { right: 16px; bottom: 16px; }
#cc-banner.cc-layout-box.cc-pos-bottom_left  { left: 16px; bottom: 16px; }

#cc-banner.cc-layout-box .cc-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#cc-banner.cc-layout-box .cc-title {
    font-weight: 700;
    font-size: var(--cc-font-title);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#cc-banner.cc-layout-box .cc-title::before {
    content: '🍪';
    font-size: 18px;
}
#cc-banner.cc-layout-box .cc-desc {
    opacity: 0.85;
    line-height: 1.55;
    font-size: var(--cc-font);
    margin: 0;
}
#cc-banner.cc-layout-box .cc-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#cc-banner.cc-layout-box .cc-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* ===================================================
   LAYOUT: MODAL
   Large centered dialog
   =================================================== */
#cc-banner.cc-layout-modal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px 36px;
    border-radius: var(--cc-radius-pref);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
#cc-banner.cc-layout-modal .cc-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
}
#cc-banner.cc-layout-modal .cc-title {
    font-weight: 800;
    font-size: var(--cc-font-modal-title);
    margin-bottom: 8px;
    text-align: center;
}
#cc-banner.cc-layout-modal .cc-desc {
    opacity: 0.88;
    line-height: 1.65;
    text-align: center;
    font-size: var(--cc-font);
    margin: 0;
}
#cc-banner.cc-layout-modal .cc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}
#cc-banner.cc-layout-modal .cc-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: var(--cc-font-title);
    text-align: center;
    justify-content: center;
}
#cc-banner.cc-layout-modal .cc-privacy-row {
    text-align: center;
    font-size: 12px;
    opacity: 0.6;
    margin-top: -6px;
}
#cc-banner.cc-layout-modal .cc-privacy-row a {
    color: var(--cc-fg);
    text-decoration: underline;
}

/* ---- Shared button styles ---- */
.cc-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: none;
    border-radius: var(--cc-radius);
    cursor: pointer;
    font-size: var(--cc-font);
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.15s;
    line-height: 1.2;
}
.cc-btn:hover  { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.cc-btn:active { transform: translateY(0); }
.cc-btn-accept      { background: var(--cc-btn); color: var(--cc-btn-text); }
.cc-btn-decline     { background: var(--cc-decline); color: #fff; }
.cc-btn-preferences {
    background: transparent;
    color: var(--cc-fg);
    border: 1.5px solid rgba(255,255,255,0.4);
    opacity: 0.8;
}
.cc-btn-preferences:hover { opacity: 1; border-color: var(--cc-fg); }
.cc-desc a { color: var(--cc-btn); }

/* ---- Animations ---- */

/* Bar — bottom: slide up */
#cc-banner.cc-layout-bar.cc-pos-bottom.cc-anim-slide.cc-animate-in {
    animation: cc-slide-up 0.38s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes cc-slide-up {
    from { transform: translateY(110%);  opacity: 0.5; }
    to   { transform: translateY(0);     opacity: 1;   }
}

/* Bar — top: slide down */
#cc-banner.cc-layout-bar.cc-pos-top.cc-anim-slide.cc-animate-in {
    animation: cc-slide-down 0.38s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes cc-slide-down {
    from { transform: translateY(-110%); opacity: 0.5; }
    to   { transform: translateY(0);     opacity: 1;   }
}

/* Box — pop in */
#cc-banner.cc-layout-box.cc-anim-slide.cc-animate-in {
    animation: cc-pop-in 0.35s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes cc-pop-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* Modal — slide + fade */
#cc-banner.cc-layout-modal.cc-anim-slide.cc-animate-in {
    animation: cc-modal-in 0.38s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes cc-modal-in {
    from { transform: translate(-50%, -46%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

/* Fade — all layouts */
#cc-banner.cc-anim-fade.cc-animate-in {
    animation: cc-fadein 0.4s ease forwards;
}
@keyframes cc-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Preferences panel ---- */
#cc-preferences {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
}
#cc-preferences.cc-open { display: flex; }
.cc-pref-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}
.cc-pref-modal {
    position: relative;
    background: #fff;
    color: #222;
    border-radius: var(--cc-radius-pref);
    width: 90%;
    max-width: 620px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--cc-font);
    animation: cc-modal-in-pref 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes cc-modal-in-pref {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.cc-pref-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.cc-pref-header h2 { margin: 0; font-size: 18px; }
.cc-pref-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-pref-close:hover { background: #f3f4f6; color: #222; }
.cc-pref-body { padding: 20px 24px; }
.cc-category {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.cc-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f9fafb;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}
.cc-cat-header:hover { background: #f0f1f3; }
.cc-cat-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cc-cat-title { font-weight: 600; font-size: 15px; }
.cc-cat-arrow { color: #999; font-size: 11px; margin-left: auto; transition: transform 0.2s; }
.cc-cat-header.open .cc-cat-arrow { transform: rotate(180deg); }
.cc-cat-desc-wrap {
    padding: 12px 16px 16px;
    color: #555;
    line-height: 1.6;
    font-size: 13px;
    display: none;
    border-top: 1px solid #f0f0f0;
}
.cc-toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.cc-toggle input { opacity: 0; width: 0; height: 0; }
.cc-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}
.cc-slider:before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked  + .cc-slider             { background: var(--cc-btn); }
input:checked  + .cc-slider:before      { transform: translateX(20px); }
input:disabled + .cc-slider             { cursor: not-allowed; opacity: 0.65; }
.cc-always-on { font-size: 11px; color: #888; font-weight: 500; }
.cc-cat-cookies { margin-top: 10px; }
.cc-cat-cookies table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cc-cat-cookies th { text-align: left; padding: 6px 8px; background: #f5f6f7; font-weight: 600; color: #444; }
.cc-cat-cookies td { padding: 6px 8px; border-top: 1px solid #f0f0f0; color: #555; }
.cc-cat-cookies tr:hover td { background: #fafafa; }
.cc-pref-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: #fff;
}
.cc-pref-save {
    background: var(--cc-btn);
    color: var(--cc-btn-text);
    border: none;
    border-radius: var(--cc-radius);
    padding: 10px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--cc-font);
    transition: opacity 0.2s, transform 0.15s;
}
.cc-pref-save:hover { opacity: 0.88; transform: translateY(-1px); }
.cc-pref-accept-all {
    background: transparent;
    color: var(--cc-btn);
    border: 1.5px solid var(--cc-btn);
    border-radius: var(--cc-radius);
    padding: 10px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--cc-font);
    transition: background 0.2s, color 0.2s;
}
.cc-pref-accept-all:hover { background: var(--cc-btn); color: var(--cc-btn-text); }

/* ---- Re-open / Cookie declaration button ---- */
.cc-declaration-btn {
    background: var(--cc-bg);
    color: var(--cc-fg);
    border: none;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 12px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* Floating (left / right) */
.cc-declaration-btn.cc-reopen-left,
.cc-declaration-btn.cc-reopen-right {
    position: fixed;
    bottom: var(--cc-reopen-bottom);
    z-index: 9000;
    opacity: 0.82;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.cc-declaration-btn.cc-reopen-left  { left:  var(--cc-reopen-side); }
.cc-declaration-btn.cc-reopen-right { right: var(--cc-reopen-side); }
.cc-declaration-btn.cc-reopen-left:hover,
.cc-declaration-btn.cc-reopen-right:hover { opacity: 1; transform: translateY(-1px); }
/* Manual placement — hidden block, user places in theme */
.cc-declaration-btn.cc-reopen-manual { display: none; cursor: pointer; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    #cc-banner.cc-layout-bar .cc-inner { flex-direction: column; align-items: flex-start; }
    #cc-banner.cc-layout-bar { padding: 14px 16px; }
    #cc-banner.cc-layout-modal { padding: 24px 20px; }
    #cc-banner.cc-layout-box { width: calc(100vw - 24px); right: 12px; left: 12px; }
    .cc-pref-modal { width: 96%; max-height: 90vh; }
    .cc-pref-footer { flex-direction: column; }
    .cc-pref-accept-all, .cc-pref-save { width: 100%; text-align: center; }
}
