/**
 * Estilos CSS para el módulo de Notificaciones de Productos
 * Compatible con PrestaShop 1.7.8.11 y 8.2
 * Responsive y accesible
 */

/* Variables CSS para personalización */
:root {
    --pn-bg-color: #ffffff;
    --pn-text-color: #333333;
    --pn-border-color: #e74c3c;
    --pn-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --pn-border-radius: 8px;
    --pn-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --pn-max-width: 350px;
}

/* Contenedor principal de notificaciones */
.product-notifications-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none; /* Permite clics a través del contenedor */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Posicionamiento según configuración */
.product-notifications-container.top-left {
    top: 20px;
    left: 20px;
}

.product-notifications-container.top-right {
    top: 20px;
    right: 20px;
}

.product-notifications-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

.product-notifications-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

/* Notificación individual */
.product-notification {
    position: relative;
    width: 100%;
    max-width: var(--pn-max-width);
    background: var(--pn-bg-color);
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--pn-border-color);
    border-radius: var(--pn-border-radius);
    box-shadow: var(--pn-shadow);
    margin-bottom: 15px;
    padding: 16px;
    transition: var(--pn-transition);
    pointer-events: auto; /* Restaura eventos de clic */
    cursor: pointer;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    color: var(--pn-text-color);
    font-size: 14px;
    line-height: 1.4;
}

/* Estados de la notificación */
.product-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.product-notification.hide {
    transform: translateX(100%);
    opacity: 0;
}

.product-notification:hover {
    transform: translateX(0) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Botón de cerrar */
.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 1;
}

.notification-close:hover {
    color: #666;
}

.notification-close:focus {
    outline: 2px solid var(--pn-border-color);
    outline-offset: 2px;
}

/* Contenido de la notificación */
.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

/* Imagen del producto */
.notification-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f8f8;
}

.notification-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-notification:hover .notification-image img {
    transform: scale(1.05);
}

/* Información del producto */
.notification-info {
    flex: 1;
    min-width: 0; /* Para truncar texto largo */
}

.notification-message {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.product-name {
    font-weight: 600;
    color: var(--pn-text-color);
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-weight: 700;
    color: var(--pn-border-color);
    font-size: 15px;
    margin-bottom: 4px;
}

.stock-info {
    font-size: 11px;
    color: #888;
}

.stock-status {
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-status.high {
    background: #e8f5e8;
    color: #2e7d2e;
}

.stock-status.medium {
    background: #fff3cd;
    color: #856404;
}

.stock-status.low {
    background: #f8d7da;
    color: #721c24;
}

/* Botón de acción */
.notification-action {
    margin-top: 8px;
}

.view-product-btn {
    display: inline-block;
    padding: 6px 12px;
    background: var(--pn-border-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--pn-border-color);
}

.view-product-btn:hover {
    background: transparent;
    color: var(--pn-border-color);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Barra de progreso */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--pn-border-color);
    transition: width linear;
    width: 100%;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes zoomIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Clases de animación */
.product-notification.fadeIn {
    animation: fadeIn 0.5s ease-out forwards;
}

.product-notification.slideInRight {
    animation: slideInRight 0.5s ease-out forwards;
}

.product-notification.slideInLeft {
    animation: slideInLeft 0.5s ease-out forwards;
}

.product-notification.slideInUp {
    animation: slideInUp 0.5s ease-out forwards;
}

.product-notification.bounceIn {
    animation: bounceIn 0.6s ease-out forwards;
}

.product-notification.zoomIn {
    animation: zoomIn 0.4s ease-out forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-notifications-container {
        --pn-max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
        width: calc(100% - 40px);
    }
    
    .product-notification {
        max-width: none;
        padding: 14px;
    }
    
    .notification-content {
        gap: 10px;
    }
    
    .notification-image {
        width: 50px;
        height: 50px;
    }
    
    .product-name {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
    
    .view-product-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .product-notifications-container {
        --pn-max-width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        top: auto !important;
        width: calc(100% - 20px);
    }
    
    .product-notification {
        margin-bottom: 10px;
        padding: 12px;
    }
    
    .notification-content {
        gap: 8px;
    }
    
    .notification-image {
        width: 45px;
        height: 45px;
    }
}

/* Estados de carga */
.product-notification.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-notification.loading .notification-content {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .product-notification,
    .notification-close,
    .view-product-btn,
    .progress-bar {
        transition: none;
    }
    
    .product-notification.fadeIn,
    .product-notification.slideInRight,
    .product-notification.slideInLeft,
    .product-notification.slideInUp,
    .product-notification.bounceIn,
    .product-notification.zoomIn {
        animation: none;
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    :root {
        --pn-bg-color: #2d3748;
        --pn-text-color: #e2e8f0;
        --pn-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .product-notification {
        border-color: #4a5568;
    }
    
    .notification-image {
        background: #4a5568;
    }
    
    .notification-message {
        color: #a0aec0;
    }
    
    .stock-info {
        color: #a0aec0;
    }
    
    .notification-progress {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Template oculto */
.product-notification-template {
    display: none !important;
}




/* ===================================
   ESTILOS DE STOCK CON COLORES
   =================================== */

.stock-info {
    font-size: 11px;
    color: #888;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stock-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    line-height: 1;
    transition: all 0.3s ease;
}

/* Stock Alto - Verde */
.stock-status.high {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Stock Medio - Amarillo */
.stock-status.medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Stock Bajo - Rojo */
.stock-status.low {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Stock Agotado - Gris */
.stock-status.out {
    background: #e2e3e5;
    color: #6c757d;
    border: 1px solid #d6d8db;
}

.stock-quantity {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

/* ===================================
   BARRA DE PROGRESO
   =================================== */

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-radius: 0 0 var(--pn-border-radius) var(--pn-border-radius);
}

.progress-bar {
    height: 100%;
    background: var(--pn-border-color);
    width: 100%;
    transition: width linear;
    transform-origin: left;
}

/* Animación de la barra */
@keyframes progressAnimation {
    from { width: 100%; }
    to { width: 0%; }
}

/* ===================================
   EFECTOS HOVER
   =================================== */

.product-notification:hover .stock-status {
    transform: scale(1.05);
}

.product-notification:hover .progress-bar {
    animation-play-state: paused !important;
}

/* ===================================
   MODO OSCURO (OPCIONAL)
   =================================== */

@media (prefers-color-scheme: dark) {
    .stock-status.high {
        background: rgba(40, 167, 69, 0.2);
        color: #4ade80;
        border-color: rgba(40, 167, 69, 0.3);
    }
    
    .stock-status.medium {
        background: rgba(255, 193, 7, 0.2);
        color: #fbbf24;
        border-color: rgba(255, 193, 7, 0.3);
    }
    
    .stock-status.low {
        background: rgba(220, 53, 69, 0.2);
        color: #f87171;
        border-color: rgba(220, 53, 69, 0.3);
    }
    
    .stock-status.out {
        background: rgba(108, 117, 125, 0.2);
        color: #9ca3af;
        border-color: rgba(108, 117, 125, 0.3);
    }
    
    .notification-progress {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 480px) {
    .stock-info {
        font-size: 10px;
        gap: 5px;
    }
    
    .stock-status {
        padding: 3px 8px;
        font-size: 9px;
    }
    
    .stock-quantity {
        font-size: 10px;
    }
    
    .notification-progress {
        height: 2px;
    }
}