/*!
 * Cookie Bubble Pro - Frontend Stilleri
 * Hafif (~6KB minified hedefi) | Modern | Erişilebilir
 */

/* Root container - başlangıçta gizli */
#cbp-root {
    position: fixed;
    z-index: 999999; /* Yüksek z-index, ama sticky elementlerin üstünde */
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cbp-text);
    -webkit-font-smoothing: antialiased;
}

#cbp-root * {
    box-sizing: border-box;
}

#cbp-root.cbp-active {
    pointer-events: none; /* root pasif, çocuklar aktif */
}

/* ============== BANNER (Baloncuk) ============== */

.cbp-banner {
    position: fixed;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--cbp-bg);
    color: var(--cbp-text);
    border-radius: var(--cbp-radius);
    box-shadow: var(--cbp-shadow);
    border: 1px solid var(--cbp-border);
    padding: 22px 22px 20px 22px;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    bottom: var(--cbp-offset-bottom);
}

/* Pozisyon - Sol Alt (varsayılan) */
.cbp-pos-bottom-left .cbp-banner {
    left: var(--cbp-offset-side);
}

.cbp-pos-bottom-left .cbp-banner::after {
    /* Konuşma baloncuğu kuyruğu - sol alt */
    content: '';
    position: absolute;
    left: 28px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: var(--cbp-bg);
    border-right: 1px solid var(--cbp-border);
    border-bottom: 1px solid var(--cbp-border);
    transform: rotate(45deg);
}

/* Pozisyon - Sağ Alt */
.cbp-pos-bottom-right .cbp-banner {
    right: var(--cbp-offset-side);
}

.cbp-pos-bottom-right .cbp-banner::after {
    content: '';
    position: absolute;
    right: 28px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: var(--cbp-bg);
    border-right: 1px solid var(--cbp-border);
    border-bottom: 1px solid var(--cbp-border);
    transform: rotate(45deg);
}

/* Görünür durum */
#cbp-root.cbp-show-banner .cbp-banner {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Animasyon varyasyonları */
.cbp-anim-slide-up .cbp-banner { transform: translateY(20px) scale(0.96); }
.cbp-anim-fade .cbp-banner { transform: scale(0.97); }
.cbp-anim-bounce .cbp-banner { transform: translateY(40px) scale(0.9); transition: opacity 0.3s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Banner içerik */
.cbp-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cbp-primary);
    color: var(--cbp-primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.cbp-banner-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--cbp-text);
    opacity: 0.5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.15s, background 0.15s;
}

.cbp-banner-close:hover {
    opacity: 1;
    background: var(--cbp-secondary);
}

.cbp-banner-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--cbp-text);
    line-height: 1.3;
    padding-right: 28px; /* close butonu için yer */
}

.cbp-banner-message {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--cbp-text);
    opacity: 0.85;
    line-height: 1.55;
}

.cbp-banner-links {
    margin: 0 0 14px 0;
    font-size: 12px;
}

.cbp-banner-links a {
    color: var(--cbp-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.cbp-banner-links a:hover {
    text-decoration-thickness: 2px;
}

/* Butonlar */
.cbp-banner-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.cbp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s, border-color 0.15s;
    text-align: center;
    width: 100%;
}

.cbp-btn:active { transform: scale(0.98); }

/* Eşit görsel ağırlık (GDPR dark pattern önleme) */
.cbp-btn-primary {
    background: var(--cbp-primary);
    color: var(--cbp-primary-text);
    border-color: var(--cbp-primary);
}

.cbp-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    filter: brightness(1.05);
}

.cbp-btn-secondary {
    background: var(--cbp-secondary);
    color: var(--cbp-secondary-text);
    border-color: var(--cbp-border);
}

.cbp-btn-secondary:hover {
    background: var(--cbp-bg);
    border-color: var(--cbp-secondary-text);
}

.cbp-btn-link {
    background: transparent;
    color: var(--cbp-text);
    border: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 6px 16px;
    font-weight: 500;
    opacity: 0.75;
    width: 100%;
}

.cbp-btn-link:hover {
    opacity: 1;
}

/* ============== TERCİHLER PANELİ ============== */

.cbp-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--cbp-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: auto;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#cbp-root.cbp-show-prefs .cbp-overlay {
    opacity: 1;
    visibility: visible;
}

.cbp-preferences {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 540px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 60px);
    background: var(--cbp-bg);
    color: var(--cbp-text);
    border-radius: var(--cbp-radius);
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    border: 1px solid var(--cbp-border);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.94);
    transition: opacity 0.3s, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
    pointer-events: auto;
    overflow: hidden;
}

#cbp-root.cbp-show-prefs .cbp-preferences {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.cbp-prefs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--cbp-border);
    flex-shrink: 0;
}

.cbp-prefs-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.cbp-prefs-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--cbp-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
}

.cbp-prefs-close:hover {
    opacity: 1;
    background: var(--cbp-secondary);
}

.cbp-prefs-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
}

.cbp-prefs-intro {
    margin: 0 0 18px 0;
    font-size: 13px;
    color: var(--cbp-text);
    opacity: 0.8;
    line-height: 1.55;
}

