/**
 * Configurador YV-MF Styles
 * 
 * @package YVMF\Configurador
 * @version 2.0.0
 */

/* ============================================
   Variables CSS
   ============================================ */
:root {
    --yvmf-primary-color: #4CAF50;
    --yvmf-primary-dark: #45a049;
    --yvmf-secondary-color: #2196F3;
    --yvmf-accent-color: #FF9800;
    --yvmf-text-color: #333;
    --yvmf-text-light: #666;
    --yvmf-bg-light: #f9f9f9;
    --yvmf-border-color: #ddd;
    --yvmf-border-radius: 8px;
    --yvmf-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --yvmf-transition: all 0.3s ease;
    --yvmf-spacing-sm: 8px;
    --yvmf-spacing-md: 16px;
    --yvmf-spacing-lg: 24px;
    --yvmf-spacing-xl: 32px;
}

/* ============================================
   Contenedor Principal
   ============================================ */
.yvmf-configurator-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--yvmf-spacing-lg);
    background: #fff;
    border-radius: var(--yvmf-border-radius);
    box-shadow: var(--yvmf-shadow);
}

/* ============================================
   Header
   ============================================ */
.yvmf-configurator-header {
    text-align: center;
    margin-bottom: var(--yvmf-spacing-xl);
    padding-bottom: var(--yvmf-spacing-lg);
    border-bottom: 3px solid var(--yvmf-primary-color);
}

.yvmf-configurator-header h3 {
    color: var(--yvmf-primary-color);
    font-size: 28px;
    margin-bottom: var(--yvmf-spacing-md);
}

.yvmf-instructions {
    background: var(--yvmf-bg-light);
    padding: var(--yvmf-spacing-md);
    border-radius: var(--yvmf-border-radius);
    border-left: 4px solid var(--yvmf-primary-color);
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.yvmf-instructions ol {
    margin: var(--yvmf-spacing-sm) 0 0 var(--yvmf-spacing-sm) var(--yvmf-spacing-lg);
}

/* ============================================
   Presets
   ============================================ */
.yvmf-presets-section {
    margin-bottom: var(--yvmf-spacing-xl);
}

.yvmf-presets-section h4 {
    color: var(--yvmf-text-color);
    margin-bottom: var(--yvmf-spacing-md);
    text-align: center;
}

.yvmf-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--yvmf-spacing-md);
    margin-top: var(--yvmf-spacing-md);
}

.yvmf-preset-btn {
    background: #fff;
    border: 2px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    padding: var(--yvmf-spacing-md);
    cursor: pointer;
    transition: var(--yvmf-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--yvmf-spacing-sm);
}

.yvmf-preset-btn:hover,
.yvmf-preset-btn:focus {
    border-color: var(--yvmf-primary-color);
    background: var(--yvmf-bg-light);
    transform: translateY(-2px);
    box-shadow: var(--yvmf-shadow);
}

.yvmf-preset-btn:focus {
    outline: 3px solid var(--yvmf-primary-color);
    outline-offset: 2px;
}

.yvmf-preset-icon {
    font-size: 32px;
}

.yvmf-preset-name {
    font-weight: 600;
    color: var(--yvmf-text-color);
}

.yvmf-preset-desc {
    font-size: 14px;
    color: var(--yvmf-text-light);
    text-align: center;
}

/* ============================================
   Secciones
   ============================================ */
.yvmf-section-title {
    margin-bottom: var(--yvmf-spacing-md);
    padding-bottom: var(--yvmf-spacing-sm);
    border-bottom: 2px solid var(--yvmf-border-color);
}

.yvmf-section-title strong {
    color: var(--yvmf-primary-color);
    font-size: 18px;
}

/* ============================================
   Selector de Modelo
   ============================================ */
.yvmf-model-selector {
    background: var(--yvmf-bg-light);
    padding: var(--yvmf-spacing-lg);
    border-radius: var(--yvmf-border-radius);
    margin-bottom: var(--yvmf-spacing-lg);
}

.yvmf-model-options,
.yvmf-color-options {
    margin-bottom: var(--yvmf-spacing-md);
}

.yvmf-model-label,
.yvmf-color-label {
    display: block;
    font-weight: 600;
    color: var(--yvmf-text-color);
    margin-bottom: var(--yvmf-spacing-sm);
}

