/* MAPPING EDITOR STYLES */
.config-container {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100vh - 60px);
    padding-bottom: 100px;
    /* Space for scrolling */
}

.mapping-group {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mapping-group.collapsed .mapping-grid {
    display: none;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
}

.mapping-group.collapsed .group-header {
    border-bottom: none;
}

.group-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
}

.group-header .toggle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.mapping-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.mapping-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
}

.mapping-box {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    /* Label on top of input */
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    width: 60px;
    /* Smaller width */
}

.mapping-box:hover {
    border-color: var(--primary);
    background: rgba(212, 168, 83, 0.05);
}

.mb-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

/* INPUT FIELD for value */
/* INPUT FIELD for value */
.mb-val {
    font-size: 1.4rem;
    height: 40px;
    width: 100%;
    text-align: center;
    background: #ffffff;
    /* White Background */
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #000000;
    /* Black Text */
    font-family: var(--font-mongol);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    cursor: pointer;
}

.mb-val:focus {
    border-color: var(--primary);
    outline: none;
}

.mb-picker-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 12px;
}

.mb-picker-btn:hover {
    background: var(--primary);
    color: black;
    border-color: var(--primary);
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important;
    /* Ensure it is above everything */
    pointer-events: auto !important;
    /* Re-enable clicks */
}

.modal-overlay.visible {
    display: flex !important;
}

.modal-content {
    background: white !important;
    color: #333 !important;
    padding: 1.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex !important;
    /* Override style.css display: none */
    opacity: 1 !important;
    /* Override style.css opacity: 0 */
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative !important;
    /* Override style.css position: fixed */
    top: auto !important;
    left: auto !important;
    transform: none !important;
    pointer-events: auto !important;
}

.modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem !important;
    border-bottom: 1px solid #eee !important;
    padding-bottom: 0.5rem !important;
}

.picker-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr)) !important;
    gap: 0.8rem !important;
    overflow-y: auto !important;
    padding: 1rem !important;
    background: #f9f9f9 !important;
    border-radius: 8px !important;
    min-height: 200px !important;
}

.picker-cell {
    width: 45px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    background: white;
    color: #000 !important;
    /* Forces black text color */
    cursor: pointer;
    border-radius: 6px;
    font-family: var(--font-mongol);
    font-size: 1.6rem;
    writing-mode: vertical-lr;
    transition: transform 0.1s, border-color 0.1s;
}

.picker-cell:hover {
    border-color: var(--primary) !important;
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #888;
}

.close-btn:hover {
    color: #333;
}