/* ==========================================
   KREL HOME PREMIUM CART TOAST (OPTIMIZADO)
   ========================================== */

#krel-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 390px;
    max-width: calc(100vw - 30px);
    background: #ffffff;
    font-family: 'Montserrat', sans-serif;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.14);
    z-index: 999999;
    display: none;
    border: 1px solid #f0ece6;
}

/* Mostrar */
#krel-toast.show {
    display: block;
    animation: krelToastIn .35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animaciones */
@keyframes krelToastIn {
    from {
        opacity: 0;
        transform: translateX(70px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes krelToastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(70px);
    }
}

/* Header */
.krel-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid #f0ece6;
    font-size: 15px;
    font-weight: 700;
    color: #111111;
    background: #faf8f5;
}

/* Botón cerrar */
#krel-toast-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #888888;
    transition: color .2s ease, transform .2s ease;
    padding: 0;
    line-height: 1;
}

#krel-toast-close:hover {
    color: #111111;
    transform: scale(1.1);
}

/* Contenido */
.krel-toast-content {
    display: flex;
    gap: 16px;
    padding: 20px;
    align-items: center;
    transition: all .2s ease;
}

/* Imagen */
#krel-toast-image {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #f0ece6;
    background: #faf8f5;
    flex-shrink: 0;
}

/* Información */
.krel-toast-info {
    flex: 1;
}

#krel-toast-product {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: #111111;
}

#krel-toast-price {
    display: block;
    margin-top: 5px;
    font-size: 18px;
    font-weight: 700;
    color: #9c7a54; /* Acento madera Krel Home */
}

#krel-toast-cart-count {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    color: #666666;
}

/* Botones */
.krel-toast-buttons {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.krel-toast-buttons a {
    flex: 1;
    padding: 13px 16px;
    text-align: center;
    text-decoration: none !important;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
    transition: all .25s ease;
}

/* Botón secundario (Ver carrito) */
.krel-secondary {
    background: #f4f1ea;
    color: #111111 !important;
    border: 1px solid rgba(156, 122, 84, 0.25);
}

.krel-secondary:hover {
    background: #ebe5da;
}

/* Botón principal (Finalizar compra) */
.krel-primary {
    background: #111111;
    color: #ffffff !important;
    border: 1px solid #111111;
}

.krel-primary:hover {
    background: #2b2b2b;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* Barra progreso */
#krel-progress {
    height: 4px;
    width: 100%;
    background: #f0ece6;
    overflow: hidden;
}

#krel-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: #9c7a54; /* Barra en tono madera */
    transform-origin: left;
    animation: krelProgress 5s linear forwards;
}

@keyframes krelProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ==========================
   MODO ERROR (Ahora funciona en PC y Móvil)
========================== */
#krel-toast.error {
    border-left: 4px solid #dc2626;
}

#krel-toast.error .krel-toast-header {
    color: #dc2626;
}

#krel-toast.error #krel-progress span {
    background: #dc2626;
}

#krel-toast.error .krel-toast-buttons {
    justify-content: center;
}

#krel-toast.error .krel-primary {
    width: 100%;
}

/* ==========================
   RESPONSIVE (MÓVIL)
========================== */
@media (max-width: 768px) {
    #krel-toast {
        left: 15px;
        right: 15px;
        top: 15px;
        width: auto;
        max-width: none;
    }

    .krel-toast-content {
        gap: 14px;
    }

    #krel-toast-image {
        width: 70px;
        height: 70px;
    }

    #krel-toast-product {
        font-size: 14.5px;
    }

    .krel-toast-buttons {
        flex-direction: column;
    }
}