/* ====================================
   LOCKSCREEN CONTAINER
   ==================================== */
.lockscreen {
  width: 100%;
  height: 100vh; /* ✅ Wallpaper copre tutto inclusa barra */
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.lockscreen.custom-wallpaper {
  background-image: url('../assets/images/lockscreen.jpg');
  background-size: cover;
  background-position: center;
}

/* Opzionale: usa una foto vostra come wallpaper */
.lockscreen.custom-wallpaper {
  background-image: url('../assets/images/lockscreen.jpg');
  background-size: cover;
  background-position: center;
}

/* Overlay scuro per leggibilità testo */
.lockscreen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

/* ====================================
   CONTENT WRAPPER (area visibile svh)
   ==================================== */
.lockscreen-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100svh; /* ✅ Solo area visibile */
  height: 100vh; /* Fallback */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 60px 20px 40px;
  pointer-events: none; /* Permette touch attraverso */
}

.lockscreen-content > * {
  pointer-events: auto; /* Riabilita touch sui figli */
}

/* ====================================
   ORARIO E DATA (top)
   ==================================== */
.lockscreen-time {
  text-align: center;
  margin-top: 40px;
}

.lockscreen-time .time {
  font-size: 80px;
  font-weight: 300;
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.lockscreen-time .date {
  font-size: 18px;
  font-weight: 500;
  margin-top: 8px;
  opacity: 0.95;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* ====================================
   NOTIFICHE AREA (bottom-up stack)
   ==================================== */
.notifications-container {
  position: absolute; /* ✅ Relativo a .lockscreen-content */
  bottom: 140px;
  left: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-height: 50vh;
  overflow: visible;
}


/* Wrapper per notifica + elimina button */
.notification-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
}

.notification-lock {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 2;
  cursor: grab;
  touch-action: pan-y;
  /* Transizione più fluida */
  transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}

.notification-lock:active {
  cursor: grabbing;
}

/* Animazione entrata dal basso */
.notification-wrapper {
  animation: slideUpNotif 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpNotif {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Durante lo swipe */
.notification-lock.swiping {
  transition: none; /* rimuovi transition durante drag */
  transform: translateX(var(--swipe-x, 0));
  opacity: var(--swipe-opacity, 1);
}

/* Animazione dismissal finale */
.notification-wrapper.dismissed-left .notification-lock {
  animation: dismissLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.notification-wrapper.dismissed-right .notification-lock {
  animation: dismissRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes dismissLeft {
  to {
    transform: translateX(-120%);
    opacity: 0;
  }
}

@keyframes dismissRight {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Animazione collasso wrapper dopo dismiss */
.notification-wrapper.dismissed-left,
.notification-wrapper.dismissed-right {
  animation: collapseNotification 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

@keyframes collapseNotification {
  from {
    max-height: 100px;
    margin-bottom: 8px;
    opacity: 1;
  }
  to {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
  }
}

/* ====================================
   PULSANTE "ELIMINA" SOTTO NOTIFICA
   ==================================== */
.delete-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: stretch;
  z-index: 1;
  pointer-events: none;
}

/* Elimina a sinistra (quando swipe verso destra) */
.delete-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, #ff3b30 0%, #ff6b6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px 0 0 20px;
  opacity: 0;
  transform: translateX(-100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Elimina a destra (quando swipe verso sinistra) */
.delete-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, #ff6b6b 0%, #ff3b30 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 20px 20px 0;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Mostra "Elimina" durante swipe */
.notification-wrapper.swiping-left .delete-right {
  opacity: 1;
  transform: translateX(0);
}

.notification-wrapper.swiping-right .delete-left {
  opacity: 1;
  transform: translateX(0);
}

.delete-text {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ====================================
   CONTENUTO NOTIFICA
   ==================================== */
.notification-lock .notif-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  overflow: hidden; /* per icone PNG */
  padding: 8px; /* spazio interno */
}

/* Se l'icona è un'immagine */
.notif-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Variante: icona senza background blur (più pulita) */
.notif-icon.no-bg {
  background: transparent;
  backdrop-filter: none;
  padding: 0;
}

/* Variante: icona con background colorato */
.notif-icon.colored-bg {
  background: var(--icon-color, rgba(255, 255, 255, 0.2));
}

.notification-lock .notif-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.notification-lock .notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.notification-lock .app-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.notification-lock .notif-time {
  font-size: 13px;
  opacity: 0.7;
  font-weight: 400;
}

.notification-lock .notif-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.3;
}

.notification-lock .notif-message {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.95;
  line-height: 1.4;
}


/* ====================================
   SWIPE INDICATOR (bottom)
   ==================================== */
.swipe-indicator {
  position: absolute; /* ✅ Relativo a .lockscreen-content */
  bottom: 30px;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
}


.swipe-bar {
  width: 150px;
  height: 5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 3px;
  margin: 0 auto 12px;
  animation: swipePulse 2s infinite;
}

.swipe-text {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.8;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.swipe-arrow {
  font-size: 18px;
  animation: bounceUp 1.5s infinite;
}

@keyframes swipePulse {
  0%, 100% {
    opacity: 0.6;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes bounceUp {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ====================================
   SWIPE UP ANIMATION
   ==================================== */
.lockscreen.swiping {
  transition: transform 0.1s ease-out;
}

.lockscreen.unlocking {
  animation: unlockSlide 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  overflow: hidden;
}



/* ====================================
   FLASHLIGHT & CAMERA BUTTONS (optional)
   ==================================== */
.lockscreen-bottom-controls {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 2;
}

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 390px) {
  .lockscreen-time .time {
    font-size: 72px;
  }
  
  .notification-lock {
    padding: 14px;
  }
}

@media (max-width: 375px) {
  .lockscreen-time .time {
    font-size: 68px;
  }
  
  .lockscreen-time .date {
    font-size: 17px;
  }
  
  .notification-lock {
    padding: 12px;
    border-radius: 16px;
  }
}

/* ====================================
   FIX iOS Safari Safe Area
   ==================================== */
@supports (-webkit-touch-callout: none) {
  .lockscreen {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
  
  .notifications-container {
    bottom: calc(140px + env(safe-area-inset-bottom));
  }
  
  .swipe-indicator {
    bottom: calc(30px + env(safe-area-inset-bottom));
  }
  .lockscreen-content {
    height: 100svh;
  }
}




/* ====================================
   DARK WALLPAPER SUPPORT
   ==================================== */
.lockscreen.dark-wallpaper::before {
  background: rgba(0, 0, 0, 0.4);
}

.lockscreen.light-wallpaper::before {
  background: rgba(0, 0, 0, 0.1);
}

.lockscreen.light-wallpaper .lockscreen-time,
.lockscreen.light-wallpaper .swipe-text {
  color: #fff;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}
