/* Estilos para notificaciones flotantes */

/* Contenedor principal */
.noti-popup-container {
    position: fixed;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    max-width: 400px;
    width: 100%;
    display: none;
}

.noti-popup-container.visible {
    display: block;
    animation: slideInFromRight 0.4s ease-out;
}

/* Posiciones */
.noti-popup-container.position-top-right {
    top: 85px; /* Valor por defecto - será ajustado dinámicamente por JS */
    right: 20px;
}

.noti-popup-container.position-top-left {
    top: 85px; /* Valor por defecto - será ajustado dinámicamente por JS */
    left: 20px;
}

.noti-popup-container.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.noti-popup-container.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Header con acciones globales */
.noti-popup-header {
    display: flex;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(100%);
    animation: slideInFromRight 0.4s ease-out forwards;
}

/* Los botones del header tienen el mismo ancho */
.noti-popup-header > button {
    flex: 1;
    margin: 0 2px;
}

/* Contenedor del stack */
.noti-popup-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Notificación individual */
.popup-notification {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    cursor: pointer;
    transition: all 0.6s ease, margin-top 0.5s ease-out;
    position: relative;
    opacity: 0;
    transform: translateX(100%);
}

/* Animación de deslizamiento hacia abajo cuando se agrega una nueva notificación */
.popup-notification.slide-down-animation {
    transition: margin-top 0.5s ease-out !important;
}

/* Estado final de las notificaciones después de la animación (sin interferir con eliminación) */
.popup-notification.animated-in {
    opacity: 1 !important;
    transform: translateX(0%) !important;
}

/* Animación de entrada */
.popup-notification.entering {
    opacity: 0;
    transform: translateX(100%);
}

.popup-notification.entered {
    opacity: 1;
    transform: translateX(0);
}

/* Notificación oculta (por límite de cantidad) */
.popup-notification.hidden {
    display: none;
}

.popup-notification:hover:not(.moving) {
    background: #37455a;
    border-color: #a0aec0;
    color: #e2e8f0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    transition: all 0.2s ease-out;
}

/* Deshabilitar hover durante movimiento */
.popup-notification.moving {
    pointer-events: none;
    transition: none;
}

/* Header de la notificación */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.popup-priority {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.popup-priority strong {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 13px;
}

/* Badges de prioridad */
.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-low {
    background: #d1ecf1;
    color: #0c5460;
}

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

.priority-high {
    background: #f8d7da;
    color: #7c1f28;
}

.priority-urgent {
    background: #f5c6cb;
    color: #721c24;
    animation: pulse 2s infinite;
}

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

/* Acciones del popup */
.popup-actions {
    display: flex;
    gap: 4px;
}

.popup-btn-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.popup-btn-close:hover {
    background: #f8d7da;
    color: #721c24;
}

/* Metadata */
.popup-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.popup-meta small {
    color: #6c757d;
    font-size: 11px;
}

/* Mensaje principal */
.popup-message {
    color: #495057;
    line-height: 1.4;
    margin-bottom: 12px;
    font-size: 13px;
}

/* Footer con acciones */
.popup-footer {
    display: flex;
    justify-content: flex-end;
}

.popup-btn-mark-read {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-btn-mark-read:hover:not(:disabled) {
    background: #0056b3;
}

.popup-btn-mark-read:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Scroll personalizado */
.noti-popup-stack::-webkit-scrollbar {
    width: 6px;
}

.noti-popup-stack::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.noti-popup-stack::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.noti-popup-stack::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animaciones de entrada/salida */
.popup-notification.entering {
    animation: slideInRight 0.6s ease-out;
}

.popup-notification.leaving {
    animation: fadeOut 0.6s ease-in;
}

/* Nueva clase para animación de entrada con estilos iniciales */
.popup-notification.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

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

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Efecto de vibración para notificaciones nuevas */
.popup-notification.new-notification {
    animation: gentleShake 1s ease-in-out;
    background-color: #26455a !important; /* Azul muy claro */
    border-left: 4px solid #2f5695 !important; /* Borde azul izquierdo */
}

@keyframes gentleShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-6px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(6px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .noti-popup-container {
        max-width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
        top: 20px;
        bottom: auto;
    }

    .noti-popup-header {
        flex-direction: column;
        gap: 6px;
        justify-content: flex-start;
    }

    .noti-popup-header > button {
        flex: none;
        margin: 0;
    }

    .noti-btn-go-to-center,
    .noti-btn-mark-all-read,
    .noti-btn-close-all {
        padding: 8px 16px;
        font-size: 13px;
    }

    .popup-notification {
        padding: 12px;
    }

    .popup-message {
        font-size: 12px;
    }
}

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

.popup-notification.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Botón de campana en el header */
.noti-bell-button {
    background: none;
    border: none;
    color: #FFFFFF;
    font-family: 'Rubik', sans-serif;
    font-size: 13px;
    font-weight: 300;
    cursor: pointer;
    position: relative;
    margin-right: 10px;
    padding: 8px 12px;
    transition: all 0.6s ease;
    text-decoration: none;
    border-radius: 4px;
}

.noti-bell-button:hover {
    color: #FFFFFF;
    transform: translateY(-2px);
}

.bell-icon {
    width: 20px;
    height: 20px;
    color: #FFFFFF;
    transition: all 0.6s ease;
}

.noti-bell-button:hover .bell-icon {
    color: #FFFFFF;
    transform: scale(1.1);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

.noti-bell-counter {
    position: absolute;
    top: -1px;
    right: -1px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    display: none; /* Oculto por defecto */
}

.noti-bell-counter.visible {
    display: inline;
}

.popup-notification {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.popup-priority strong {
    color: #e2e8f0;
}

.popup-message {
    color: #cbd5e0;
}

.popup-meta small {
    color: #a0aec0;
}

.noti-btn-mark-all-read,
.noti-btn-close-all {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.noti-btn-mark-all-read:hover {
    background: #718096;
}

.noti-btn-close-all:hover {
    background: #c53030;
    border-color: #c53030;
    color: #fed7d7;
}

.popup-btn-close:hover {
    background: #c53030;
    color: #fed7d7;
}


/* Botones de acción */
.noti-btn-mark-all-read,
.noti-btn-close-all {
    background: #4a5568;
    border: 1px solid #718096;
    color: #e2e8f0;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    margin-right: 8px;
    opacity: 1.0 !important;
}

.noti-btn-mark-all-read:hover {
    background: #718096;
}

.noti-btn-close-all:hover {
    background: #c53030;
    border-color: #c53030;
    color: #fed7d7;
}

/* Animación de entrada desde la derecha */
@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer del popup */
.noti-popup-footer {
    padding: 8px 16px 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    transform: translateX(100%);
    animation: slideInFromRight 0.4s ease-out forwards;
}

/* Botón para ir al centro de notificaciones */
.noti-btn-go-to-center {
    background: #4299e1;
    border: 1px solid #3182ce;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.noti-btn-go-to-center:hover {
    background: #3182ce;
    border-color: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