/* Kategoriler */
.cbp-category {
    border: 1px solid var(--cbp-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}

.cbp-category:hover {
    border-color: var(--cbp-text);
}

.cbp-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.cbp-category-title {
    font-size: 14.5px;
    font-weight: 600;
}

.cbp-category-badge {
    background: var(--cbp-secondary);
    color: var(--cbp-secondary-text);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cbp-category-desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--cbp-text);
    opacity: 0.75;
}

/* Toggle Switch */
.cbp-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.cbp-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cbp-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: background 0.2s;
}

.cbp-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.cbp-switch input:checked + .cbp-slider {
    background: var(--cbp-primary);
}

.cbp-switch input:checked + .cbp-slider::before {
    transform: translateX(18px);
}

.cbp-switch input:focus-visible + .cbp-slider {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Footer */
.cbp-prefs-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 22px;
    border-top: 1px solid var(--cbp-border);
    background: var(--cbp-secondary);
    flex-shrink: 0;
}

.cbp-prefs-footer .cbp-btn {
    flex: 1;
    min-width: 120px;
    width: auto;
}

/* ============== DİKEY BAR (Tekrar açma) ============== */
/* v1.0.3: Sol/sağ kenarda dikey ince bar - sticky butonlarla çakışmaz */

.cbp-floating-icon {
    position: fixed;
    width: 32px;
    min-height: 110px;
    padding: 12px 6px;
    border-radius: 0;
    background: var(--cbp-bubble-bg);
    color: var(--cbp-bubble-icon);
    border: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transition: transform 0.25s ease, box-shadow 0.25s, opacity 0.3s, width 0.25s ease;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    /* Dikey ortalama - sticky bar'larla çakışmaz çünkü ekran ortasında */
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    z-index: 999998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.2;
}

.cbp-floating-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cbp-floating-icon .cbp-bar-label {
    /* Dikey yazı - alttan üste oku */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    user-select: none;
}

/* Sol pozisyon - sol kenara yapışık, sağ köşeleri yuvarlak */
.cbp-pos-bottom-left .cbp-floating-icon {
    left: 0;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-left: 0;
}

/* Sağ pozisyon - sağ kenara yapışık, sol köşeleri yuvarlak */
.cbp-pos-bottom-right .cbp-floating-icon {
    right: 0;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-right: 0;
}

#cbp-root.cbp-show-icon .cbp-floating-icon {
    opacity: 0.95;
    visibility: visible;
}

.cbp-floating-icon:hover {
    width: 38px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.28);
    opacity: 1 !important;
}

.cbp-floating-icon:focus-visible {
    outline: 3px solid var(--cbp-primary);
    outline-offset: 3px;
}

/* ============== STICKY FOOTER ÇAKIŞMA ÖNLEME ============== */
/* Banner için offset uygulanır. İkon artık ekranın ortasında olduğu için 
   alttaki sticky bar'larla doğal olarak çakışmaz, JS müdahalesine gerek yok. */

#cbp-root.cbp-sticky-detected .cbp-banner {
    bottom: calc(var(--cbp-offset-bottom) + var(--cbp-sticky-offset, 0px));
}

/* ============== MOBİL UYUMLULUK ============== */

@media (max-width: 480px) {
    .cbp-banner {
        width: calc(100vw - 24px);
        left: 12px !important;
        right: 12px !important;
        padding: 18px 18px 16px 18px;
    }

    .cbp-pos-bottom-left .cbp-banner::after,
    .cbp-pos-bottom-right .cbp-banner::after {
        display: none; /* mobilde kuyruğu gizle */
    }

    .cbp-banner-buttons {
        gap: 6px;
    }

    .cbp-btn {
        padding: 11px 14px;
        font-size: 13px;
    }

    .cbp-preferences {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 40px);
        border-radius: 14px;
    }

    .cbp-prefs-header,
    .cbp-prefs-body,
    .cbp-prefs-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .cbp-prefs-footer {
        flex-direction: column;
    }

    .cbp-prefs-footer .cbp-btn {
        width: 100%;
        min-width: 0;
    }

    .cbp-floating-icon {
        width: 28px;
        min-height: 90px;
        padding: 10px 4px;
        font-size: 10px;
    }

    .cbp-floating-icon svg {
        width: 16px;
        height: 16px;
    }

    .cbp-floating-icon:hover {
        width: 34px;
    }
}

/* ============== ERİŞİLEBİLİRLİK ============== */

@media (prefers-reduced-motion: reduce) {
    .cbp-banner,
    .cbp-preferences,
    .cbp-overlay,
    .cbp-floating-icon,
    .cbp-slider,
    .cbp-slider::before {
        transition: opacity 0.1s linear, visibility 0.1s linear !important;
        transform: none !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Otomatik koyu tema desteği - admin'de geçersiz kılınmadıysa */
    #cbp-root[data-auto-dark="1"] .cbp-banner,
    #cbp-root[data-auto-dark="1"] .cbp-preferences {
        --cbp-bg: #1f2937;
        --cbp-text: #f3f4f6;
        --cbp-border: #374151;
        --cbp-secondary: #374151;
        --cbp-secondary-text: #f3f4f6;
    }
}

.cbp-btn:focus-visible,
.cbp-banner-close:focus-visible,
.cbp-prefs-close:focus-visible {
    outline: 2px solid var(--cbp-primary);
    outline-offset: 2px;
}
