/* Kapsayıcı: sadece içindeki widgetlar tıklanabilir */
.wbc-wrapper {
    --wbc-panel-width: min(330px, calc(100vw - 32px));
    --wbc-panel-height: min(365px, calc(100vh - 140px));
    position: fixed;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    pointer-events: none;
}

.wbc-wrapper,
.wbc-wrapper * {
    box-sizing: border-box;
}

/* Tema stillerinin buton ve linkleri bozmasını engelle */
.wbc-wrapper button {
    margin: 0;
    padding: 0;
    min-height: 0;
    border: 0;
    outline: none;
    font: inherit;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

/* Fare tıklamasında çerçeve yok, klavyeyle gezinirken odak halkası görünür */
.wbc-wrapper button:focus {
    outline: none;
}

.wbc-wrapper button:focus-visible,
.wbc-wrapper .wbc-branch:focus-visible {
    outline: 2px solid var(--wbc-color);
    outline-offset: 3px;
}

.wbc-wrapper a {
    -webkit-tap-highlight-color: transparent;
}

.wbc-wrapper a,
.wbc-wrapper a:hover,
.wbc-wrapper a:focus {
    text-decoration: none;
}

/* Pozisyon */
.wbc-pos-right {
    --wbc-dir: 1;
    --wbc-origin-x: right;
    right: var(--wbc-offset-x, 24px);
    align-items: flex-end;
}

.wbc-pos-left {
    --wbc-dir: -1;
    --wbc-origin-x: left;
    left: var(--wbc-offset-x, 24px);
    align-items: flex-start;
}

.wbc-pos-bottom {
    --wbc-origin-y: bottom;
    bottom: var(--wbc-offset-y, 24px);
}

.wbc-pos-top {
    --wbc-origin-y: top;
    top: var(--wbc-offset-y, 24px);
}

.wbc-item {
    position: relative;
    display: flex;
}

/* Widget kutusu: kapalıyken yuvarlak buton, açıkken sohbet penceresi */
.wbc-widget {
    pointer-events: auto;
    position: relative;
    z-index: 1;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    /* Kapalıyken arka plan butonun rengi: beyaz olursa kenarda ince beyaz halka görünür */
    background: var(--wbc-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform-origin: var(--wbc-origin-y) var(--wbc-origin-x);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.2s ease,
                transform 0.3s ease;
}

.wbc-item:not(.is-open) .wbc-widget:hover {
    transform: scale(1.07);
}

.wbc-item.is-open .wbc-widget {
    width: var(--wbc-panel-width);
    height: var(--wbc-panel-height);
    border-radius: 20px;
    background: #f8fafc;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.28), 0 10px 15px -5px rgba(0, 0, 0, 0.12);
}

/* Yuvarlak tetikleyici buton */
.wbc-wrapper .wbc-trigger {
    position: absolute;
    z-index: 2;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wbc-icon-color);
    background: var(--wbc-color);
    background: linear-gradient(135deg, var(--wbc-color) 0%, color-mix(in srgb, var(--wbc-color) 75%, #000) 100%);
    transition: opacity 0.25s ease, transform 0.3s ease;
}

.wbc-pos-right .wbc-trigger { right: 0; }
.wbc-pos-left .wbc-trigger { left: 0; }
.wbc-pos-bottom .wbc-trigger { bottom: 0; }
.wbc-pos-top .wbc-trigger { top: 0; }

.wbc-trigger svg {
    width: var(--wbc-icon-size);
    height: var(--wbc-icon-size);
}

.wbc-item.is-open .wbc-trigger {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6) rotate(45deg);
}

/* Nabız halkası (widget dışında, kesilmesin diye item üzerinde) */
.wbc-anim-pulse .wbc-item::before {
    content: '';
    position: absolute;
    z-index: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wbc-color);
    opacity: 0;
    pointer-events: none;
    animation: wbcPulse 2.2s ease-out infinite;
}

.wbc-pos-right .wbc-item::before { right: 0; }
.wbc-pos-left .wbc-item::before { left: 0; }
.wbc-pos-bottom .wbc-item::before { bottom: 0; }
.wbc-pos-top .wbc-item::before { top: 0; }

.wbc-anim-pulse .wbc-item.is-open::before {
    display: none;
}

/* Halka butonun boyundan başlayıp dışa doğru büyüyerek kaybolur */
@keyframes wbcPulse {
    0% { transform: scale(1); opacity: 0.5; }
    75% { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}

/* Zıplama animasyonu */
.wbc-anim-bounce .wbc-item:not(.is-open) .wbc-widget {
    animation: wbcBounce 1.2s infinite;
}

@keyframes wbcBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Sohbet penceresi */
.wbc-window {
    display: flex;
    flex-direction: column;
    width: var(--wbc-panel-width);
    height: 100%;
    background: #f8fafc;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease 0.1s;
}

.wbc-item.is-open .wbc-window {
    opacity: 1;
    pointer-events: auto;
}

.wbc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    color: var(--wbc-icon-color);
    background: var(--wbc-header-color);
    background: linear-gradient(135deg, var(--wbc-header-color) 0%, color-mix(in srgb, var(--wbc-header-color) 70%, #000) 100%);
}

.wbc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wbc-header-icon {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
}

.wbc-online-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid #ffffff;
}

.wbc-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wbc-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.wbc-subtitle {
    margin-top: 3px;
    font-size: 12px;
    opacity: 0.88;
}

.wbc-wrapper .wbc-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease, transform 0.2s ease;
}

.wbc-wrapper .wbc-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.wbc-welcome {
    margin: 12px 14px 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 12px 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    font-size: 12.5px;
    color: #475569;
}

/* Şube listesi */
.wbc-branch-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 14px 14px;
    overflow-y: auto;
}

