/* Plugin Kubo Add to Cart Standalone - CSS */

/* Forzar ancho completo en contenedores de Elementor cuando alojan el standalone */
.elementor-widget:has(.kubo-standalone-container),
.elementor-widget:has(.kubo-standalone-container) > .elementor-widget-container {
    width: 100% !important;
    max-width: 100% !important;
    align-self: stretch !important;
}

/* Contenedor principal */
.kubo-standalone-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 24px 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    color: #202020;
    box-sizing: border-box;
}

/* Fila principal en 2 columnas:
   Columna 1 (izquierda): fila 1:[kubo_prices size="large"]; fila 2:subtotal; fila 3: low stock hint;
   Columna 2 (derecha): arriba preselección, abajo selector de cantidad */
.kubo-standalone-layout-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Columna 1 (Izquierda): Precios, Subtotal y Aviso de Stock */
.kubo-standalone-col-1 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

/* Fila 1: Precio */
.kubo-standalone-price {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.25;
    width: 100%;
    color: #202020;
    font-family: 'Montserrat', sans-serif;
}

/* Subtotal oculto (ya se muestra integrado en el botón "Agregar • $x.xx") */
.kubo-standalone-subtotal {
    display: none !important;
}

/* Fila 3: Aviso bajo stock */
.kubo-standalone-container .kubo-low-stock-hint,
.kubo-low-stock-hint {
    margin: 0;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: #b45309;
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    visibility: visible;
    opacity: 1;
    line-height: 1.25;
    box-sizing: border-box;
    box-shadow: none !important;
}

/* Columna 2 (Derecha): Grupo vertical de elementos (presets, cantidad) */
.kubo-standalone-col-2 {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-width: 180px;
    box-sizing: border-box;
}

/* 1. Arriba: Preselección / Presets */
.kubo-standalone-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.kubo-standalone-preset-btn {
    background-color: #f7f7f7;
    color: #202020;
    border: 1px solid #e2e8f0;
    border-radius: 8px !important;
    height: 36px;
    min-height: 36px;
    padding: 0 8px;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    box-sizing: border-box;
    box-shadow: none !important;
}

.kubo-standalone-preset-btn:hover {
    border: 2px solid #FA010A;
    color: #FA010A;
    background-color: #ffffff;
    box-shadow: none !important;
}

.kubo-standalone-preset-btn:active,
.kubo-standalone-preset-btn.selected {
    background-color: #fff5f5 !important;
    border: 2px solid #FA010A !important;
    color: #FA010A !important;
    font-weight: 900 !important;
    box-shadow: none !important;
}

.kubo-standalone-preset-btn.disabled,
.kubo-standalone-preset-btn[disabled] {
    opacity: 0.4 !important;
    pointer-events: none !important;
    text-decoration: line-through !important;
    cursor: not-allowed !important;
    background-color: #f0f0f0 !important;
    border: 1px solid #e2e8f0 !important;
    color: #202020 !important;
    box-shadow: none !important;
}

/* 2. En medio: Quantity Control */
.kubo-standalone-quantity-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.kubo-standalone-quantity-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
}

