/* ============================================
   MODAL DE NOTIFICACIONES - ESTILOS COMPLETOS
   Diseño moderno y responsivo
   ============================================ */

/* ============================================
   ESTRUCTURA BÁSICA DEL MODAL
   ============================================ */
#modalNotificacionesComunidad .modal-dialog {
    max-width: 480px;
}

#modalNotificacionesComunidad .modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#modalNotificacionesComunidad .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
}

#modalNotificacionesComunidad .modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

#modalNotificacionesComunidad .modal-title i {
    font-size: 18px;
    color: var(--primary-color);
}

#modalNotificacionesComunidad .modal-body {
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}

#modalNotificacionesComunidad .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
    gap: 8px;
}

/* ============================================
   CONTENEDOR DE LISTA DE NOTIFICACIONES
   ============================================ */
#notificaciones-lista-modal {
    min-height: 200px;
}

/* ============================================
   ITEM DE NOTIFICACIÓN
   ============================================ */
.notificacion-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.notificacion-item:last-child {
    border-bottom: none;
}

.notificacion-item:hover {
    background: var(--light-bg);
}

/* Estado no leída */
.notificacion-item.no-leida {
    background: var(--primary-light);
}

.notificacion-item.no-leida::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.notificacion-item.no-leida:hover {
    background: #dce4fc;
}

/* ============================================
   AVATAR DE NOTIFICACIÓN
   ============================================ */
.notificacion-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    position: relative;
}

.notificacion-avatar .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--white);
}

.notificacion-avatar .avatar-placeholder-small {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    border: 2px solid var(--white);
}

/* Badge de tipo de notificación */
.notificacion-avatar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: 2px solid var(--white);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Diferentes iconos según tipo de notificación */
.notificacion-item[data-tipo="like"] .notificacion-avatar::after {
    content: '❤️';
    background: var(--danger-color);
    font-size: 10px;
}

.notificacion-item[data-tipo="comentario"] .notificacion-avatar::after {
    content: '💬';
    background: var(--primary-color);
    font-size: 10px;
}

.notificacion-item[data-tipo="seguimiento"] .notificacion-avatar::after {
    content: '👤';
    background: var(--success-color);
    font-size: 10px;
}

.notificacion-item[data-tipo="compartido"] .notificacion-avatar::after {
    content: '🔁';
    background: var(--info-color);
    font-size: 10px;
}

/* ============================================
   CONTENIDO DE NOTIFICACIÓN
   ============================================ */
.notificacion-content {
    flex: 1;
    min-width: 0;
}

.notificacion-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    word-wrap: break-word;
}

.notificacion-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.notificacion-fecha {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.notificacion-fecha i {
    font-size: 10px;
}

/* ============================================
   PREVIEW DE NOTIFICACIÓN
   ============================================ */
.notificacion-preview {
    flex-shrink: 0;
    margin-left: auto;
}

.notificacion-preview .preview-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.notificacion-preview .preview-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 20px;
}

/* ============================================
   ESTADO VACÍO
   ============================================ */
.notificaciones-empty {
    text-align: center;
    padding: 60px 30px;
}

.notificaciones-empty i {
    font-size: 56px;
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.5;
}

.notificaciones-empty h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.notificaciones-empty p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ============================================
   ESTADO DE CARGA
   ============================================ */
#notificaciones-lista-modal .text-center.py-5 {
    padding: 60px 20px !important;
}

#notificaciones-lista-modal .spinner-border {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

#notificaciones-lista-modal .text-muted.mt-3 {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   ESTADO DE ERROR
   ============================================ */
.notificaciones-empty .fas.fa-exclamation-triangle {
    color: var(--warning-color);
}

.notificaciones-empty .btn {
    margin-top: 16px;
}

/* ============================================
   BOTONES DEL FOOTER
   ============================================ */
#modalNotificacionesComunidad .modal-footer .btn {
    font-size: 12px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#modalNotificacionesComunidad .modal-footer .btn i {
    font-size: 12px;
}

#modalNotificacionesComunidad .modal-footer .btn-outline-primary {
    background: var(--white);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

#modalNotificacionesComunidad .modal-footer .btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--white);
}

#modalNotificacionesComunidad .modal-footer .btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notificacion-item {
    animation: notificationSlideIn 0.3s ease;
}

