/* Estilos para Sistema de Alertas KS APP (Admin + Frontend) */

.ks-notificaciones-container {
    position: fixed;
    right: 20px;
    z-index: 999999;
    max-width: 400px;
    pointer-events: none;
}

/* En admin: debajo de la admin bar */
body.wp-admin .ks-notificaciones-container {
    top: 32px;
}

/* En frontend: cerca del top */
body:not(.wp-admin) .ks-notificaciones-container {
    top: 20px;
}

/* Si hay admin bar en frontend */
body.admin-bar:not(.wp-admin) .ks-notificaciones-container {
    top: 52px; /* 32px admin bar + 20px margin */
}

.ks-toast {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    transform: translateX(450px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid #007cba;
    min-width: 350px;
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
}

.ks-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.ks-toast.hide {
    transform: translateX(450px);
    opacity: 0;
}

/* Tipos de toast */
.ks-toast-success {
    border-left-color: #28a745;
}

.ks-toast-error {
    border-left-color: #dc3545;
}

.ks-toast-warning {
    border-left-color: #ffc107;
}

.ks-toast-info {
    border-left-color: #17a2b8;
}

/* Header del toast */
.ks-toast-header {
    display: flex;
    align-items: center;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.ks-toast-icon {
    margin-right: 8px;
    font-size: 16px;
    min-width: 20px;
}

.ks-toast-title {
    font-weight: 600;
    flex-grow: 1;
    color: #333;
    font-size: 14px;
}

.ks-toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.ks-toast-close:hover {
    background: #f0f0f0;
    color: #666;
}

/* Cuerpo del toast */
.ks-toast-body {
    padding: 8px 16px 12px;
    color: #555;
    font-size: 13px;
    line-height: 1.4;
}

/* Barra de progreso */
.ks-toast-progress {
    height: 3px;
    background: #f0f0f0;
    overflow: hidden;
}

.ks-toast-progress-bar {
    height: 100%;
    background: #116d6a;
    transform: translateX(-100%);
    animation: progress-bar linear forwards;
}

.ks-toast-success .ks-toast-progress-bar {
    background: #28a745;
}

.ks-toast-error .ks-toast-progress-bar {
    background: #dc3545;
}

.ks-toast-warning .ks-toast-progress-bar {
    background: #ffc107;
}

.ks-toast-info .ks-toast-progress-bar {
    background: #23d26b;
}

@keyframes progress-bar {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Efectos hover */
.ks-toast:hover {
    transform: translateX(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.ks-toast:hover .ks-toast-progress-bar {
    animation-play-state: paused;
}

/* Responsivo */
@media (max-width: 480px) {
    .ks-notificaciones-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .ks-toast {
        min-width: auto;
        transform: translateY(-450px);
    }
    
    .ks-toast.show {
        transform: translateY(0);
    }
    
    .ks-toast.hide {
        transform: translateY(-450px);
    }
}

/* Cuando hay múltiples toasts */
.ks-toast:nth-child(2) {
    transform: translateX(450px) scale(0.95);
}

.ks-toast:nth-child(3) {
    transform: translateX(450px) scale(0.9);
}

.ks-toast:nth-child(4) {
    transform: translateX(450px) scale(0.85);
}

.ks-toast.show:nth-child(2) {
    transform: translateX(0) scale(0.95);
}

.ks-toast.show:nth-child(3) {
    transform: translateX(0) scale(0.9);
}

.ks-toast.show:nth-child(4) {
    transform: translateX(0) scale(0.85);
}

/* Animaciones adicionales */
@keyframes bounceIn {
    0% {
        transform: scale(0.3) translateX(450px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateX(-10px);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9) translateX(5px);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) translateX(0);
        opacity: 1;
    }
}

.ks-toast.bounce-in {
    animation: bounceIn 0.6s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ks-toast {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .ks-toast-header {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .ks-toast-title {
        color: #e2e8f0;
    }
    
    .ks-toast-body {
        color: #cbd5e0;
    }
    
    .ks-toast-close {
        color: #a0aec0;
    }
    
    .ks-toast-close:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .ks-toast-progress {
        background: #4a5568;
    }
}
