/**
 * notifications.css
 * Stili per il sistema di notifiche
 */

/* ==================== Notification Bell ==================== */
.notifications-container {
  position: relative;
}

.notification-bell {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.notification-bell:hover {
  background-color: var(--color-hover);
  transform: scale(1.05);
}

.notification-bell:active {
  transform: scale(0.95);
}

.notification-bell svg {
  width: 24px;
  height: 24px;
}

/* ==================== Notification Badge ==================== */
.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
  color: white;
  font-size: 10px;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  border: 2px solid var(--color-bg);
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* ==================== Notification Dropdown ==================== */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  max-height: 550px;
  background: var(--color-card-bg);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.7), 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(79, 172, 254, 0.3);
  display: none;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  backdrop-filter: blur(16px) saturate(180%);
  opacity: 1;
}

.notification-dropdown.show {
  display: flex;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== Notification Header ==================== */
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 2px solid var(--color-border);
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, var(--color-card-bg) 100%);
  backdrop-filter: blur(10px);
}

.notification-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mark-all-read {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.15) 0%, rgba(79, 172, 254, 0.05) 100%);
  border: 1px solid rgba(79, 172, 254, 0.3);
  color: var(--color-primary);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.1);
}

.mark-all-read:hover {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.25) 0%, rgba(79, 172, 254, 0.15) 100%);
  border-color: rgba(79, 172, 254, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.2);
}

.mark-all-read:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.1);
}

/* ==================== Notifications List ==================== */
.notifications-list {
  max-height: 400px;
  overflow-y: auto;
  background: var(--color-card-bg);
}

.notifications-list::-webkit-scrollbar {
  width: 8px;
}

.notifications-list::-webkit-scrollbar-track {
  background: var(--color-bg);
  border-radius: 4px;
}

.notifications-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.notifications-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-dim);
}

/* ==================== Notification Item ==================== */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.notification-item:hover {
  background-color: var(--color-hover);
  transform: translateX(2px);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: linear-gradient(90deg, 
    rgba(79, 172, 254, 0.08) 0%, 
    transparent 100%
  );
  border-left: 3px solid var(--color-primary);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-primary);
}

/* ==================== Notification Icon ==================== */
.notification-icon {
  font-size: 24px;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--color-bg);
}

.notification-icon.comunicazione {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(79, 172, 254, 0.1) 100%);
}

.notification-icon.warn {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 193, 7, 0.1) 100%);
}

.notification-icon.caso {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(52, 211, 153, 0.1) 100%);
}

.notification-icon.rollback {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2) 0%, rgba(167, 139, 250, 0.1) 100%);
}

/* ==================== Notification Content ==================== */
.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notification-message {
  font-size: 13px;
  color: var(--color-text-dim);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  font-size: 11px;
  color: var(--color-text-dimmer);
  font-weight: 500;
}

/* ==================== Delete Button ==================== */
.delete-btn {
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
  min-width: 28px;
  height: 28px;
}

.notification-item:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background-color: rgba(255, 71, 87, 0.1);
  color: #ff4757;
  transform: scale(1.1);
}

.delete-btn:active {
  transform: scale(0.95);
}

/* ==================== Empty State ==================== */
.notification-empty,
.notification-loading {
  padding: 50px 20px;
  text-align: center;
  color: var(--color-text-dim);
  font-size: 14px;
  font-weight: 500;
}

.notification-empty::before,
.notification-loading::before {
  content: '🔔';
  display: block;
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.notification-loading::before {
  content: '⏳';
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
  .notification-dropdown {
    width: calc(100vw - 32px);
    max-width: 400px;
    right: -16px;
    left: auto;
  }
}

@media (max-width: 480px) {
  .notification-dropdown {
    right: -32px;
  }
  
  .notification-header {
    padding: 12px;
  }
  
  .notification-item {
    padding: 12px;
  }
  
  .mark-all-read {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* ==================== Dark Mode Adjustments ==================== */
body.dark-mode .notification-badge {
  border-color: var(--color-bg);
}

body.dark-mode .notification-item.unread {
  background: linear-gradient(90deg, 
    rgba(79, 172, 254, 0.12) 0%, 
    transparent 100%
  );
}

body.dark-mode .notification-icon {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .notification-dropdown {
  background: rgba(26, 26, 46, 0.98);
  border-color: rgba(79, 172, 254, 0.4);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(79, 172, 254, 0.4);
  backdrop-filter: blur(20px);
}

body.dark-mode .mark-all-read {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(79, 172, 254, 0.1) 100%);
  border-color: rgba(79, 172, 254, 0.4);
  color: #4facfe;
}

body.dark-mode .mark-all-read:hover {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.3) 0%, rgba(79, 172, 254, 0.2) 100%);
  border-color: rgba(79, 172, 254, 0.6);
}