/* Animación de pulso para nuevas notificaciones */
@keyframes notificationPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(67, 97, 238, 0);
    }
}

.notificacion-item.no-leida.nueva {
    animation: notificationPulse 2s ease-in-out;
}

/* ============================================
   SCROLLBAR PERSONALIZADO PARA NOTIFICACIONES
   ============================================ */
#notificaciones-lista-modal::-webkit-scrollbar {
    width: 6px;
}

#notificaciones-lista-modal::-webkit-scrollbar-track {
    background: var(--light-bg);
}

#notificaciones-lista-modal::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#notificaciones-lista-modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   TIPOS ESPECÍFICOS DE NOTIFICACIÓN
   ============================================ */

/* Notificación de like */
.notificacion-item.tipo-like .notificacion-text strong {
    color: var(--danger-color);
}

/* Notificación de comentario */
.notificacion-item.tipo-comentario .notificacion-text strong {
    color: var(--primary-color);
}

/* Notificación de seguimiento */
.notificacion-item.tipo-seguimiento .notificacion-text strong {
    color: var(--success-color);
}

/* Notificación de compartido */
.notificacion-item.tipo-compartido .notificacion-text strong {
    color: var(--info-color);
}

/* ============================================
   RESPONSIVO - TABLET (768px)
   ============================================ */
@media (max-width: 768px) {
    #modalNotificacionesComunidad .modal-dialog {
        max-width: 92%;
        margin: 16px auto;
    }

    #modalNotificacionesComunidad .modal-header {
        padding: 14px 16px;
    }

    #modalNotificacionesComunidad .modal-title {
        font-size: 15px;
    }

    #modalNotificacionesComunidad .modal-title i {
        font-size: 16px;
    }

    #modalNotificacionesComunidad .modal-body {
        max-height: 400px;
    }

    .notificacion-item {
        padding: 12px 16px;
        gap: 10px;
    }

    .notificacion-avatar {
        width: 40px;
        height: 40px;
    }

    .notificacion-avatar .avatar-placeholder-small {
        font-size: 14px;
    }

    .notificacion-avatar::after {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .notificacion-text {
        font-size: 12px;
    }

    .notificacion-fecha {
        font-size: 10px;
    }

    .notificacion-preview .preview-img,
    .notificacion-preview .preview-icon {
        width: 44px;
        height: 44px;
    }

    .notificacion-preview .preview-icon {
        font-size: 18px;
    }

    .notificaciones-empty {
        padding: 50px 24px;
    }

    .notificaciones-empty i {
        font-size: 48px;
    }

    .notificaciones-empty h5 {
        font-size: 15px;
    }

    .notificaciones-empty p {
        font-size: 12px;
    }
}

/* ============================================
   RESPONSIVO - MÓVIL (640px)
   ============================================ */
@media (max-width: 640px) {
    #modalNotificacionesComunidad .modal-dialog {
        max-width: 96%;
        margin: 12px auto;
    }

    #modalNotificacionesComunidad .modal-header {
        padding: 12px 14px;
    }

    #modalNotificacionesComunidad .modal-title {
        font-size: 14px;
    }

    #modalNotificacionesComunidad .modal-title i {
        font-size: 15px;
    }

    #modalNotificacionesComunidad .modal-body {
        max-height: 360px;
    }

    #modalNotificacionesComunidad .modal-footer {
        padding: 10px 14px;
        flex-direction: column;
        gap: 8px;
    }

    #modalNotificacionesComunidad .modal-footer .btn {
        width: 100%;
        justify-content: center;
        padding: 9px 14px;
        font-size: 12px;
    }

    .notificacion-item {
        padding: 10px 14px;
        gap: 10px;
    }

    .notificacion-item.no-leida::before {
        width: 3px;
    }

    .notificacion-avatar {
        width: 38px;
        height: 38px;
    }

    .notificacion-avatar .avatar-placeholder-small {
        font-size: 13px;
    }

    .notificacion-avatar::after {
        width: 16px;
        height: 16px;
        font-size: 8px;
        bottom: -1px;
        right: -1px;
    }

    .notificacion-text {
        font-size: 12px;
    }

    .notificacion-fecha {
        font-size: 10px;
    }

    .notificacion-preview .preview-img,
    .notificacion-preview .preview-icon {
        width: 40px;
        height: 40px;
    }

    .notificacion-preview .preview-icon {
        font-size: 16px;
    }

    .notificaciones-empty {
        padding: 40px 20px;
    }

    .notificaciones-empty i {
        font-size: 44px;
    }

    .notificaciones-empty h5 {
        font-size: 14px;
    }

    .notificaciones-empty p {
        font-size: 12px;
    }

    #notificaciones-lista-modal .text-center.py-5 {
        padding: 50px 20px !important;
    }

    #notificaciones-lista-modal .spinner-border {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   RESPONSIVO - MÓVIL PEQUEÑO (480px)
   ============================================ */
