/* ------------------------------------------------------- */
/* ------------------ ALERTES (POPUP) --------------------- */
/* ------------------------------------------------------- */

/* Fond assombri */
.pwa-alert-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start; 
  padding-top: 20px;      
  z-index: 3000000;
}

/* Fenêtre principale */
.pwa-alert-modal {
  background: #fff;
  border-radius: 14px;
  width: 90%;
  max-width: 600px; 
  padding: 20px 22px;
  box-shadow: 0 6px 25px rgba(0,0,0,0.25);
  font-family: "Segoe UI", Roboto, sans-serif;
  animation: fadeIn 0.3s ease;
  position: relative;
  border-left: 6px solid #b32121;

  max-height: 80vh;  
  overflow: hidden;  
}

/* Header */
.pwa-alert-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.pwa-alert-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pwa-bell-bg-1), var(--pwa-bell-bg-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color:#fff;
  font-size:20px;
  flex-shrink:0;
}
.pwa-alert-header h2 {
  margin: 0;
  font-size: 18px;
  color:#111;
  flex:1;
  font-weight:600;
}
.pwa-alert-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color:#999;
  transition: color .2s;
}
.pwa-alert-close:hover { color:#333; }

/* Contenu (scroll si long) */
.pwa-alert-content {
  font-size: 15px;
  line-height: 1.55;
  color: #333;
  white-space: normal;

  max-height: calc(80vh - 150px); 
  overflow-y: auto;
  padding-right: 4px;
  position: relative;
}

.pwa-alert-content p { margin: 8px 0; }
.pwa-alert-content a {
  color:#b32121;
  text-decoration: underline;
}

/* Effet dégradé en bas si scroll */
.pwa-alert-content::after {
  content:"";
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:40px;
  background:linear-gradient(to bottom, transparent, #fff);
  pointer-events:none;
}

/* Boutons */
.pwa-alert-actions {
  margin-top: 15px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
}
.pwa-btn-close, .pwa-btn-read {
  padding:8px 16px;
  border:none;
  border-radius:50px;
  cursor:pointer;
  font-size:14px;
  font-weight:600;
  transition: all .2s ease-in-out;
}
.pwa-btn-close {
  background:#eee;
  color:#333;
}
.pwa-btn-close:hover { background:#ddd; }
.pwa-btn-read {
  background:#b32121;
  color:#fff;
  box-shadow:0 3px 8px rgba(179,33,33,.3);
}
.pwa-btn-read:hover { background:#a11c1c; }

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------- */
/* ------------------ CLOCHE ------------------------------ */
/* ------------------------------------------------------- */

#newsAlert {
  position: fixed;
  z-index: 2000000;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--pwa-bell-bg-1), var(--pwa-bell-bg-2));
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Position haut droite */
.bell-position-top-right {
  top: 10px;
  right: 15px;
}

/* Position bas droite */
.bell-position-bottom-right {
  bottom: 20px;
  right: 15px;
}

/* Icône FA */
#newsAlert i {
  font-size: 22px;
  color: var(--pwa-bell-icon);
}

/* Badge noir avec "1" */
#newsBadge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--pwa-badge-bg);
  color: var(--pwa-badge-txt);
  font-size: 12px;
  font-weight: bold;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* --- ANIMATION PULSE --- */
@keyframes pwa-pulse {
  0% {
    /* On utilise la variable RGB calculée pour gérer la transparence */
    box-shadow: 0 0 0 0 rgba(var(--pwa-pulse-rgb), 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(var(--pwa-pulse-rgb), 0); 
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--pwa-pulse-rgb), 0);
  }
}

#newsAlert {
  animation: pwa-pulse 2s infinite; 
}


/* ------------------------------------------------------- */
/* ------------------ MOBILE OPTIMISÉ --------------------- */
/* ------------------------------------------------------- */

@media (max-width: 600px) {

  .pwa-alert-modal {
    width: 92%;
    max-width: 92%;
    padding: 12px 14px;     
    max-height: 75vh;       
    border-radius: 12px;
  }

  .pwa-alert-header h2 {
    font-size: 16px;
  }

  .pwa-alert-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .pwa-alert-content {
    max-height: calc(75vh - 130px);
    font-size: 14px;
    line-height: 1.45;
  }

  .pwa-alert-actions {
    gap: 8px;
  }

  .pwa-btn-close, .pwa-btn-read {
    padding: 6px 14px;
    font-size: 13px;
  }

  #newsAlert {
    width: 44px;
    height: 44px;
  }

  #newsAlert i {
    font-size: 19px;
  }
}