/**
 * ExploreXR Materials Variants Styles
 * 
 * Frontend CSS for the Materials Variants addon
 * 
 * @package ExploreXR_Materials_Addon
 * @version 1.0.0
 */

/* ===== Materials Switcher Base Styles ===== */
.explorexr-premium-materials-switcher {
    position: absolute;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

/* ===== Positioning ===== */
.explorexr-premium-materials-position-top-left {
    top: 10px;
    left: 10px;
}

.explorexr-premium-materials-position-top-center {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.explorexr-premium-materials-position-top-right {
    top: 10px;
    right: 10px;
}

.explorexr-premium-materials-position-middle-left {
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.explorexr-premium-materials-position-middle-right {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.explorexr-premium-materials-position-bottom-left {
    bottom: 10px;
    left: 10px;
}

.explorexr-premium-materials-position-bottom-center {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.explorexr-premium-materials-position-bottom-right {
    bottom: 10px;
    right: 10px;
}

/* ===== Dropdown Style ===== */
.explorexr-premium-materials-dropdown .explorexr-premium-materials-select {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.explorexr-premium-materials-dropdown .explorexr-premium-materials-select:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.explorexr-premium-materials-dropdown .explorexr-premium-materials-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

/* ===== Button Style ===== */
.explorexr-premium-materials-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 160px;
}

.explorexr-premium-materials-buttons .explorexr-premium-materials-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);    
    -webkit-backdrop-filter: blur(10px);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorexr-premium-materials-buttons .explorexr-premium-materials-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.explorexr-premium-materials-buttons .explorexr-premium-materials-btn.active {
    background: #0073aa;
    color: white;
    border-color: #005a87;
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
}

.explorexr-premium-materials-buttons .explorexr-premium-materials-btn.active:hover {
    background: #005a87;
    transform: none;
}

.explorexr-premium-materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    max-width: 260px;
}

@media (max-width: 600px) {
    .explorexr-premium-materials-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        max-width: 100%;
    }
}

/* Button Size Variants */
.explorexr-premium-materials-btn-small {
    padding: 4px 8px !important;
    font-size: 11px !important;
}

.explorexr-premium-materials-btn-medium {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.explorexr-premium-materials-btn-large {
    padding: 8px 14px !important;
    font-size: 14px !important;
}

/* ===== Tab Style ===== */
.explorexr-premium-materials-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
    backdrop-filter: blur(10px);    
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.explorexr-premium-materials-tabs::-webkit-scrollbar {
    display: none;
}

.explorexr-premium-materials-tabs .explorexr-premium-materials-tab {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
    text-align: center;
}

.explorexr-premium-materials-tabs .explorexr-premium-materials-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.explorexr-premium-materials-tabs .explorexr-premium-materials-tab.active {
    background: #0073aa;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 115, 170, 0.3);
}

/* ===== Slider Style ===== */
.explorexr-premium-materials-slider-container {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px;
    min-width: 180px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.explorexr-premium-materials-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    outline: none;
    margin: 5px 0;
    cursor: pointer;
    -webkit-appearance: none;
}

.explorexr-premium-materials-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.explorexr-premium-materials-slider::-webkit-slider-thumb:hover {
    background: #005a87;
    transform: scale(1.1);
}

.explorexr-premium-materials-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.explorexr-premium-materials-slider::-moz-range-thumb:hover {
    background: #005a87;
    transform: scale(1.1);
}

.explorexr-premium-materials-slider-label {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    color: #333;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .explorexr-premium-materials-switcher {
        font-size: 12px;
    }
    
    .explorexr-premium-materials-position-top-left,
    .explorexr-premium-materials-position-middle-left,
    .explorexr-premium-materials-position-bottom-left {
        left: 5px;
    }
    
    .explorexr-premium-materials-position-top-right,
    .explorexr-premium-materials-position-middle-right,
    .explorexr-premium-materials-position-bottom-right {
        right: 5px;
    }
    
    .explorexr-premium-materials-position-top-center,
    .explorexr-premium-materials-position-top-left,
    .explorexr-premium-materials-position-top-right {
        top: 5px;
    }
    
    .explorexr-premium-materials-position-bottom-center,
    .explorexr-premium-materials-position-bottom-left,
    .explorexr-premium-materials-position-bottom-right {
        bottom: 5px;
    }
    
    .explorexr-premium-materials-buttons {
        max-width: 120px;
    }
    
    .explorexr-premium-materials-tabs {
        max-width: 250px;
    }
    
    .explorexr-premium-materials-slider-container {
        min-width: 140px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .explorexr-premium-materials-switcher {
        font-size: 11px;
    }
    
    .explorexr-premium-materials-dropdown .explorexr-premium-materials-select {
        min-width: 100px;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .explorexr-premium-materials-buttons {
        max-width: 100px;
    }
    
    .explorexr-premium-materials-buttons .explorexr-premium-materials-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .explorexr-premium-materials-tabs {
        max-width: 200px;
    }
    
    .explorexr-premium-materials-tabs .explorexr-premium-materials-tab {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 50px;
    }
    
    .explorexr-premium-materials-slider-container {
        min-width: 120px;
        padding: 6px;
    }
}

/* ===== Animation Effects ===== */
.explorexr-premium-materials-switcher {
    animation: materialsUIFadeIn 0.3s ease-out;
}

@keyframes materialsUIFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply position-specific transform adjustments for animations */
.explorexr-premium-materials-position-top-center {
    animation: materialsUIFadeInCenter 0.3s ease-out;
}

.explorexr-premium-materials-position-middle-left {
    animation: materialsUIFadeInLeft 0.3s ease-out;
}

.explorexr-premium-materials-position-middle-right {
    animation: materialsUIFadeInRight 0.3s ease-out;
}

@keyframes materialsUIFadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%);
    }
}

@keyframes materialsUIFadeInLeft {
    from {
        opacity: 0;
        transform: translate(-10px, -50%);
    }
    to {
        opacity: 1;
        transform: translateY(-50%);
    }
}

@keyframes materialsUIFadeInRight {
    from {
        opacity: 0;
        transform: translate(10px, -50%);
    }
    to {
        opacity: 1;
        transform: translateY(-50%);
    }
}

/* ===== Accessibility ===== */
.explorexr-premium-materials-switcher button:focus,
.explorexr-premium-materials-switcher select:focus,
.explorexr-premium-materials-switcher input:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.explorexr-premium-materials-switcher button:focus:not(:focus-visible),
.explorexr-premium-materials-switcher select:focus:not(:focus-visible),
.explorexr-premium-materials-switcher input:focus:not(:focus-visible) {
    outline: none;
}

/* ===== High Contrast Mode Support ===== */
@media (prefers-contrast: high) {
    .explorexr-premium-materials-switcher {
        background: white;
        border: 2px solid black;
    }
    
    .explorexr-premium-materials-dropdown .explorexr-premium-materials-select,
    .explorexr-premium-materials-buttons .explorexr-premium-materials-btn,
    .explorexr-premium-materials-slider-container {
        background: white;
        border: 2px solid black;
        color: black;
    }
    
    .explorexr-premium-materials-buttons .explorexr-premium-materials-btn.active,
    .explorexr-premium-materials-tabs .explorexr-premium-materials-tab.active {
        background: black;
        color: white;
        border: 2px solid white;
    }
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
    .explorexr-premium-materials-switcher,
    .explorexr-premium-materials-switcher * {
        animation: none;
        transition: none;
    }
}

/* ===== Dark Theme Support ===== */
@media (prefers-color-scheme: dark) {
    .explorexr-premium-materials-switcher {
        color: #e0e0e0;
    }
    
    .explorexr-premium-materials-dropdown .explorexr-premium-materials-select {
        background: rgba(40, 40, 40, 0.95);
        border-color: rgba(255, 255, 255, 0.3);
        color: #e0e0e0;
    }
    
    .explorexr-premium-materials-dropdown .explorexr-premium-materials-select:hover {
        background: rgba(60, 60, 60, 1);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .explorexr-premium-materials-buttons .explorexr-premium-materials-btn {
        background: rgba(40, 40, 40, 0.9);
        border-color: rgba(255, 255, 255, 0.3);
        color: #e0e0e0;
    }
    
    .explorexr-premium-materials-buttons .explorexr-premium-materials-btn:hover {
        background: rgba(60, 60, 60, 1);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .explorexr-premium-materials-tabs {
        background: rgba(40, 40, 40, 0.95);
    }
    
    .explorexr-premium-materials-tabs .explorexr-premium-materials-tab {
        color: #e0e0e0;
    }
    
    .explorexr-premium-materials-tabs .explorexr-premium-materials-tab:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .explorexr-premium-materials-slider-container {
        background: rgba(40, 40, 40, 0.95);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .explorexr-premium-materials-slider {
        background: #666;
    }
    
    .explorexr-premium-materials-slider-label {
        color: #e0e0e0;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Admin Material Textures - Frontend UI
   Displayed based on the UI placement style (buttons/dropdown/grid/slider)
   ═══════════════════════════════════════════════════════════════ */

.explorexr-admin-materials-ui {
    position: absolute;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    max-width: 320px;
}

/* Slot Label */
.explorexr-admin-mat-slot-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 6px;
    padding-left: 2px;
}

.explorexr-admin-mat-slot-ui {
    margin-bottom: 8px;
}

.explorexr-admin-mat-slot-ui:last-child {
    margin-bottom: 0;
}

/* ─── Buttons Style ─── */
.explorexr-admin-mat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.explorexr-admin-mat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.explorexr-admin-mat-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #2271b1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.explorexr-admin-mat-btn.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.explorexr-admin-mat-btn-thumb {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.explorexr-admin-mat-btn-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

/* ─── Dropdown Style ─── */
.explorexr-admin-mat-dropdown {
    width: 100%;
    min-width: 160px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    appearance: auto;
}

.explorexr-admin-mat-dropdown:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ─── Grid Style ─── */
.explorexr-admin-mat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
}

.explorexr-admin-mat-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.explorexr-admin-mat-grid-item:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.explorexr-admin-mat-grid-item.active {
    border-color: #2271b1;
    background: #f0f6fc;
    box-shadow: 0 0 0 1px #2271b1;
}

.explorexr-admin-mat-grid-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    margin-bottom: 4px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.explorexr-admin-mat-grid-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

/* ─── Slider Style ─── */
.explorexr-admin-mat-slider-wrap {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    backdrop-filter: blur(8px);
    min-width: 180px;
}

.explorexr-admin-mat-slider {
    width: 100%;
    margin: 0;
    cursor: pointer;
    accent-color: #2271b1;
}

.explorexr-admin-mat-slider-label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    text-align: center;
    margin-top: 6px;
}

/* ===== Color Swatch Styles ===== */
.explorexr-admin-mat-color-swatch {
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    position: relative;
}

.explorexr-admin-mat-color-swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
                linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    opacity: 0.3;
    z-index: -1;
    border-radius: inherit;
}

/* Make color swatches stand out more in buttons */
.explorexr-admin-mat-btn .explorexr-admin-mat-color-swatch {
    min-width: 40px;
    min-height: 40px;
}

/* Adjust grid color swatches */
.explorexr-admin-mat-grid-thumb.explorexr-admin-mat-color-swatch {
    background-size: auto;
}

/* ===== Original Material Swatch (Frontend) ===== */
.explorexr-admin-mat-original-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f6fc 0%, #e8f0fe 100%);
    border: 2px solid rgba(34, 113, 177, 0.3);
    color: #2271b1;
}

.explorexr-admin-mat-btn .explorexr-admin-mat-original-swatch {
    min-width: 24px;
    min-height: 24px;
}

.explorexr-admin-mat-grid-thumb.explorexr-admin-mat-original-swatch {
    width: 56px;
    height: 56px;
}
