/* ===================================
   NOTIFICHE IN-APP — Corebeet Design System
   ===================================
   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 — stile Corebeet: accent, zero border-radius */
.notification-badge {
    font-size: 0.65rem !important;
    font-weight: 700;
    min-width: 18px;
    padding: 0.15em 0.45em;
    line-height: 1.3;
    vertical-align: middle;
    border-radius: 0 !important;
    background-color: #E34824 !important;
    color: #fff !important;
    letter-spacing: 0.02em;
}

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

.notification-dropdown {
    width: 380px;
    max-width: calc(100vw - 2rem);
    border: 1px solid #e0e1e3 !important;
    border-radius: 0 !important;
    box-shadow: 0 8px 24px rgba(21, 21, 21, 0.12);
    overflow: hidden;
}

/* Header */
.notification-header {
    background-color: #EEEFF0;
    border-bottom: 1px solid #e0e1e3;
    padding: 0.75rem 1rem;
}

.notification-header h6 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #151515;
    margin: 0;
}

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

/* Scrollbar personalizzata — coerente con il resto dell'app */
.notification-list::-webkit-scrollbar {
    width: 4px;
}
.notification-list::-webkit-scrollbar-track {
    background: #EEEFF0;
}
.notification-list::-webkit-scrollbar-thumb {
    background-color: #c4c5c7;
}
.notification-list::-webkit-scrollbar-thumb:hover {
    background-color: #E34824;
}

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

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

.notification-item:hover {
    background-color: rgba(227, 72, 36, 0.03);
    text-decoration: none;
    color: inherit;
}

/* Notifica non letta: accent bar sinistra + sfondo leggero */
.notification-item.unread {
    background-color: rgba(227, 72, 36, 0.04);
    border-left: 3px solid #E34824;
    padding-left: calc(1rem - 3px); /* compensa il border per mantenere allineamento */
}

.notification-item.unread:hover {
    background-color: rgba(227, 72, 36, 0.07);
}

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

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

/* Icona notifica — icon-box quadrata Corebeet */
.notification-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background-color: rgba(107, 114, 128, 0.08);
    border: 1px solid rgba(107, 114, 128, 0.15);
}

/* Varianti colore icona per tipo — palette semantica Corebeet */
.notification-icon.text-warning {
    background-color: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.15);
    color: #d97706 !important;
}
.notification-icon.text-danger {
    background-color: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.15);
    color: #dc2626 !important;
}
.notification-icon.text-primary {
    background-color: rgba(227, 72, 36, 0.08);
    border-color: rgba(227, 72, 36, 0.15);
    color: #E34824 !important;
}
.notification-icon.text-info {
    background-color: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.15);
    color: #0891b2 !important;
}
.notification-icon.text-success {
    background-color: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.15);
    color: #059669 !important;
}

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

.notification-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    line-height: 1.3;
    color: #151515;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-message {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.2rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.68rem;
    color: #9ca3af;
    font-weight: 500;
}

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

.notification-footer {
    border-top: 1px solid #e0e1e3;
    background-color: #EEEFF0;
    padding: 0.6rem 1rem;
}

.notification-footer a {
    font-size: 0.78rem;
    font-weight: 600;
    color: #E34824;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: color 0.2s ease;
}

.notification-footer a:hover {
    color: #c93d1e;
    text-decoration: underline;
}

/* ===== TOAST NOTIFICHE — Corebeet flat ===== */

.notification-toast {
    min-width: 320px;
    max-width: 400px;
    border: 1px solid #e0e1e3 !important;
    border-radius: 0 !important;
    box-shadow: 0 8px 24px rgba(21, 21, 21, 0.12);
    overflow: hidden;
    border-left: 4px solid #E34824 !important;
}

.notification-toast .toast-header {
    background-color: #EEEFF0;
    border-bottom: 1px solid #e0e1e3;
    border-radius: 0 !important;
    padding: 0.5rem 0.75rem;
}

.notification-toast .toast-header .me-auto {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #151515;
}

.notification-toast .toast-header small {
    font-size: 0.68rem;
    color: #9ca3af;
}

/* Pulsante chiudi toast */
.notification-toast .toast-header .btn-close {
    filter: none;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}
.notification-toast .toast-header .btn-close:hover {
    opacity: 1;
}

.notification-toast .toast-body {
    padding: 0.75rem;
    font-size: 0.82rem;
    background-color: #fff;
}

.notification-toast .toast-body .toast-message {
    color: #151515;
    line-height: 1.45;
}

.notification-toast .toast-body .toast-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #E34824;
    text-decoration: none;
    transition: color 0.2s ease;
}
.notification-toast .toast-body .toast-link:hover {
    color: #c93d1e;
    text-decoration: underline;
}

/* Varianti colore toast — palette semantica Corebeet */
.notification-toast.toast-warning { border-left-color: #d97706 !important; }
.notification-toast.toast-danger  { border-left-color: #dc2626 !important; }
.notification-toast.toast-success { border-left-color: #059669 !important; }
.notification-toast.toast-info    { border-left-color: #0891b2 !important; }

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

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

.notification-item-new {
    animation: slideIn 0.25s 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);
    }
}