.yvmf-select {
    width: 100%;
    padding: var(--yvmf-spacing-sm) var(--yvmf-spacing-md);
    border: 2px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    font-size: 16px;
    background: #fff;
    cursor: pointer;
    transition: var(--yvmf-transition);
}

.yvmf-select:hover,
.yvmf-select:focus {
    border-color: var(--yvmf-primary-color);
}

.yvmf-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.yvmf-helper-text {
    display: block;
    font-size: 14px;
    color: var(--yvmf-text-light);
    margin-top: var(--yvmf-spacing-sm);
}

/* ============================================
   Selector de Color
   ============================================ */
.yvmf-color-buttons {
    display: flex;
    gap: var(--yvmf-spacing-md);
    flex-wrap: wrap;
}

.yvmf-color-option {
    cursor: pointer;
}

.yvmf-color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.yvmf-color-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--yvmf-spacing-sm) var(--yvmf-spacing-md);
    border: 3px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    transition: var(--yvmf-transition);
    font-weight: 600;
    min-width: 80px;
    min-height: 40px;
}

.yvmf-color-label-text {
    background: rgba(255, 255, 255, 0.85);
    color: #222;
    padding: 2px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.yvmf-color-plata {
    background: linear-gradient(135deg, #d5d5d5 0%, #9e9e9e 100%);
    color: #333;
}

.yvmf-color-negro {
    background: linear-gradient(135deg, #4a4a4a 0%, #1a1a1a 100%);
    color: #fff;
}

.yvmf-color-option input[type="radio"]:checked+.yvmf-color-box,
.yvmf-color-option input[type="radio"]:focus+.yvmf-color-box {
    border-color: var(--yvmf-primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.yvmf-color-option input[type="radio"]:focus+.yvmf-color-box {
    outline: 3px solid var(--yvmf-primary-color);
    outline-offset: 2px;
}

/* ============================================
   Configurador de Módulos
   ============================================ */
.yvmf-modules-configurator {
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Preview del Panel
   ============================================ */
.yvmf-panel-preview {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    padding: var(--yvmf-spacing-lg);
    border-radius: var(--yvmf-border-radius);
    margin-bottom: var(--yvmf-spacing-lg);
    text-align: center;
}

.yvmf-panel-container {
    max-width: 600px;
    margin: 0 auto;
}

.yvmf-panel-body {
    background: #fff;
    border-radius: 12px;
    padding: var(--yvmf-spacing-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.yvmf-panel-modules {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--yvmf-spacing-sm);
}

.yvmf-module-slot {
    background: #f9f9f9;
    border: 2px solid var(--yvmf-border-color);
    border-radius: 6px;
    padding: var(--yvmf-spacing-md);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--yvmf-transition);
}

.yvmf-module-slot.configured {
    background: #e6ebf1;
    border-color: #000;
}

.yvmf-module-slot:hover,
.yvmf-module-slot:focus {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.yvmf-module-slot:focus {
    outline: 3px solid var(--yvmf-accent-color);
    outline-offset: 2px;
}

.yvmf-module-icon {
    font-size: 32px;
    transition: var(--yvmf-transition);
}

.yvmf-module-icon.empty {
    color: #ccc;
    font-size: 24px;
}

.yvmf-module-slot.configured .yvmf-module-icon {
    color: #000;
    font-size: 40px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.yvmf-drag-hint {
    margin-top: var(--yvmf-spacing-md);
    color: var(--yvmf-text-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--yvmf-spacing-sm);
}

/* ============================================
   Selector de Módulos
   ============================================ */
.yvmf-module-selectors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--yvmf-spacing-md);
    margin-bottom: var(--yvmf-spacing-lg);
}

.yvmf-module-selector {
    background: #fff;
    border: 1px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    padding: var(--yvmf-spacing-md);
    transition: var(--yvmf-transition);
}

.yvmf-module-selector:hover {
    border-color: var(--yvmf-primary-color);
    box-shadow: var(--yvmf-shadow);
}

.yvmf-module-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--yvmf-spacing-sm);
}

.yvmf-module-number {
    font-weight: 600;
    color: var(--yvmf-primary-color);
}

.yvmf-connector-select {
    width: 100%;
    padding: var(--yvmf-spacing-sm);
    border: 2px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: var(--yvmf-transition);
}

.yvmf-connector-select:hover,
.yvmf-connector-select:focus {
    border-color: var(--yvmf-primary-color);
}

.yvmf-connector-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.yvmf-connector-select.selected {
    background: var(--yvmf-bg-light);
    border-color: var(--yvmf-primary-color);
}

.yvmf-module-info {
    text-align: center;
    color: var(--yvmf-text-light);
    font-size: 14px;
    margin-top: var(--yvmf-spacing-md);
}

/* ============================================
   Configuraciones Guardadas
   ============================================ */
.yvmf-saved-configs-section {
    background: var(--yvmf-bg-light);
    padding: var(--yvmf-spacing-lg);
    border-radius: var(--yvmf-border-radius);
    margin-bottom: var(--yvmf-spacing-lg);
}

.yvmf-saved-configs-section h4 {
    color: var(--yvmf-text-color);
    margin-bottom: var(--yvmf-spacing-md);
    text-align: center;
}

.yvmf-saved-configs-list {
    margin-bottom: var(--yvmf-spacing-md);
    min-height: 100px;
}

.yvmf-saved-config-item {
    background: #fff;
    border: 1px solid var(--yvmf-border-color);
    border-radius: var(--yvmf-border-radius);
    padding: var(--yvmf-spacing-md);
    margin-bottom: var(--yvmf-spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--yvmf-transition);
}

.yvmf-saved-config-item:hover {
    border-color: var(--yvmf-primary-color);
    box-shadow: var(--yvmf-shadow);
}

.yvmf-saved-config-name {
    font-weight: 600;
    color: var(--yvmf-text-color);
}

.yvmf-saved-config-actions {
    display: flex;
    gap: var(--yvmf-spacing-sm);
}

.yvmf-saved-config-btn {
    background: var(--yvmf-primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: var(--yvmf-spacing-sm) var(--yvmf-spacing-md);
    cursor: pointer;
    transition: var(--yvmf-transition);
}

.yvmf-saved-config-btn:hover {
    background: var(--yvmf-primary-dark);
}

.yvmf-saved-config-btn.delete {
    background: #f44336;
}

.yvmf-saved-config-btn.delete:hover {
    background: #d32f2f;
}

.yvmf-save-config-btn {
    width: 100%;
    background: var(--yvmf-secondary-color);
    color: #fff;
    border: none;
    border-radius: var(--yvmf-border-radius);
    padding: var(--yvmf-spacing-md);
    cursor: pointer;
    transition: var(--yvmf-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--yvmf-spacing-sm);
    font-size: 16px;
}

.yvmf-save-config-btn:hover {
    background: #1976D2;
}

.yvmf-save-config-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================
   Resumen de Precio
   ============================================ */
.yvmf-price-summary {
    background: linear-gradient(135deg, #f0fff0 0%, #e8f5e9 100%);
    padding: var(--yvmf-spacing-lg);
    border-radius: var(--yvmf-border-radius);
    border: 2px solid var(--yvmf-primary-color);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.yvmf-price-breakdown {
    border-bottom: 2px solid var(--yvmf-border-color);
    padding-bottom: var(--yvmf-spacing-md);
    margin-bottom: var(--yvmf-spacing-md);
}

.yvmf-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--yvmf-spacing-sm);
    font-size: 16px;
    color: var(--yvmf-text-color);
}

.yvmf-breakdown-label {
    font-weight: 500;
}

.yvmf-breakdown-value {
    font-weight: 600;
}

.yvmf-breakdown-actions {
    margin-top: var(--yvmf-spacing-md);
    display: flex;
    justify-content: flex-end;
}

.yvmf-btn-prominent {
    background-color: var(--yvmf-primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--yvmf-border-radius);
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.yvmf-btn-prominent:hover {
    background-color: var(--yvmf-accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    color: #ffffff;
}

.yvmf-btn-prominent:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.yvmf-btn-prominent .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.yvmf-total {
    text-align: center;
    margin-bottom: var(--yvmf-spacing-md);
}

.yvmf-total-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--yvmf-text-dark);
    margin-bottom: var(--yvmf-spacing-sm);
}

.yvmf-total-price {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--yvmf-primary-color);
    transition: var(--yvmf-transition);
}

.yvmf-total-price.price-updated {
    animation: priceUpdate 0.3s ease;
}

@keyframes priceUpdate {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        color: var(--yvmf-accent-color);
    }
}

.yvmf-modules-available {
    text-align: center;
    color: var(--yvmf-text-light);
    font-size: 14px;
}

.yvmf-config-summary {
    margin-top: var(--yvmf-spacing-md);
    padding-top: var(--yvmf-spacing-md);
    border-top: 1px solid rgba(76, 175, 80, 0.3);
}

/* ============================================
   Mensaje de Validación
   ============================================ */
.yvmf-validation-message {
    padding: var(--yvmf-spacing-md);
    border-radius: var(--yvmf-border-radius);
    margin-top: var(--yvmf-spacing-lg);
    animation: slideDown 0.3s ease;
}

.yvmf-validation-message.error {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
}

.yvmf-validation-message.success {
    background: #e8f5e9;
    border-left: 4px solid var(--yvmf-primary-color);
    color: #2e7d32;
}

/* ============================================
   Utilidades
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.yvmf-loading {
    text-align: center;
    color: var(--yvmf-text-light);
    padding: var(--yvmf-spacing-lg);
}

.yvmf-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--yvmf-border-color);
    border-top-color: var(--yvmf-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: var(--yvmf-spacing-sm);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .yvmf-configurator-wrapper {
        padding: var(--yvmf-spacing-md);
    }

    .yvmf-configurator-header h3 {
        font-size: 22px;
    }

    .yvmf-presets-grid {
        grid-template-columns: 1fr;
    }

    .yvmf-panel-modules {
        grid-template-columns: repeat(2, 1fr);
    }

    .yvmf-module-selectors {
        grid-template-columns: 1fr;
    }

    .yvmf-total-price {
        font-size: 28px;
    }

    .yvmf-color-buttons {
        flex-direction: column;
    }

    .yvmf-color-box {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .yvmf-panel-modules {
        grid-template-columns: 1fr;
    }

    .yvmf-module-slot {
        min-height: 60px;
    }

    .yvmf-module-icon {
        font-size: 24px;
    }

    .yvmf-total-price {
        font-size: 24px;
    }
}

/* ============================================
   Soporte RTL
   ============================================ */
[dir="rtl"] .yvmf-instructions ol {
    margin-right: var(--yvmf-spacing-lg);
    margin-left: 0;
}

[dir="rtl"] .yvmf-module-label {
    flex-direction: row-reverse;
}

[dir="rtl"] .yvmf-saved-config-item {
    flex-direction: row-reverse;
}

/* ============================================
   Modo Oscuro (opcional)
   ============================================ */
/* Eliminado a petición del usuario para forzar modo claro */

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .yvmf-configurator-wrapper {
        box-shadow: none;
    }

    .yvmf-presets-section,
    .yvmf-saved-configs-section,
    .yvmf-module-selectors {
        display: none;
    }
}

/* ============================================
   Focus Visible (Accesibilidad mejorada)
   ============================================ */
.yvmf-configurator-wrapper *:focus-visible {
    outline: 3px solid var(--yvmf-primary-color);
    outline-offset: 2px;
}

/* ============================================
   Reducción de movimiento (Accesibilidad)
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Alertas Flotantes de WooCommerce (Toasts)
   ============================================ */
.woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-notices-wrapper .woocommerce-info {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    max-width: 450px !important;
    width: 90% !important;
    z-index: 999999 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    margin: 0 !important;
    animation: yvmfSlideInToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    display: flex !important;
    align-items: center !important;
}

@keyframes yvmfSlideInToast {
    0% {
        opacity: 0;
        transform: translate(50px, -20px);
    }

    100% {
        opacity: 1;
        transform: translate(0, 0);
    }
}

/* Para pantallas móviles, centramos el Toast en la parte baja o alta */
@media (max-width: 768px) {

    .woocommerce-notices-wrapper .woocommerce-error,
    .woocommerce-notices-wrapper .woocommerce-message,
    .woocommerce-notices-wrapper .woocommerce-info {
        top: auto !important;
        bottom: 30px !important;
        left: 5% !important;
        right: 5% !important;
        width: 90% !important;
        max-width: 100% !important;
        animation: yvmfSlideUpToastMobile 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    }

    @keyframes yvmfSlideUpToastMobile {
        0% {
            opacity: 0;
            transform: translateY(50px);
        }

        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }
}