/* ========================================================================== 
   Notification Bell & Panel Styles
   ========================================================================== */

/* Notificación Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #be123c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 2px solid #ffffff;
    z-index: 10;
}

.notification-bell {
    position: relative;
    transition: all 0.2s ease;
}

.notification-bell:hover {
    transform: scale(1.1);
    color: #1d4ed8;
}

.notification-bell.has-unread {
    animation: bellRing 0.5s ease-in-out;
}

@keyframes bellRing {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Panel de Notificaciones (Offcanvas) */
.notifications-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1040;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notifications-offcanvas.show {
    transform: translateX(0);
}

@media (max-width: 480px) {
    .notifications-offcanvas {
        max-width: 100%;
    }
}

.notifications-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header del Panel */
.notifications-header {
    padding: 1rem;
    border-bottom: 1px solid #d9e2ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fafc;
    flex-shrink: 0;
}

.notifications-header h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.notifications-header i {
    color: #be123c;
}

.btn-close-notifications {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-close-notifications:hover {
    color: #1f2937;
}

/* Contenido del Panel */
.notifications-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.notification-item {
    padding: 1rem;
    border-left: 3px solid #be123c;
    background-color: #fef2f2;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.notification-item:hover {
    background-color: #fee2e2;
    box-shadow: 0 2px 8px rgba(190, 18, 60, 0.1);
}

.notification-item.read {
    border-left-color: #15803d;
    background-color: #f0fdf4;
}

.notification-item.read:hover {
    background-color: #dcfce7;
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.notification-item-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
    margin: 0;
}

.notification-item-time {
    font-size: 0.8rem;
    color: #64748b;
}

.notification-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.notification-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    color: #334155;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.notification-item-content {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.notification-item-department {
    display: inline-block;
    background-color: #1d4ed8;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.notification-item-footer {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.notification-item-action {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid #d9e2ef;
    background-color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-item-action:hover {
    background-color: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}

.notification-item-action.danger {
    color: #be123c;
}

.notification-item-action.danger:hover {
    background-color: #be123c;
    color: white;
    border-color: #be123c;
}

/* Placeholder - Sin notificaciones */
.no-notifications-placeholder {
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
}

.no-notifications-placeholder i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: block;
}

.no-notifications-placeholder p {
    margin: 0;
    font-size: 0.95rem;
}

/* Loading State */
.notifications-loading {
    text-align: center;
    padding: 2rem 1rem;
}

.notifications-loading::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #1d4ed8;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Topbar adjustments */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-icon.notification-bell {
    position: relative;
}

/* Overlay oscuro cuando el panel está abierto */
@media (min-width: 480px) {
    body.notifications-open::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.3);
        z-index: 1039;
    }
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .notifications-offcanvas {
        max-width: 85vw;
    }

    .notification-item {
        padding: 0.75rem;
    }

    .notification-item-header {
        flex-direction: column;
    }

    .notification-item-time {
        margin-top: 0.25rem;
    }
}
