/* ==========================================================================
   Board Settings Panel — Premium slide-in drawer
   Matches the reference project's dark-glass UI style.
   ========================================================================== */

/* ── Body lock when panel open ──────────────────────────────── */
.bsp-body-lock {
    overflow: hidden;
}

/* ── Panel Container ────────────────────────────────────────── */
.bsp {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.bsp--open {
    display: block;
}

/* ── Backdrop ───────────────────────────────────────────────── */
.bsp__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: bspFadeIn 0.2s ease;
}

/* ── Content Drawer ─────────────────────────────────────────── */
.bsp__content {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(360px, 88vw);
    background: linear-gradient(135deg,
        rgba(18, 16, 26, 0.97),
        rgba(28, 24, 40, 0.97));
    border-left: 1px solid rgba(212, 178, 106, 0.12);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.55);
    padding: 28px 22px;
    overflow-y: auto;
    animation: bspSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 178, 106, 0.25) transparent;
}

.bsp__content::-webkit-scrollbar { width: 5px; }
.bsp__content::-webkit-scrollbar-track { background: transparent; }
.bsp__content::-webkit-scrollbar-thumb {
    background: rgba(212, 178, 106, 0.25);
    border-radius: 4px;
}

/* ── Header ─────────────────────────────────────────────────── */
.bsp__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bsp__header h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #D4B26A;
    margin: 0;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.bsp__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.18s;
}

.bsp__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* ── Section ────────────────────────────────────────────────── */
.bsp__section {
    margin-bottom: 32px;
}

.bsp__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 14px;
}

/* ── Board Theme Swatches ───────────────────────────────────── */
.bsp__theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.bsp-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    background: none;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 10px 6px 8px;
    cursor: pointer;
    transition: all 0.22s ease;
}

.bsp-swatch:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.bsp-swatch.active {
    border-color: #D4B26A;
    background: rgba(212, 178, 106, 0.08);
    box-shadow: 0 0 16px rgba(212, 178, 106, 0.12);
}

.bsp-swatch__board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
}

.bsp-swatch:hover .bsp-swatch__board {
    transform: scale(1.05);
}

.bsp-swatch__board span {
    display: block;
}

.bsp-swatch__name {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.bsp-swatch.active .bsp-swatch__name {
    color: #D4B26A;
}

/* ── Piece Style Options ────────────────────────────────────── */
.bsp__piece-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 178, 106, 0.25) transparent;
}

.bsp__piece-grid::-webkit-scrollbar { width: 4px; }
.bsp__piece-grid::-webkit-scrollbar-track { background: transparent; }
.bsp__piece-grid::-webkit-scrollbar-thumb {
    background: rgba(212, 178, 106, 0.25);
    border-radius: 4px;
}

.bsp-piece-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 7px;
    border-radius: 9px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bsp-piece-opt:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.bsp-piece-opt.active {
    border-color: #D4B26A;
    background: rgba(212, 178, 106, 0.1);
    color: #D4B26A;
    box-shadow: 0 0 10px rgba(212, 178, 106, 0.08);
}

.bsp-piece-opt__check {
    display: none;
    font-size: 10px;
    color: #D4B26A;
    flex-shrink: 0;
}

.bsp-piece-opt.active .bsp-piece-opt__check {
    display: inline;
}

.bsp-piece-opt__preview {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.bsp-piece-opt__preview-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ── Gear Button Styling ────────────────────────────────────── */
.btn-board-settings {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    position: relative;
}

.btn-board-settings svg {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-board-settings:hover svg {
    transform: rotate(60deg);
}

.btn-board-settings__text {
    font-size: 0.8em;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes bspFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bspSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .bsp__content {
        width: 100vw;
        padding: 20px 16px;
    }

    .bsp__theme-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .bsp__piece-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bsp-swatch__board {
        width: 40px;
        height: 40px;
    }

    .btn-board-settings__text {
        display: none;
    }
}
