/* === Page Layout === */
body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

.ba-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* === Canvas Area === */
.ba-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #080808;
    min-height: 0;
    cursor: col-resize;
}

.ba-canvas-wrap[data-mode="overlay"] {
    cursor: default;
}

.ba-canvas-wrap[data-mode="curtain-v"] {
    cursor: row-resize;
}

#baCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ba-single-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #080808;
}

.ba-single-preview[hidden],
.ba-placeholder[hidden],
.ba-drag-hint[hidden] {
    display: none !important;
}

/* === Placeholder === */
.ba-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 15px;
    gap: 16px;
    pointer-events: none;
    text-align: center;
    padding: 24px;
}

.ba-placeholder svg {
    opacity: .35;
}

/* === Drag Hint === */
.ba-drag-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.6);
    color: rgba(255,255,255,.7);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* === Controls === */
.ba-controls {
    flex-shrink: 0;
    background: #181818;
    border-top: 1px solid #2a2a2a;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === Mode Tabs === */
.ba-modes {
    display: flex;
    gap: 6px;
}

.ba-mode-btn {
    flex: 1;
    padding: 8px 4px;
    background: #252525;
    border: 1px solid #383838;
    color: #999;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.2;
}

.ba-mode-btn:hover {
    background: #2e2e2e;
    color: #ccc;
}

.ba-mode-btn.active {
    background: rgba(79, 195, 247, .15);
    color: #4fc3f7;
    border-color: rgba(79, 195, 247, .4);
}

/* === Opacity Slider === */
.ba-opacity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #888;
}

.ba-opacity-row input[type="range"] {
    flex: 1;
    accent-color: #4fc3f7;
    height: 4px;
}

.ba-opacity-row span:last-child {
    min-width: 34px;
    text-align: right;
    color: #bbb;
}

/* === Top bar: pickers === */
.ba-topbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #181818;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

.ba-pick-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #383838;
    background: #252525;
    color: #e0e0e0;
    cursor: pointer;
    text-align: left;
    min-width: 0;
    transition: background .15s, border-color .15s;
}

.ba-pick-btn > svg { flex-shrink: 0; opacity: .6; }

.ba-pick-btn--before { border-color: rgba(79,195,247,.3); background: rgba(79,195,247,.07); }
.ba-pick-btn--before:hover { background: rgba(79,195,247,.13); }
.ba-pick-btn--after  { border-color: rgba(129,199,132,.3); background: rgba(129,199,132,.07); }
.ba-pick-btn--after:hover  { background: rgba(129,199,132,.13); }

