/* ===================================
   NOTIFICHE IN-APP - Stili
   ===================================
   Da importare nel _Layout.cshtml:
   <link rel="stylesheet" href="~/css/notifications.css" asp-append-version="true" />
   Posizionarlo DOPO site.css
   =================================== */

/* ===== CAMPANELLA ===== */

#notificationBell .nav-link {
    padding: 0.5rem 0.75rem;
    transition: opacity 0.2s ease;
}

#notificationBell .nav-link:hover {
    opacity: 0.85;
}

/* Animazione "shake" quando arriva una nuova notifica */
@keyframes bellShake {
    0% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-14deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-8deg); }
    75% { transform: rotate(4deg); }
    85% { transform: rotate(-2deg); }
    100% { transform: rotate(0); }
}

.bell-shake {
    animation: bellShake 0.6s ease-in-out;
}

/* Badge counter - inline accanto alla campanella */
.notification-badge {
    font-size: 0.7rem !important;
    min-width: 20px;
    padding: 0.2em 0.5em;
    line-height: 1.3;
    vertical-align: middle;
}

/* ===== DROPDOWN ===== */

.notification-dropdown {
    width: 380px;
    max-width: calc(100vw - 2rem);
    border: none;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Header */
.notification-header {
    background-color: #f8f9fa;
}

.notification-header h6 {
    font-size: 0.875rem;
    color: #333;
}

/* Lista scrollabile */
.notification-list {
    max-height: 400px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar personalizzata */
.notification-list::-webkit-scrollbar {
    width: 4px;
}

.notification-list::-webkit-scrollbar-track {
    background: transparent;
}

.notification-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* ===== SINGOLA NOTIFICA ===== */

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: inherit;
    gap: 0.75rem;
}

.notification-item:hover {
    background-color: #f0f7ff;
    text-decoration: none;
    color: inherit;
}

/* Notifica non letta: bordo sinistro colorato + sfondo leggero */
.notification-item.unread {
    background-color: #f0f7ff;
    border-left: 3px solid #0d6efd;
}

.notification-item.unread:hover {
    background-color: #e0efff;
}

/* Notifica letta */
.notification-item.read {
    opacity: 0.7;
}

.notification-item.read:hover {
    opacity: 1;
}

/* Icona notifica */
.notification-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background-color: #e9ecef;
}

/* Varianti colore icona per tipo */
.notification-icon.text-warning { background-color: #fff3cd; }
.notification-icon.text-danger { background-color: #f8d7da; }
.notification-icon.text-primary { background-color: #cfe2ff; }
.notification-icon.text-info { background-color: #cff4fc; }
.notification-icon.text-success { background-color: #d1e7dd; }

/* Contenuto */
.notification-content {
    flex: 1;
    min-width: 0; /* Per text-overflow */
}

.notification-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    line-height: 1.3;
    color: #1a1a1a;
    /* Truncate con ellipsis */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-message {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
    line-height: 1.4;
    /* Max 2 righe */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.6875rem;
    color: #adb5bd;
}

/* ===== FOOTER ===== */

.notification-footer a {
    font-size: 0.8125rem;
    color: #0d6efd;
}

.notification-footer a:hover {
    color: #0a58ca;
}

/* ===== TOAST NOTIFICHE ===== */

.notification-toast {
    min-width: 320px;
    max-width: 400px;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    overflow: hidden;
    border-left: 4px solid #0d6efd;
}

.notification-toast .toast-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0.5rem 0.75rem;
}

.notification-toast .toast-header .me-auto {
    font-size: 0.8125rem;
    font-weight: 600;
}

.notification-toast .toast-header small {
    font-size: 0.6875rem;
    color: #adb5bd;
}

.notification-toast .toast-body {
    padding: 0.75rem;
    font-size: 0.8125rem;
}

.notification-toast .toast-body .toast-message {
    color: #495057;
    line-height: 1.4;
}

.notification-toast .toast-body .toast-link {
    font-size: 0.75rem;
    text-decoration: none;
}

/* Varianti colore toast per tipo */
.notification-toast.toast-warning { border-left-color: #ffc107; }
.notification-toast.toast-danger { border-left-color: #dc3545; }
.notification-toast.toast-success { border-left-color: #198754; }
.notification-toast.toast-info { border-left-color: #0dcaf0; }

/* ===== ANIMAZIONE ENTRATA NOTIFICA ===== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-item-new {
    animation: slideIn 0.3s ease-out;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 576px) {
    .notification-dropdown {
        width: calc(100vw - 1rem);
        position: fixed !important;
        top: 56px !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        transform: none !important;
    }

    .notification-list {
        max-height: 50vh;
    }

    .notification-toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}
