/* WP Cookie Consent – Frontend Styles */
:root {
    --wpcc-primary:     #1a73e8;
    --wpcc-bg:          #ffffff;
    --wpcc-text:        #202124;
    --wpcc-text-muted:  #5f6368;
    --wpcc-border:      #dadce0;
    --wpcc-radius:      8px;
    --wpcc-shadow:      0 4px 24px rgba(0,0,0,0.14);
    --wpcc-toggle-on:   var(--wpcc-primary);
    --wpcc-toggle-off:  #bdc1c6;
    --wpcc-focus:       rgba(26,115,232,0.35);
    --wpcc-z-banner:    999990;
    --wpcc-z-overlay:   999991;
    --wpcc-z-modal:     999992;
}

/* ── Banner ── */
#wpcc-banner {
    position: fixed;
    z-index: var(--wpcc-z-banner);
    background: var(--wpcc-bg);
    color: var(--wpcc-text);
    box-shadow: var(--wpcc-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    max-width: 100%;
    border-top: 3px solid var(--wpcc-primary);
}

#wpcc-banner[hidden] { display: none !important; }

/* Bar layout (bottom) */
#wpcc-banner.wpcc-bar-bottom {
    bottom: 0; left: 0; right: 0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Bar layout (top) */
#wpcc-banner.wpcc-bar-top {
    top: 0; left: 0; right: 0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-top: none;
    border-bottom: 3px solid var(--wpcc-primary);
}

/* Box / popup layout */
#wpcc-banner.wpcc-box {
    bottom: 24px; right: 24px;
    width: 400px;
    padding: 24px;
    border-radius: var(--wpcc-radius);
}

.wpcc-banner-content {
    flex: 1 1 300px;
}

.wpcc-banner-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
}

.wpcc-banner-text {
    color: var(--wpcc-text-muted);
    margin: 0;
    font-size: 13px;
}

.wpcc-banner-links {
    font-size: 12px;
    margin-top: 6px;
}

.wpcc-banner-links a {
    color: var(--wpcc-primary);
    text-decoration: underline;
}

.wpcc-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ── Buttons ── */
.wpcc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--wpcc-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

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

.wpcc-btn-primary {
    background: var(--wpcc-primary);
    color: #fff;
}

.wpcc-btn-primary:hover { opacity: 0.88; }

.wpcc-btn-secondary {
    background: transparent;
    color: var(--wpcc-primary);
    border: 1.5px solid var(--wpcc-primary);
}

.wpcc-btn-secondary:hover { background: rgba(26,115,232,0.06); }

.wpcc-btn-ghost {
    background: transparent;
    color: var(--wpcc-text-muted);
    padding: 9px 10px;
}

.wpcc-btn-ghost:hover { color: var(--wpcc-text); }

/* ── Overlay ── */
#wpcc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: var(--wpcc-z-overlay);
    backdrop-filter: blur(2px);
}

#wpcc-overlay[hidden] { display: none !important; }

/* ── Preferences Modal ── */
#wpcc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--wpcc-z-modal);
    background: var(--wpcc-bg);
    color: var(--wpcc-text);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    overflow: hidden;
}

#wpcc-modal[hidden] { display: none !important; }

.wpcc-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--wpcc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wpcc-modal-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.wpcc-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wpcc-text-muted);
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    font-family: inherit;
}