.ba-pick-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.ba-pick-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1;
    opacity: .8;
}
.ba-pick-btn--before .ba-pick-label { color: #4fc3f7; }
.ba-pick-btn--after  .ba-pick-label { color: #81c784; }

.ba-pick-fname {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ba-pick-fname:empty::before { content: '—'; opacity: .35; }

/* === Animation Settings Grid === */
.ba-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 12px;
}

.ba-setting {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.ba-setting-label {
    font-size: 11px;
    color: #777;
    flex-shrink: 0;
    min-width: 28px;
}

.ba-setting input[type="range"] {
    flex: 1;
    accent-color: #4fc3f7;
    min-width: 0;
}

.ba-setting-val {
    font-size: 11px;
    color: #bbb;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* === Segmented button groups === */
.ba-btn-group { display: flex; gap: 2px; }

.ba-seg-btn {
    padding: 3px 8px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    transition: background .12s, color .12s;
}
.ba-seg-btn:hover { background: #2e2e2e; color: #ccc; }
.ba-seg-btn.active {
    background: rgba(79,195,247,.18);
    color: #4fc3f7;
    border-color: rgba(79,195,247,.4);
}

.ba-loop-custom {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #888;
    border-radius: 6px;
    transition: background .12s, color .12s, border-color .12s;
}

.ba-loop-custom.active {
    background: rgba(79,195,247,.18);
    color: #4fc3f7;
    border-color: rgba(79,195,247,.45);
}

.ba-loop-custom__btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background: rgba(255,255,255,.06);
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
    transition: background .12s, color .12s, opacity .12s;
}

.ba-loop-custom__btn:hover:not(:disabled) {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.ba-loop-custom__btn:disabled {
    opacity: .35;
    cursor: default;
}

.ba-loop-custom__value {
    min-width: 30px;
    text-align: center;
    color: inherit;
    line-height: 1.4;
}

/* === Export Row === */
.ba-export-row { display: flex; gap: 8px; }

.ba-export-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 14px;
    border: 1px solid #383838;
    border-radius: 8px;
    background: #252525;
    color: #ccc;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.ba-export-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.ba-export-btn:disabled {
    opacity: .35;
    cursor: default;
}

.ba-export-btn:not(:disabled):hover {
    background: #2e2e2e;
    color: #fff;
}

.ba-export-btn--active {
    background: rgba(79, 195, 247, .15);
    color: #4fc3f7;
    border-color: rgba(79, 195, 247, .4);
}

/* === Export Loading Overlay === */
.ba-export-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.ba-export-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: ba-spin .7s linear infinite;
}

@keyframes ba-spin {
    to { transform: rotate(360deg); }
}

.ba-export-msg {
    font-size: 15px;
    color: #ccc;
}

/* === Responsive === */
@media (max-width: 360px) {
    .ba-mode-btn {
        font-size: 11px;
        padding: 7px 2px;
    }
}

/* === Three-panel layout === */
.ba-panels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    overflow-x: auto;
}

.ba-panel {
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    padding: 8px 9px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 100px;
}

.ba-panel__title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #555;
    padding-bottom: 5px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

/* Export panel: push button to bottom */
.ba-panel--export {
    justify-content: flex-start;
}

.ba-panel--export .ba-export-btn--full {
    margin-top: auto;
    width: 100%;
}

/* === Text overlay input === */
.ba-text-input {
    width: 100%;
    box-sizing: border-box;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    outline: none;
}

.ba-text-input:focus {
    border-color: rgba(79,195,247,.45);
    background: #282828;
}

.ba-text-input::placeholder { color: #555; }

/* Setting row: label + control stacked vertically */
.ba-setting--col {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ba-setting--col .ba-setting-label { min-width: unset; }

/* === Position picker (2×2 grid) === */
.ba-pos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.ba-pos-btn {
    padding: 3px 5px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #888;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    transition: background .12s, color .12s;
}

.ba-pos-btn:hover { background: #2e2e2e; color: #ccc; }

.ba-pos-btn.active {
    background: rgba(79,195,247,.18);
    color: #4fc3f7;
    border-color: rgba(79,195,247,.4);
}

/* === Logo pick button === */
.ba-pick-logo-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    min-width: 0;
    transition: background .12s, color .12s, border-color .12s;
    text-align: left;
}

.ba-pick-logo-btn > svg { flex-shrink: 0; }

.ba-pick-logo-btn > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ba-pick-logo-btn:hover { background: #2e2e2e; color: #ccc; }

.ba-pick-logo-btn.has-logo {
    border-color: rgba(79,195,247,.35);
    color: #4fc3f7;
}

/* === Small icon button (clear etc.) === */
.ba-icon-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.05);
    border: 1px solid #3a3a3a;
    color: #888;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    transition: background .12s, color .12s, border-color .12s;
}

.ba-icon-btn:hover {
    background: rgba(255,90,90,.15);
    color: #f88;
    border-color: rgba(255,90,90,.3);
}

/* Format label badge */
.ba-format-label {
    font-size: 11px;
    color: #4fc3f7;
    padding: 2px 8px;
    background: rgba(79,195,247,.1);
    border: 1px solid rgba(79,195,247,.25);
    border-radius: 5px;
    font-weight: 600;
    letter-spacing: .04em;
    white-space: nowrap;
}

.ba-format-label--mp4 {
    color: #81c784;
    background: rgba(129,199,132,.12);
    border-color: rgba(129,199,132,.3);
}