/* Sufijo de cantidad standalone: SOLO mostrar 'g' cuando data-unit="g" */
.kubo-standalone-quantity-input-wrapper::after {
    content: '';
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #202020;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    pointer-events: none;
    z-index: 1;
    left: var(--suffix-left, 50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kubo-standalone-quantity-input-wrapper[data-unit="g"]::after {
    content: 'g';
    display: block;
}

.kubo-standalone-quantity-input-wrapper[data-unit="g"].suffix-positioned::after {
    opacity: 1;
}

.kubo-standalone-quantity-input-wrapper:not([data-unit="g"])::after {
    content: '' !important;
    display: none !important;
    opacity: 0 !important;
}

.kubo-standalone-quantity-btn {
    background-color: #ffffff;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    line-height: 1;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: none !important;
}

/* Colores específicos para los botones */
.kubo-standalone-quantity-btn[data-action="decrease"] {
    color: #FA010A;
}

.kubo-standalone-quantity-btn[data-action="increase"] {
    color: #FAB000;
}

.kubo-standalone-quantity-btn:hover[data-action="decrease"] {
    border-color: #FA010A !important;
    color: #FA010A !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
}

.kubo-standalone-quantity-btn:hover[data-action="increase"] {
    border-color: #FAB000 !important;
    color: #FAB000 !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
}

.kubo-standalone-quantity-btn:active {
    transform: scale(0.96);
}

.kubo-standalone-quantity-btn-disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: #f5f5f5 !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.kubo-standalone-quantity-btn-disabled:hover {
    border-color: #e2e8f0 !important;
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.kubo-standalone-quantity-input {
    text-align: center;
    width: 100%;
    height: 40px;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 0 4px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #202020 !important;
    font-family: 'Montserrat', sans-serif;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
    box-sizing: border-box;
    background-color: #f8f9fa !important;
    cursor: default !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    transition: border-color 0.2s ease;
    box-shadow: none !important;
}

.kubo-standalone-quantity-input:focus {
    border-color: #FA010A !important;
    outline: none !important;
    box-shadow: none !important;
}

.kubo-standalone-quantity-input::-webkit-outer-spin-button,
.kubo-standalone-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Botón agregar al carrito (100% full width abajo) - Color #FA010A */
.kubo-standalone-add-to-cart-btn,
button.kubo-standalone-add-to-cart-btn {
    background-color: #FA010A !important;
    color: #ffffff !important;
    border: 2px solid #FA010A !important;
    border-radius: 8px !important;
    height: 44px;
    padding: 0 20px;
    margin: 0;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: none !important;
    box-sizing: border-box;
    outline: none;
    white-space: nowrap;
}

.kubo-standalone-add-to-cart-btn .kubo-standalone-btn-text,
.kubo-standalone-add-to-cart-btn .kubo-standalone-btn-subtotal {
    color: inherit !important;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    transition: color 0.2s ease;
}

.kubo-standalone-add-to-cart-btn:hover,
button.kubo-standalone-add-to-cart-btn:hover {
    background-color: #ffffff !important;
    color: #FA010A !important;
    border: 2px solid #FA010A !important;
    border-color: #FA010A !important;
    box-shadow: none !important;
}

.kubo-standalone-add-to-cart-btn:hover .kubo-standalone-btn-text,
.kubo-standalone-add-to-cart-btn:hover .kubo-standalone-btn-subtotal {
    color: #FA010A !important;
}

.kubo-standalone-add-to-cart-btn:active,
.kubo-standalone-add-to-cart-btn.kubo-standalone-btn-clicked {
    transform: scale(0.98);
    transition: transform 0.1s ease;
    background-color: #FA010A !important;
    color: #ffffff !important;
    border-color: #FA010A !important;
    box-shadow: none !important;
}

.kubo-standalone-add-to-cart-btn:disabled,
.kubo-standalone-add-to-cart-btn.kubo-standalone-out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #cccccc !important;
    border: 2px solid #cccccc !important;
    color: #202020 !important;
    box-shadow: none !important;
    transform: none !important;
}

.kubo-standalone-add-to-cart-btn.kubo-standalone-out-of-stock:hover {
    background-color: #cccccc !important;
    border: 2px solid #cccccc !important;
    color: #202020 !important;
    box-shadow: none !important;
}

/* Estado de éxito del botón */
.kubo-standalone-add-to-cart-btn-success {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border: 2px solid #28a745 !important;
    border-radius: 8px !important;
    cursor: default !important;
    transition: all 0.2s ease !important;
    height: 44px !important;
    padding: 0 20px !important;
    font-weight: 600 !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

.kubo-standalone-add-to-cart-btn-success:hover {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border-color: #28a745 !important;
    box-shadow: none !important;
}

/* Spinner de carga en botón */
.kubo-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-radius: 8px;
    animation: kubo-spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
    box-sizing: border-box;
}

@keyframes kubo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltip para límite de stock */
.kubo-tooltip {
    position: absolute;
    right: 0;
    top: -32px;
    font-size: 0.75rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    background: #202020;
    color: #ffffff !important;
    padding: 4px 8px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
    display: block !important;
    visibility: visible !important;
    line-height: 1.5;
    box-shadow: none !important;
    box-sizing: border-box;
}

.kubo-tooltip.show {
    opacity: 1 !important;
    transform: translateY(0);
}

/* Notificaciones */
.kubo-atc-standalone-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 320px;
    box-shadow: none;
    box-sizing: border-box;
}

.kubo-atc-standalone-notification-show {
    transform: translateX(0);
}

.kubo-atc-standalone-notification-success {
    background-color: #28a745;
    border: 2px solid #1e7e34;
}

.kubo-atc-standalone-notification-error {
    background-color: #dc3545;
    border: 2px solid #c82333;
}

/* Responsive (Mobile) */
@media (max-width: 768px) {
    .kubo-standalone-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 16px 0;
        padding: 0;
    }
    
    .kubo-standalone-layout-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px;
        margin-bottom: 12px;
        width: 100% !important;
    }
    
    .kubo-standalone-col-1 {
        width: 100% !important;
        gap: 4px;
    }
    
    .kubo-standalone-col-2 {
        width: 100% !important;
        min-width: 0 !important;
        gap: 8px;
    }
    
    .kubo-standalone-presets,
    .kubo-standalone-quantity-control {
        width: 100% !important;
    }
    
    .kubo-standalone-subtotal {
        font-size: 1rem;
        margin: 0;
    }
    
    .kubo-standalone-preset-btn {
        height: 36px;
        min-height: 36px;
        padding: 0 8px;
        font-size: 0.75rem;
    }
    
    .kubo-standalone-quantity-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.25rem;
    }
    
    .kubo-standalone-quantity-input-wrapper {
        height: 40px;
        min-height: 40px;
    }
    
    .kubo-standalone-quantity-input {
        height: 40px;
        font-size: 1rem;
        font-weight: 600;
        padding: 0 4px;
    }
    
    .kubo-standalone-add-to-cart-btn,
    button.kubo-standalone-add-to-cart-btn {
        height: 44px;
        padding: 0 16px;
        font-size: 1rem;
    }
    
    .kubo-standalone-add-to-cart-btn-success {
        height: 44px !important;
        padding: 0 16px !important;
        font-size: 1rem !important;
    }
    
    .kubo-standalone-quantity-input-wrapper[data-unit="g"]::after {
        top: 50%;
        font-size: 1rem;
        left: var(--suffix-left, 50%);
    }
}

/* Responsive para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .kubo-standalone-container {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .kubo-standalone-quantity-input-wrapper[data-unit="g"]::after {
        top: 50%;
        font-size: 1rem;
        left: var(--suffix-left, 50%);
    }
}

/* Responsive para notificaciones */
@media (max-width: 767px) {
    .kubo-atc-standalone-notification {
        top: 80px;
        right: 16px;
        left: 16px;
        max-width: none;
        transform: translateY(-150%);
    }
    
    .kubo-atc-standalone-notification-show {
        transform: translateY(0);
    }
}
