/* Ambitive Cookiebanner - Frontend Styles */

#zhh-cookie-banner {
    --zhh-bg: #ffffff;
    --zhh-text: #111827;
    --zhh-accent: #166B46;
    --zhh-radius: 12px;
    --zhh-font-size: 15px;
    --zhh-btn-accept-bg: #166B46;
    --zhh-btn-accept-text: #ffffff;
    --zhh-btn-reject-bg: #f5f5f3;
    --zhh-btn-reject-text: #111827;
    --zhh-btn-custom-bg: #ffffff;
    --zhh-btn-custom-text: #111827;
}

/* ── Overlay ── */
.zhh-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.zhh-overlay--visible { opacity: 0.4 !important; pointer-events: all; }

/* ── Banner Base ── */
#zhh-cookie-banner {
    position: fixed;
    z-index: 99999;
    background: var(--zhh-bg) !important;
    color: var(--zhh-text) !important;
    font-size: var(--zhh-font-size);
    font-family: inherit;
    line-height: 1.6;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.35s ease;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#zhh-cookie-banner.zhh-banner--visible { opacity: 1; }

/* ── Positions ── */
.zhh-banner--bottom {
    bottom: 0; left: 0; right: 0;
    border-radius: var(--zhh-radius) var(--zhh-radius) 0 0;
    transform: translateY(100%);
}
.zhh-banner--bottom.zhh-banner--visible { transform: translateY(0); }

.zhh-banner--top {
    top: 0; left: 0; right: 0;
    border-radius: 0 0 var(--zhh-radius) var(--zhh-radius);
    transform: translateY(-100%);
}
.zhh-banner--top.zhh-banner--visible { transform: translateY(0); }

.zhh-banner--center {
    top: 50%; left: 50%;
    transform: translate(-50%, -55%);
    border-radius: var(--zhh-radius);
    width: min(600px, 94vw);
    max-height: 85vh;
}
.zhh-banner--center.zhh-banner--visible { transform: translate(-50%, -50%); }

/* ── Layout Variants ── */
.zhh-banner--bar .zhh-banner__main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 20px 28px;
}
.zhh-banner--box {
    bottom: 24px; left: 24px; right: auto;
    width: min(380px, calc(100vw - 48px));
    border-radius: var(--zhh-radius);
    transform: translateY(20px);
}
.zhh-banner--box.zhh-banner--visible { transform: translateY(0); }
.zhh-banner--box .zhh-banner__main { padding: 24px; }
.zhh-banner--modal .zhh-banner__main { padding: 32px; }

/* ── Content ── */
.zhh-banner__title {
    font-size: calc(var(--zhh-font-size) + 3px);
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--zhh-text);
    letter-spacing: -0.3px;
    line-height: 1.3;
}
.zhh-banner__text { margin: 0 0 12px; opacity: 0.8; }
.zhh-banner__links { display: flex; gap: 16px; flex-wrap: wrap; }
.zhh-banner__links a { color: var(--zhh-accent); font-size: 13px; text-decoration: none; }
.zhh-banner__links a:hover { text-decoration: underline; }

/* ── Actions ── */
.zhh-banner__actions { display: flex; flex-direction: column; gap: 8px; min-width: 190px; flex-shrink: 0; }
.zhh-banner__actions--detail { flex-direction: row; flex-wrap: wrap; margin-top: 20px; min-width: 0; }

/* ── Buttons ── */
#zhh-cookie-banner .zhh-btn {
    padding: 11px 20px;
    border-radius: calc(var(--zhh-radius) - 4px);
    font-size: var(--zhh-font-size);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, transform 0.1s;
    text-align: center;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.2;
}
#zhh-cookie-banner .zhh-btn:hover { opacity: 0.88; transform: translateY(-1px); }
#zhh-cookie-banner .zhh-btn:active { transform: translateY(0); }
#zhh-cookie-banner .zhh-btn--accept { background: var(--zhh-btn-accept-bg) !important; color: var(--zhh-btn-accept-text) !important; }
#zhh-cookie-banner .zhh-btn--reject { background: var(--zhh-btn-reject-bg) !important; color: var(--zhh-btn-reject-text) !important; border: 1px solid rgba(0,0,0,0.1) !important; }
#zhh-cookie-banner .zhh-btn--custom { background: var(--zhh-btn-custom-bg) !important; color: var(--zhh-btn-custom-text) !important; border: 1px solid rgba(0,0,0,0.15) !important; }
#zhh-cookie-banner #zhh-cookie-banner .zhh-btn--save { background: var(--zhh-accent) !important; color: #fff !important; }

