/* ====================================
   HOMESCREEN WALLPAPER LAYER
   ==================================== */
.home-wallpaper {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: cover;
  background-position: center;
}

/* Usa wallpaper personalizzato */
.home-wallpaper.custom-wallpaper {
  background-image: url('../assets/images/homescreen.jpg');
  background-size: cover;
  background-position: center;
}

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

/* ====================================
   HOMESCREEN CONTENT LAYER
   ==================================== */

#homescreenPage .content {
  animation: fadeIn 0.5s ease;
}


/* ====================================
   APP GRID CONTAINER
   ==================================== */
.apps-container {
  position: relative;
  z-index: 1;
  padding: 60px 20px 120px; /* Ridotto padding top per status bar */
  height: calc(100vh - 44px); /* Altezza meno status bar */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 16px;
  max-width: 100%;
}

/* ====================================
   APP ICON
   ==================================== */
.app-icon-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  animation: scaleIn 0.4s ease;
  animation-fill-mode: backwards;
}

/* Stagger animation per ogni icona */
.app-icon-wrapper:nth-child(1) { animation-delay: 0.05s; }
.app-icon-wrapper:nth-child(2) { animation-delay: 0.1s; }
.app-icon-wrapper:nth-child(3) { animation-delay: 0.15s; }
.app-icon-wrapper:nth-child(4) { animation-delay: 0.2s; }
.app-icon-wrapper:nth-child(5) { animation-delay: 0.25s; }
.app-icon-wrapper:nth-child(6) { animation-delay: 0.3s; }
.app-icon-wrapper:nth-child(7) { animation-delay: 0.35s; }
.app-icon-wrapper:nth-child(8) { animation-delay: 0.4s; }

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden; /* NUOVO: per IMG */
  padding: 10px; /* NUOVO: spazio interno per IMG */
  position: relative;
}

/* NUOVO: Supporto per immagini nelle icone */
.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* NUOVO: Icona senza padding (per IMG che riempiono tutto) */
.app-icon.no-padding {
  padding: 0;
}

/* NUOVO: Icona con background colorato */
.app-icon.colored-bg {
  background: var(--icon-color, rgba(255, 255, 255, 0.25));
}

/* NUOVO: Icona con gradiente */
.app-icon.gradient-bg {
  background: var(--icon-gradient);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
/* NUOVO: Icona con gradiente */
.app-icon.white-bg {
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
}


/* Hover/Active state */
.app-icon-wrapper:active .app-icon {
  transform: scale(0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.app-name {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ====================================
   DOCK (bottom bar con app fisse)
   ==================================== */
.dock {
  position: fixed;
  bottom: 30px;
  left: 20px;
  right: 20px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 20px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.dock .app-icon {
  width: 60px;
  height: 60px;
  border-radius: 13px;
  overflow: hidden; /* NUOVO */
  padding: 8px; /* NUOVO: per IMG */
}

/* NUOVO: Dock icon senza padding */
.dock .app-icon.no-padding {
  padding: 0;
}

.dock .app-icon-wrapper {
  gap: 0;
}

.dock .app-name {
  display: none; /* nel dock iOS non si vedono i nomi */
}

/* NUOVO: Supporto IMG nel dock */
.dock .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ====================================
   HOME INDICATOR (barra bottom)
   ==================================== */
.home-indicator {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 5px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 3px;
  z-index: 100;
}

/* ====================================
   PAGE DOTS (pagination indicator)
   ==================================== */
.page-dots {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.page-dot.active {
  background: rgba(255, 255, 255, 1);
  width: 20px;
  border-radius: 4px;
}

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 390px) {
  .app-icon {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }
  
  .apps-grid {
    gap: 18px 14px;
  }
}

@media (max-width: 375px) {
  .app-icon {
    width: 58px;
    height: 58px;
    font-size: 34px;
  }
  
  .app-name {
    font-size: 11px;
  }
  
  .apps-grid {
    gap: 16px 12px;
  }
  
  .dock .app-icon {
    width: 56px;
    height: 56px;
  }
}

/* ====================================
   SPECIAL APP STYLES
   ==================================== */
/* App San Valentino - tema rosa/rosso */
.app-valentino .app-icon {
  background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* App Giorni Insieme - tema blu */
.app-giorni .app-icon {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* App Foto - tema arcobaleno */
.app-foto .app-icon {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* App Messaggi - tema verde */
.app-messaggi .app-icon {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
