/**
 * Voxel Manager - Consolidated CSS
 * Using WordPress core styles where possible
 */

/* =========================================
   CUSTOM UI COMPONENTS (EXCEPTIONS)
   ========================================= */

/* Toggle Switch - Custom Component (keeping as per request) */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2271b1;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2271b1;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Select2 customization (keeping as per request) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #2271b1;
    color: #fff;
    border-color: #135e96;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    border-right-color: #135e96;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: #135e96;
    color: #fff;
}

/* Enhanced Select2 Styles for Better Readability */
.select2-container--default .select2-results__option {
    color: #333;
    background-color: #fff;
    padding: 8px 12px;
    font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #f0f7ff;
    color: #2271b1;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e6f0f9;
    color: #135e96;
    font-weight: 500;
}

.select2-container--default .select2-dropdown {
    border-color: #8c8f94;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border-color: #8c8f94;
    padding: 6px;
}

.select2-container--default .select2-selection--multiple {
    border-color: #8c8f94;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* For better readability of the placeholder text */
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: #757575;
    opacity: 1;
}

/* Adjust dropdown width to match container */
.select2-container {
    width: 100% !important;
}

/* =========================================
   GENERAL STYLING (USING WP CORE WHERE POSSIBLE)
   ========================================= */

/* Tab handling */
.tab-content, .vbm-tab-content {
    display: none;
}

.tab-content.active, .vbm-tab-content.active {
    display: block;
}

/* Editable field indicator */
.editable {
    cursor: pointer;
    background-color: rgba(33, 113, 177, 0.03);
}

.editable:hover {
    background-color: rgba(33, 113, 177, 0.08);
}

/* Module page styling - using WP core structure but with slight customizations */
.vbm-module-page {
    max-width: 98%;
    margin-top: 20px;
}

.vbm-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 0;
}

.vbm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.vbm-card-header h2 {
    margin: 0;
    padding: 0;
}

/* Filter bars - simplify to match WP core styles */
.vbm-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.vbm-filter-item {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.vbm-filter-item label {
    font-weight: 600;
    margin-bottom: 5px;
}

/* Make filter actions match WP styles */
.vbm-filter-actions {
    align-self: flex-end;
    margin-bottom: 4px;
}

/* Action bar with additional WP styling */
.vbm-table-top-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 15px;
}

.vbm-action-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Column selector - must keep custom styling */
.vbm-column-selector {
    position: relative;
    display: inline-block;
    z-index: 100;
}

.vbm-column-selector-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    padding: 15px;
    z-index: 1000;
    min-width: 250px;
    max-width: 320px;
    max-height: 500px;
    overflow-y: auto;
    display: none;
}

/* Show dropdown when visible class is applied */
.vbm-column-selector-dropdown.visible {
    display: block;
}

.vbm-column-selector-group {
    margin-bottom: 15px;
}

.vbm-column-selector-group:last-child {
    margin-bottom: 0;
}

.vbm-column-selector-group-title {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    color: #1d2327;
}

.vbm-column-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* Widget documentation display */
.widget-docs {
    position: relative;
    z-index: 100;
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.widget-docs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Version status tags - keep special styling */
.version-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    min-width: 70px;
}

.version-status.alpha {
    background-color: #d63638; /* WP Error Color */
}

.version-status.beta {
    background-color: #dba617; /* WP Warning Color */
}

.version-status.working {
    background-color: #00a32a; /* WP Success Color */
}

.version-status.not-applicable {
    background-color: #82878c; /* WP Muted Color */
}

/* Alternative styling using WordPress notice classes */
.version-status.wp-core {
    color: #333;
    background-color: #f0f0f1; /* WP Default background */
    border-left: 4px solid #72aee6; /* WP Default blue */
    padding: 3px 8px 3px 6px;
    border-radius: 0;
}

.version-status.wp-core.alpha {
    border-left-color: #d63638; /* WP Error Color */
}

.version-status.wp-core.beta {
    border-left-color: #dba617; /* WP Warning Color */
}

.version-status.wp-core.working {
    border-left-color: #00a32a; /* WP Success Color */
}

.version-status.wp-core.not-applicable {
    border-left-color: #82878c; /* WP Muted Color */
}

/* API Tester specific styles */
.api-status {
    display: inline-block;
    margin-left: 10px;
}

.status-success {
    color: #00a32a; /* WP success color */
}

.status-error {
    color: #d63638; /* WP error color */
}

/* Tooltips - simple implementation */
.vbm-tooltip {
    position: relative;
}

.vbm-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
}

.vbm-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}