/**
 * Raliz Mobile Cart Stylesheet
 * Version: 2.3.0 (Adds Share Cart feature)
 * Mobile-First Approach
 */

/* --- 1. OCULTAR ELEMENTOS ORIGINALES Y GLOBALES --- */
.woocommerce-cart table.shop_table,
.woocommerce-cart .actions,
.woocommerce-cart-form > .cart-collaterals,
body.woocommerce-cart .entry-title {
    display: none;
}
.woocommerce .raliz-cart-form {
    border: none;
    padding: 0;
}

/* --- NUEVO: ESTILOS PARA EL BOTÓN DE COMPARTIR SUPERIOR --- */
.raliz-cart-mode-switcher {
    padding: 10px 16px;
    text-align: right;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}
.raliz-mode-button {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #333;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s, color 0.2s;
}
.raliz-mode-button:hover {
    background-color: #f2f2f2;
}
#raliz-cancel-share-mode {
    background-color: #222;
    color: #fff;
    border-color: #222;
}


/* --- 2. DISEÑO DE TARJETA DE PRODUCTO (MÓVIL) --- */
.raliz-cart-items {
    display: flex;
    flex-direction: column;
    padding-bottom: 120px; /* Espacio para el footer flotante */
    background-color: #fff;
}
.raliz-cart-item {
    display: flex;
    align-items: flex-start;
    padding: 16px 8px;
    gap: 12px;
    border-bottom: 1px solid #f2f2f2;
}

/* Checkbox de selección (Estilo Shein) */
.raliz-item-selector {
    padding-top: 30px;
}
.raliz-item-checkbox, #raliz-select-all-checkbox, #raliz-share-select-all-checkbox {
    width: 20px;
    height: 20px;
    border: 1.5px solid #ccc;
    border-radius: 50%;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}
.raliz-item-checkbox:checked, #raliz-select-all-checkbox:checked, #raliz-share-select-all-checkbox:checked {
    background-color: #222;
    border-color: #222;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8l3 3 5-5'/%3e%3c/svg%3e");
}

/* Imagen y detalles del producto */
.raliz-product-thumbnail { flex: 0 0 80px; width: 80px; }
.raliz-product-thumbnail img { width: 100%; height: auto; border-radius: 4px; display: block; }
.raliz-product-details { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.raliz-product-details .product-name a { font-size: 14px; color: #333; text-decoration: none; font-weight: normal; line-height: 1.4; }
.raliz-product-details .variation { font-size: 13px; color: #888; margin-top: 4px; }
.product-rating { display: flex; align-items: center; gap: 4px; color: #888; }
.product-rating .star-rating { font-size: 13px; color: #ffb800; }
.product-rating .rating-count { font-size: 12px; }


/* Contenedor de precio y controles */
.product-price-and-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.product-price { font-size: 16px; font-weight: bold; color: #222; }
.raliz-product-controls { display: flex; align-items: center; gap: 16px; }

/* Icono de papelera (estilo Shein con SVG) */
.product-remove .remove {
    display: inline-block;
    width: 28px;
    height: 28px;
    font-size: 0; /* Oculta cualquier carácter de texto */
    text-decoration: none;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    border: none;
}

/* Selector de cantidad */
.quantity { display: flex; align-items: center; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.quantity .minus, .quantity .plus { width: 28px; height: 28px; background-color: #f5f5f5; border: none; cursor: pointer; font-size: 18px; color: #333; line-height: 28px; }
.quantity .qty { width: 32px; height: 28px; text-align: center; border: none; border-left: 1px solid #ddd; border-right: 1px solid #ddd; background: transparent; font-weight: 500; -moz-appearance: textfield; padding: 0; }
.quantity .qty::-webkit-inner-spin-button, .quantity .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* --- 3. FOOTER FIJO (MÓVIL) --- */
.raliz-cart-sidebar { display: none; }
.raliz-mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.05);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}
.raliz-select-all { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.raliz-select-all label { font-size: 15px; }
.raliz-total-container { display: flex; align-items: baseline; gap: 8px; flex-grow: 1; justify-content: flex-end; }
.raliz-total-container .total-label { font-size: 15px; font-weight: normal; }
.raliz-total-container .total-amount { font-size: 18px; font-weight: bold; color: #222; }
.raliz-mobile-footer .checkout-button {
    background-color: #222;
    color: #fff;
    border-radius: 50px;
    padding: 12px 28px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
    border: none;
}

/* --- 5. ESTADOS ADICIONALES --- */
.checkout-button.disabled {
    background-color: #cccccc !important;
    color: #888888 !important;
    cursor: not-allowed;
}
.raliz-desktop-title {
    display: none;
}


/* --- 4. DISEÑO ESCRITORIO Y CORRECCIONES (LÓGICA DINÁMICA) --- */
@media (min-width: 768px) {
    body.woocommerce-cart {
        background-color: #f5f5f5;
    }
    .raliz-cart-form {
        max-width: 1200px;
        margin: 0 auto;
    }
    .raliz-cart-mode-switcher,
    .raliz-mobile-footer { 
        display: none; 
    }
    .raliz-cart-sidebar { 
        display: block; 
    }
    .woocommerce-cart .raliz-desktop-layout { 
        display: grid; 
        grid-template-columns: 2fr 1fr; 
        gap: 20px; 
        align-items: start; 
    }

    .raliz-desktop-title {
        display: block;
        font-size: 1.25rem;
        font-weight: 600;
        margin-bottom: 20px;
    }

    .raliz-cart-main {
        background: #fff;
        padding: 25px;
        border-radius: 4px;
    }
    .raliz-cart-items { 
        padding-bottom: 0; 
        border: none;
        border-radius: 0;
        padding: 0;
        background: transparent;
    }
    .raliz-cart-item {
        border-bottom: 1px solid #f2f2f2;
        padding: 20px 0;
    }
    .raliz-cart-item:last-child {
        border-bottom: none;
    }

    .raliz-cart-sidebar { 
        position: sticky; 
        top: 30px; 
    }
    .raliz-cart-sidebar .cart-collaterals { 
        display: block !important; 
        background-color: #fff; 
        padding: 25px; 
        border-radius: 4px; 
    }
    
    /* Contenedor de totales dinámicos */
    #raliz-desktop-totals {
        border-top: 1px solid #f2f2f2;
        padding-top: 20px;
        margin-top: 20px;
    }
    #raliz-desktop-totals .total-row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        font-size: 1.2rem;
        font-weight: 600;
    }
    #raliz-desktop-totals .total-amount {
        color: #000;
    }
    
    /* Botón de Finalizar Compra */
    .raliz-cart-sidebar .wc-proceed-to-checkout {
        padding-top: 20px;
        margin-top: 10px;
    }
    .raliz-cart-sidebar .checkout-button {
        display: block;
        width: 100%;
        text-align: center;
        text-decoration: none;
        font-size: 1rem;
        padding: 15px;
        background-color: #222;
        color: #fff;
        font-weight: bold;
        border-radius: 4px;
        border: none;
        transition: background-color 0.3s ease;
    }
    .raliz-cart-sidebar .checkout-button:hover {
        background-color: #444;
    }
}