/*=============================================
ESTILOS PARA SISTEMA DE NOTIFICACIONES
=============================================*/

/* Badge de notificaciones */
.notificaciones-badge {
    position: absolute;
    top: 9px;
    right: 10px;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}

/* Dropdown de notificaciones */
#notificaciones-dropdown .dropdown-menu {
    width: 350px;
    max-width: 90vw;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#notificaciones-dropdown .dropdown-menu .header {
    background-color: #f4f4f4;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    color: #444;
    font-size: 14px;
    font-weight: 600;
}

#notificaciones-dropdown .dropdown-menu .menu {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

#notificaciones-dropdown .dropdown-menu .footer {
    background-color: #f4f4f4;
    padding: 0;
    border-top: 1px solid #ddd;
    text-align: center;
}

#notificaciones-dropdown .dropdown-menu .footer a {
    color: #666;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s;
    display: inline-block;
    padding: 10px;
}

#notificaciones-dropdown .dropdown-menu .footer a:hover {
    color: #333;
    background-color: #e8e8e8;
}

/* Items de notificación */
.notificacion-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    cursor: pointer;
}

.notificacion-item:last-child {
    border-bottom: none;
}

.notificacion-item:hover {
    background-color: #f8f8f8;
}

.notificacion-item a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
}

/* Row que contiene avatar + contenido */
.notificacion-row {
    display: flex;
    align-items: center;
}

/* Avatar del remitente */
.notificacion-avatar {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    border: 2px solid rgba(0,0,0,0.06);
    background-color: #f6f6f6;
}

/* Contenedor del contenido (titulo + mensaje) */
.notificacion-body {
    display: flex;
    flex-direction: column;
    min-width: 0; /* para que truncado funcione */
}

.notificacion-content {
    overflow: hidden;
}

.notificacion-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notificacion-content small {
    display: block;
    font-size: 12px;
    color: #555;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notificacion-meta {
    margin-top: 6px;
}

.notificacion-item a:hover {
    text-decoration: none;
}

.notificacion-item i {
    font-size: 18px;
    float: left;
    margin-right: 10px;
    margin-top: 2px;
}

.notificacion-content {
    overflow: hidden;
}

.notificacion-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #333;
}

.notificacion-content small {
    display: block;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.notificacion-content .text-muted {
    color: #999;
    margin-top: 4px;
}

/* Animación del ícono de campana */
#notificaciones-dropdown .fa-bell {
    animation: bellShake 0.5s ease-in-out;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

/* Cuando no hay notificaciones */
#notificaciones-lista .text-center {
    padding: 20px;
    color: #999;
}

/* Colores según tipo de notificación */
.text-success { color: #00a65a !important; }
.text-info { color: #3c8dbc !important; }
.text-warning { color: #f39c12 !important; }
.text-danger { color: #dd4b39 !important; }

/* Scrollbar personalizado para el listado */
#notificaciones-dropdown .menu::-webkit-scrollbar {
    width: 6px;
}

#notificaciones-dropdown .menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#notificaciones-dropdown .menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#notificaciones-dropdown .menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    #notificaciones-dropdown .dropdown-menu {
        width: 300px;
        right: -80px;
    }
    
    .notificacion-item a {
        padding: 10px 12px;
    }
    
    .notificacion-item i {
        font-size: 16px;
    }
    .notificacion-avatar {
        width: 36px;
        height: 36px;
        margin-right: 8px;
    }
    
    .notificacion-content strong {
        font-size: 12px;
    }
    
    .notificacion-content small {
        font-size: 11px;
    }
}

/* Estilos para modal móvil de notificaciones */
@media (max-width: 768px) {
    .modal-notificaciones-mobile .modal-dialog {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .modal-notificaciones-mobile .modal-content {
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
    }

    .modal-notificaciones-mobile .modal-body {
        overflow-y: auto;
        flex: 1 1 auto;
        padding: 0;
    }

    .modal-notificaciones-mobile .modal-header,
    .modal-notificaciones-mobile .modal-footer {
        flex: 0 0 auto;
    }

    /* Ajustar el dropdown a una mejor posición en móviles para evitar scroll horizontal */
    #notificaciones-dropdown .dropdown-menu {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: calc(100% - 16px);
    }
}

/* Efecto de carga */
.notificaciones-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.notificaciones-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animación de aparición para el dropdown de notificaciones */
@keyframes notifSlideDown {
    0% { transform: translateY(-8px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.notificaciones-anim {
    will-change: transform, opacity;
    animation: notifSlideDown 240ms cubic-bezier(.2,.8,.2,1);
}

/* Animación para modal móvil */
@keyframes modalSlideUp {
    0% { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.modal-notificaciones-mobile .modal-content.modal-anim {
    will-change: transform, opacity;
    animation: modalSlideUp 260ms cubic-bezier(.2,.8,.2,1);
}

/* Badge pulsante cuando hay notificaciones nuevas */
.notificaciones-badge.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Mejorar la apariencia del contador */
.notificaciones-count {
    font-weight: bold;
    color: #dd4b39;
}
