/* BQ Preferences Modal Styles */

.bq-pref-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 100000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    font-family: 'Lato', sans-serif;
}

.bq-pref-overlay.bq-modal-visible {
    display: flex;
}

.bq-pref-modal {
    background: #fff;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header */
.bq-pref-header {
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.bq-pref-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.bq-pref-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

/* Body */
.bq-pref-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bq-pref-section {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.bq-pref-section h3 {
    margin: 0 0 15px 0;
    font-size: 15px;
    color: #444;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.bq-pref-section h3 small {
    font-weight: normal;
    color: #888;
    font-size: 12px;
    margin-left: 5px;
}

/* Selected Columns (Draggable) */
.bq-selected-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.bq-col-tag {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 13px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    user-select: none;
}

.bq-col-tag:hover {
    background: #bbdefb;
}

.bq-col-tag.dragging {
    opacity: 0.5;
    border: 1px dashed #1565c0;
}

.bq-col-tag.drag-over {
    border-left: 3px solid #1565c0;
    margin-left: 5px;
}

.drag-handle {
    cursor: grab;
    color: #1565c0;
    opacity: 0.5;
    font-size: 12px;
}

.remove-col {
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}

.remove-col:hover {
    color: #d32f2f;
}

/* Available Columns */
.bq-controls {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#bq-col-search {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    outline: none;
}

#bq-col-search:focus {
    border-color: #217ab4;
}

.bq-group-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.bq-group-buttons button {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.bq-group-buttons button:hover,
.bq-group-buttons button.active {
    background: #217ab4;
    color: #fff;
    border-color: #217ab4;
}

.bq-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.bq-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.bq-checkbox-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Footer */
.bq-pref-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bq-footer-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.bq-btn-primary {
    background: #217ab4;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.bq-btn-secondary {
    background: white;
    color: #555;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.bq-btn-text {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

.bq-btn-primary:hover { background: #1a6291; }
.bq-btn-secondary:hover { background: #f5f5f5; }

/* Loader & Notifications */
.bq-pref-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #217ab4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.bq-notification {
    font-size: 14px;
    display: none;
}
.bq-notification.success { color: #2e7d32; }
.bq-notification.error { color: #d32f2f; }

@media (max-width: 600px) {
    .bq-pref-modal { width: 100%; height: 100%; border-radius: 0; }
    .bq-footer-buttons { flex-direction: column-reverse; width: 100%; }
    .bq-footer-buttons button { width: 100%; }
    .bq-pref-footer { flex-direction: column; gap: 10px; }
}