/* ===========================================
   BA.UI - Panel
   =========================================== */

/* -------------------------------------------
   Backdrop
------------------------------------------- */

.ba-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: transparent;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}

.ba-panel-backdrop.is-open {
    visibility: visible;
}

/* -------------------------------------------
   Panel
------------------------------------------- */

.ba-panel {
    position: fixed;
    z-index: 1050;
    top: 0; /* JS override eder */
    left: 0; /* JS override eder */
    width: 420px;
    max-height: calc(100vh - 80px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

    .ba-panel.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }


    /* -------------------------------------------
   Placement arrow (ok işareti, isteğe bağlı)
------------------------------------------- */

    .ba-panel::before {
        content: '';
        position: absolute;
        top: -7px;
        right: var(--ba-panel-arrow-right, 18px); /* JS set eder */
        width: 14px;
        height: 14px;
        background: #fff;
        border-radius: 3px 0 0 0;
        transform: rotate(45deg);
        box-shadow: -2px -2px 5px rgba(0,0,0,.06);
    }

    /* Arrow pozisyonu — placement'a göre */
    .ba-panel[data-arrow-align="left"]::before {
        right: auto;
        left: 18px;
    }

    .ba-panel[data-arrow-align="center"]::before {
        right: auto;
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }

/* -------------------------------------------
   Header
------------------------------------------- */

.ba-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    flex-shrink: 0;
    border-bottom: 1px solid #F0F0F0;
}

.ba-panel__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1A1A1A;
}

.ba-panel__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6B7280;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    flex-shrink: 0;
}

    .ba-panel__close:hover {
        background: #F5F6F8;
        color: #1A1A1A;
    }

    .ba-panel__close .ba-icon {
        width: 17px;
        height: 17px;
    }

/* -------------------------------------------
   Body
------------------------------------------- */

.ba-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    overscroll-behavior: contain;
}

/* Scrollbar */
    .ba-panel__body::-webkit-scrollbar {
        width: 4px;
    }

    .ba-panel__body::-webkit-scrollbar-track {
        background: transparent;
    }

    .ba-panel__body::-webkit-scrollbar-thumb {
        background: #E0E0E0;
        border-radius: 4px;
    }

/* -------------------------------------------
   Footer
------------------------------------------- */

.ba-panel__footer {
    flex-shrink: 0;
    padding: 14px 20px 18px;
    border-top: 1px solid #F0F0F0;
}

/* -------------------------------------------
   Responsive
------------------------------------------- */

@media (max-width: 576px) {

    .ba-panel {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(16px);
    }

        .ba-panel.is-open {
            transform: translateY(0);
        }

        .ba-panel::before {
            display: none;
        }

    .ba-panel-backdrop {
        background: rgba(0, 0, 0, 0.32);
    }

        .ba-panel-backdrop.is-open {
            visibility: visible;
        }
}

/* -------------------------------------------
   Panel Inner Components
------------------------------------------- */

.ba-panel__section {
    padding: 4px 0;
}

.ba-panel__divider {
    height: 1px;
    background: #F0F0F0;
    margin: 12px 0;
}

/* Row — label + switch */
.ba-panel__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

.ba-panel__row-label {
    font-size: 15px;
    font-weight: 500;
    color: #1A1A1A;
}

/* Sub section (widget selects) */
.ba-panel__sub {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ba-panel__hint {
    font-size: 12px;
    color: #6B7280;
    margin: 0 0 8px;
    line-height: 1.5;
}

/* Field — label + input */
.ba-panel__field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
}

.ba-panel__label {
    font-size: 15px;
    color: #1A1A1A;
    flex: 1;
}

.ba-panel__input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #E0E0E0;
    border-radius: 10px;
    overflow: hidden;
    width: 120px;
    flex-shrink: 0;
    transition: border-color .15s ease;
}

    .ba-panel__input-wrap:focus-within {
        border-color: var(--ba-primary, #304FFE);
    }

.ba-panel__input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 10px 10px;
    font-size: 15px;
    font-weight: 500;
    color: #1A1A1A;
    background: transparent;
    text-align: right;
}

.ba-panel__input-addon {
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    background: #F5F6F8;
    align-self: stretch;
    display: flex;
    align-items: center;
}

/* Select */
.ba-panel__select {
    width: 100% !important;
}

/* Radio */
.ba-panel__radio-group {
    display: flex;
    gap: 24px;
}

.ba-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ba-radio__input {
    display: none;
}

.ba-radio__indicator {
    width: 18px;
    height: 18px;
    border: 2px solid #D0D0D0;
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color .15s ease;
    position: relative;
}

    .ba-radio__indicator::after {
        content: '';
        position: absolute;
        inset: 3px;
        border-radius: 50%;
        background: var(--ba-primary, #304FFE);
        opacity: 0;
        transition: opacity .15s ease;
    }

.ba-radio__input:checked + .ba-radio__indicator {
    border-color: var(--ba-primary, #304FFE);
}

    .ba-radio__input:checked + .ba-radio__indicator::after {
        opacity: 1;
    }

.ba-radio__label {
    font-size: 15px;
    color: #1A1A1A;
}

/* Switch */
.ba-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.ba-switch__input {
    display: none;
}

.ba-switch__track {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #D0D0D0;
    position: relative;
    transition: background .18s ease;
}

    .ba-switch__track::after {
        content: '';
        position: absolute;
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0,0,0,.2);
        transition: transform .18s ease;
    }

.ba-switch__input:checked + .ba-switch__track {
    background: var(--ba-primary, #304FFE);
}

    .ba-switch__input:checked + .ba-switch__track::after {
        transform: translateX(20px);
    }

/* Save button */
.ba-panel__save {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: var(--ba-control-radius, 999px);
    background: #1A1A1A;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}

    .ba-panel__save:hover {
        background: #333;
    }

    .ba-panel__save:disabled {
        opacity: .5;
        cursor: not-allowed;
    }