/* ── Detail View ── */
.zhh-banner__detail { padding: 24px 28px; }
.zhh-banner__detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; }
.zhh-banner__detail-header .zhh-banner__title { margin: 0; }
#zhh-cookie-banner .zhh-btn-back { background: none; border: none; color: var(--zhh-accent); cursor: pointer; font-size: 13px; font-weight: 600; padding: 0; font-family: inherit; white-space: nowrap; }

/* ── Categories ── */
.zhh-categories { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.zhh-category { border: 1px solid rgba(0,0,0,0.08); border-radius: calc(var(--zhh-radius) - 4px); background: rgba(0,0,0,0.015); }
.zhh-category__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 16px; }
.zhh-category__info { flex: 1; min-width: 0; }
.zhh-category__name { font-weight: 700; font-size: var(--zhh-font-size); display: block; margin-bottom: 4px; }
.zhh-category__desc { margin: 0; font-size: 12px; opacity: 0.65; line-height: 1.5; }

/* ── Toggle Switch ── */
#zhh-cookie-banner .zhh-toggle { position: relative; display: flex; align-items: center; gap: 8px; flex-shrink: 0; cursor: pointer; }
#zhh-cookie-banner .zhh-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
#zhh-cookie-banner .zhh-toggle__slider {
    position: relative; width: 44px; height: 24px;
    background: #d1d5db; border-radius: 12px;
    transition: background 0.2s; flex-shrink: 0;
}
#zhh-cookie-banner .zhh-toggle__slider::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; background: white; border-radius: 50%;
    transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
#zhh-cookie-banner .zhh-toggle input:checked ~ .zhh-toggle__slider { background: var(--zhh-accent) !important; }
#zhh-cookie-banner .zhh-toggle input:checked ~ .zhh-toggle__slider::after { transform: translateX(20px); }
#zhh-cookie-banner .zhh-toggle input:checked + .zhh-toggle__slider { background: var(--zhh-accent) !important; }
#zhh-cookie-banner .zhh-toggle input:checked + .zhh-toggle__slider::after { transform: translateX(20px); }
#zhh-cookie-banner .zhh-toggle--disabled { cursor: not-allowed; opacity: 0.7; }
#zhh-cookie-banner .zhh-toggle__required { font-size: 11px; color: var(--zhh-accent); font-weight: 600; white-space: nowrap; }

/* ── Cookie Icon Button ── */
#zhh-footer-link {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

#zhh-footer-link .zhh-cookie-icon-btn {
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: var(--zhh-bg, #ffffff) !important;
    color: var(--zhh-accent, #166B46) !important;
    border: 1.5px solid rgba(0,0,0,0.12) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.1) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: box-shadow 0.2s, transform 0.15s;
    padding: 0 !important;
    font-family: inherit !important;
    flex-shrink: 0 !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
#zhh-footer-link .zhh-cookie-icon-btn:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transform: scale(1.08);
}
#zhh-footer-link .zhh-cookie-icon-btn:active { transform: scale(0.96); }
#zhh-footer-link .zhh-cookie-icon-btn svg { display: block; flex-shrink: 0; }

/* ── Blocked Content Placeholder ── */
.zhh-blocked-content {
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding: 32px 24px;
    text-align: center;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.zhh-blocked-content p { margin: 0; font-family: inherit; }
.zhh-blocked-content button { border: none; padding: 8px 20px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ── Responsive Mobile ── */
@media (max-width: 767px) {
    /* Bar layout stacks on mobile */
    .zhh-banner--bar .zhh-banner__main {
        grid-template-columns: 1fr !important;
        gap: 16px;
        padding: 20px 18px;
    }

    /* Actions full width on mobile */
    .zhh-banner__actions {
        flex-direction: column;
        min-width: 0;
        width: 100%;
    }
    .zhh-banner__actions--detail {
        flex-direction: column;
    }
    #zhh-cookie-banner .zhh-btn { width: 100%; }

    /* Box repositions */
    .zhh-banner--box {
        left: 12px; right: 12px; bottom: 12px;
        width: auto !important;
    }
    .zhh-banner--center {
        width: calc(100vw - 24px);
        max-height: 88vh;
    }

    /* Detail view padding */
    .zhh-banner__detail { padding: 18px; }
    .zhh-banner__detail-header { flex-wrap: wrap; }

    /* Categories */
    .zhh-category__header { flex-wrap: wrap; gap: 10px; }

    /* Cookie icon button - always visible, slightly smaller */
    #zhh-footer-link {
        bottom: 16px !important;
        left: 16px !important;
    }
    #zhh-footer-link .zhh-cookie-icon-btn {
        width: 42px;
        height: 42px;
    }

    /* Title smaller */
    .zhh-banner__title { font-size: calc(var(--zhh-font-size) + 1px) !important; }
}

@media (max-width: 400px) {
    .zhh-banner--bar .zhh-banner__main { padding: 16px 14px; }
    .zhh-banner__detail { padding: 14px; }
}