@media (max-width: 480px) {
    #modalNotificacionesComunidad .modal-dialog {
        max-width: 98%;
        margin: 10px auto;
    }

    #modalNotificacionesComunidad .modal-header {
        padding: 10px 12px;
    }

    #modalNotificacionesComunidad .modal-title {
        font-size: 13px;
        gap: 6px;
    }

    #modalNotificacionesComunidad .modal-title i {
        font-size: 14px;
    }

    #modalNotificacionesComunidad .modal-body {
        max-height: 320px;
    }

    #modalNotificacionesComunidad .modal-footer {
        padding: 8px 12px;
    }

    #modalNotificacionesComunidad .modal-footer .btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    .notificacion-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .notificacion-avatar {
        width: 36px;
        height: 36px;
    }

    .notificacion-avatar .avatar-placeholder-small {
        font-size: 12px;
    }

    .notificacion-avatar::after {
        width: 15px;
        height: 15px;
        font-size: 7px;
    }

    .notificacion-text {
        font-size: 11px;
    }

    .notificacion-fecha {
        font-size: 9px;
    }

    .notificacion-preview .preview-img,
    .notificacion-preview .preview-icon {
        width: 36px;
        height: 36px;
    }

    .notificacion-preview .preview-icon {
        font-size: 14px;
    }

    .notificaciones-empty {
        padding: 30px 16px;
    }

    .notificaciones-empty i {
        font-size: 40px;
        margin-bottom: 16px;
    }

    .notificaciones-empty h5 {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .notificaciones-empty p {
        font-size: 11px;
    }

    #notificaciones-lista-modal .text-center.py-5 {
        padding: 40px 16px !important;
    }

    #notificaciones-lista-modal .spinner-border {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }

    #notificaciones-lista-modal .text-muted.mt-3 {
        font-size: 12px;
    }
}

/* ============================================
   MODO PANTALLA COMPLETA EN MÓVIL
   ============================================ */
@media (max-width: 400px) {
    #modalNotificacionesComunidad .modal-dialog {
        max-width: 100%;
        margin: 0;
        height: 100vh;
    }

    #modalNotificacionesComunidad .modal-content {
        height: 100vh;
        border-radius: 0;
    }

    #modalNotificacionesComunidad .modal-body {
        max-height: calc(100vh - 120px);
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
.notificacion-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.notificacion-item[tabindex="0"] {
    cursor: pointer;
}

/* Reducir animaciones para usuarios que las prefieran */
@media (prefers-reduced-motion: reduce) {
    .notificacion-item {
        animation: none;
    }
    
    .notificacion-item.no-leida.nueva {
        animation: none;
    }
}

/* ============================================
   ESTADOS HOVER MEJORADOS
   ============================================ */
.notificacion-item:hover .notificacion-avatar .avatar-img,
.notificacion-item:hover .notificacion-avatar .avatar-placeholder-small {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.notificacion-item:hover .notificacion-preview .preview-img {
    transform: scale(1.05);
    transition: transform 0.2s ease;
    border-color: var(--primary-color);
}

/* ============================================
   BADGE CONTADOR EN EL TÍTULO (OPCIONAL)
   ============================================ */
#modalNotificacionesComunidad .modal-title .badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* ============================================
   SEPARADOR TEMPORAL (por día)
   ============================================ */
.notificacion-separador {
    padding: 8px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ============================================
   PRINT STYLES (ocultar en impresión)
   ============================================ */
@media print {
    #modalNotificacionesComunidad {
        display: none !important;
    }
}