/* ============================================
   AURA CHESS — Professional Board Settings Modal
   Blueprint: High-Fidelity sectioned dark theme
   ============================================ */

/* ── Overlay and Main Container ── */
.bs-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
}

.bs-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bs-modal {
    width: 100%;
    max-width: 480px;
    background: #111016;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Cairo', sans-serif;
}

.bs-modal-overlay.active .bs-modal {
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.bs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bs-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bs-title-group i {
    font-size: 20px;
    color: #a855f7;
}

.bs-title-group h2 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.bs-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bs-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ── Section Wrapper ── */
.bs-content {
    padding: 0 28px 28px;
    max-height: 80vh;
    overflow-y: auto;
}

.bs-section {
    margin-top: 24px;
}

.bs-section-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.bs-section-header i {
    font-size: 14px;
    color: #a855f7;
}

.bs-section-header span {
    font-size: 13px;
    font-weight: 700;
    color: #a855f7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Section 1: Sounds ── */
.bs-option-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bs-label {
    font-size: 14px;
    font-weight: 700;
    color: #cbd5e1;
}

.bs-toggle {
    position: relative;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.bs-toggle input {
    opacity: 0; width: 0; height: 0;
}

.bs-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.bs-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .bs-slider {
    background-color: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

input:checked + .bs-slider:before {
    transform: translateX(22px);
}

/* ── Section 2: Piece Sets Grid ── */
.bs-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.bs-piece-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 14px 8px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #94a3b8;
    position: relative;
}

.bs-piece-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.bs-piece-btn.active {
    background: rgba(168, 85, 247, 0.08);
    border-color: #a855f7;
    color: #fff;
    box-shadow: inset 0 0 0 1px #a855f7;
}

.bs-piece-name {
    font-size: 13px;
    font-weight: 700;
}

.bs-piece-preview {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
}

.bs-piece-preview svg {
    width: 32px;
    height: 32px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ── Section 3: Board Themes Grid ── */
.bs-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.bs-theme-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bs-theme-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.bs-theme-btn.active {
    background: rgba(168, 85, 247, 0.08);
    border-color: #a855f7;
    box-shadow: inset 0 0 0 1px #a855f7;
}

/* Specialized Checkmark for Piece Set Selection */
.bs-piece-btn .bs-selection-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bs-piece-btn.active .bs-selection-box {
    background: #a855f7;
    border-color: #a855f7;
}

.bs-piece-btn.active .bs-selection-box::after {
    content: '✓';
    font-size: 12px;
    color: #fff;
    font-weight: 900;
}

.bs-theme-preview {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #555;
    position: relative;
    overflow: hidden;
}

.bs-theme-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--theme-light) 50%, var(--theme-dark) 50%);
}

.bs-theme-label {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}

.bs-theme-btn.active .bs-theme-label {
    color: #a855f7;
}

/* Loader Tiny */
.bs-loader-tiny {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: bs-spin 0.6s linear infinite;
}

@keyframes bs-spin {
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
.bs-content::-webkit-scrollbar {
    width: 6px;
}
.bs-content::-webkit-scrollbar-track {
    background: transparent;
}
.bs-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.bs-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Eval Bar Hidden State (Global) ── */
.eval-bar-container.eval-hidden {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden;
    border: none;
    padding: 0;
    margin: 0;
}