.wbc-wrapper .wbc-branch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

/* Açılınca şubeler sırayla kayarak gelir (gecikme --wbc-i ile) */
.wbc-item.is-open .wbc-branch {
    animation: wbcSlideIn 0.35s ease backwards;
    animation-delay: calc(0.12s + var(--wbc-i, 0) * 0.07s);
}

@keyframes wbcSlideIn {
    from {
        opacity: 0;
        transform: translateX(calc(20px * var(--wbc-dir, 1)));
    }
}

.wbc-wrapper .wbc-branch:hover,
.wbc-wrapper .wbc-branch:focus-visible {
    border-color: var(--wbc-color);
    background: #f8fafc;
    background: color-mix(in srgb, var(--wbc-color) 6%, #fff);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--wbc-color) 14%, transparent);
    transform: translateX(calc(-4px * var(--wbc-dir, 1)));
}

.wbc-branch-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.wbc-branch-badge {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wbc-color);
    color: color-mix(in srgb, var(--wbc-color) 70%, #000);
    background: #f1f5f9;
    background: color-mix(in srgb, var(--wbc-color) 15%, #fff);
}

.wbc-branch-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wbc-branch-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
}

.wbc-branch-sub {
    margin-top: 1px;
    font-size: 11.5px;
    color: #64748b;
}

.wbc-branch-arrow {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
}

.wbc-branch:hover .wbc-branch-arrow {
    color: #0f172a;
    transform: translateX(3px);
}

/* Label: kapalı butonun karşı tarafında, hover'da görünür */
.wbc-label {
    position: absolute;
    z-index: 2;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    background: var(--wbc-label-bg);
    color: var(--wbc-label-text);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wbc-pos-bottom .wbc-label { bottom: 30px; translate: 0 50%; }
.wbc-pos-top .wbc-label { top: 30px; translate: 0 -50%; }
.wbc-pos-right .wbc-label { right: calc(100% + 10px); transform: translateX(10px); }
.wbc-pos-left .wbc-label { left: calc(100% + 10px); transform: translateX(-10px); }

.wbc-item:not(.is-open):hover .wbc-label {
    opacity: 1;
    transform: translateX(0);
}

/* Hareket azaltma tercihine saygı */
@media (prefers-reduced-motion: reduce) {
    .wbc-wrapper *,
    .wbc-wrapper *::before {
        animation: none !important;
        transition: none !important;
    }
}