.wpcc-modal-close:hover { background: #f1f3f4; color: var(--wpcc-text); }
.wpcc-modal-close:focus-visible { outline: 3px solid var(--wpcc-focus); }

.wpcc-modal-body {
    overflow-y: auto;
    padding: 16px 24px;
    flex: 1;
    overscroll-behavior: contain;
}

.wpcc-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--wpcc-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Category Accordion ── */
.wpcc-category {
    border: 1px solid var(--wpcc-border);
    border-radius: var(--wpcc-radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.wpcc-category-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    background: #f8f9fa;
    gap: 10px;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.wpcc-category-header:hover { background: #f1f3f4; }
.wpcc-category-header:focus-visible { outline: 3px solid var(--wpcc-focus); outline-offset: -3px; }

.wpcc-category-icon {
    width: 18px;
    height: 18px;
    color: var(--wpcc-text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.wpcc-category.wpcc-open .wpcc-category-icon { transform: rotate(90deg); }

.wpcc-category-name {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

.wpcc-category-count {
    font-size: 12px;
    color: var(--wpcc-text-muted);
    background: #e8eaed;
    padding: 1px 7px;
    border-radius: 10px;
}

.wpcc-always-active {
    font-size: 12px;
    color: #188038;
    font-weight: 500;
    padding: 0 4px;
}

/* Toggle switch */
.wpcc-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wpcc-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.wpcc-toggle input { opacity: 0; width: 0; height: 0; }

.wpcc-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--wpcc-toggle-off);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.wpcc-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    left: 3px;
    top: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.wpcc-toggle input:checked + .wpcc-toggle-slider { background: var(--wpcc-toggle-on); }
.wpcc-toggle input:checked + .wpcc-toggle-slider::before { transform: translateX(18px); }
.wpcc-toggle input:focus-visible + .wpcc-toggle-slider { outline: 3px solid var(--wpcc-focus); outline-offset: 2px; }
.wpcc-toggle input:disabled + .wpcc-toggle-slider { opacity: 0.6; cursor: not-allowed; }

/* Category body */
.wpcc-category-body {
    display: none;
    padding: 0 16px 14px;
}

.wpcc-category.wpcc-open .wpcc-category-body { display: block; }

.wpcc-category-desc {
    color: var(--wpcc-text-muted);
    font-size: 13px;
    margin: 8px 0 12px;
    line-height: 1.5;
}

/* Cookie table */
.wpcc-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.wpcc-cookie-table th,
.wpcc-cookie-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--wpcc-border);
    vertical-align: top;
}

.wpcc-cookie-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--wpcc-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.wpcc-cookie-table td { color: var(--wpcc-text); }
.wpcc-cookie-table tr:last-child td { border-bottom: none; }

/* ── CCPA Do Not Sell ── */
.wpcc-ccpa-section {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fef9e7;
    border: 1px solid #f9ca24;
    border-radius: var(--wpcc-radius);
    font-size: 13px;
}

.wpcc-ccpa-section a {
    color: var(--wpcc-primary);
    font-weight: 500;
}

/* ── Floating badge (re-open) ── */
#wpcc-badge {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: var(--wpcc-z-banner);
    background: var(--wpcc-bg);
    border: 1.5px solid var(--wpcc-border);
    border-radius: 50px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--wpcc-text);
    transition: box-shadow 0.15s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: none;
}

#wpcc-badge:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
#wpcc-badge[hidden] { display: none !important; }

.wpcc-badge-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--wpcc-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Animations ── */
@media (prefers-reduced-motion: no-preference) {
    #wpcc-banner { animation: wpcc-slide-up 0.25s ease; }

    @keyframes wpcc-slide-up {
        from { transform: translateY(20px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    #wpcc-modal { animation: wpcc-pop 0.2s ease; }

    @keyframes wpcc-pop {
        from { transform: translate(-50%, -48%); opacity: 0; }
        to   { transform: translate(-50%, -50%); opacity: 1; }
    }
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    :root {
        --wpcc-bg:         #2d2d2d;
        --wpcc-text:       #e8eaed;
        --wpcc-text-muted: #9aa0a6;
        --wpcc-border:     #3c4043;
    }

    .wpcc-category-header,
    .wpcc-cookie-table th { background: #3c4043; }

    .wpcc-modal-close:hover { background: #3c4043; }

    .wpcc-category-count { background: #3c4043; }

    .wpcc-ccpa-section { background: #3a3000; border-color: #856404; }
}

/* ── Mobile ── */
@media (max-width: 600px) {
    #wpcc-banner.wpcc-box { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
    .wpcc-modal-body { padding: 12px 16px; }
    .wpcc-modal-header, .wpcc-modal-footer { padding: 14px 16px; }
    .wpcc-cookie-table { display: block; overflow-x: auto; }
}
