body {
  background-color: #f8f9fa;
  padding-top: env(safe-area-inset-top);
}

.app-header {
  background-color: #007bff;
  color: white;
  padding-top: 1.5rem; /* fallback per dispositivi senza safe area */
  position: relative;
  z-index: 1;
}


.app-footer {
  background-color: #e9ecef;
  color: #6c757d;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.product-card:hover {
  transform: translateY(-2px);
}

.image-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.image-preview:hover {
  transform: scale(1.05);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  flex-grow: 1;
  font-size: 1rem;
  font-weight: 500;
}

.notification-switch {
  margin-left: auto;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #007bff;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.image-modal.active {
  display: flex;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  animation: zoomIn 0.3s ease;
}

.modal-content img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.close-modal {
  position: absolute;
  top: -40px;
  right: -40px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 5px;
  transition: opacity 0.2s;
}

.close-modal:hover {
  opacity: 0.8;
}

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
  }
  
  .close-modal {
    top: 20px;
    right: 20px;
    font-size: 30px;
  }
}

#toggle-all {
  transition: all 0.3s ease;
}

#toggle-all:hover {
  transform: translateY(-1px);
}

/* overlay richieste notifiche */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding-top: env(safe-area-inset-top);
}
.overlay.hidden {
  display: none;
}
.overlay-content {
  background: #fff;
  padding: 2rem;
  border-radius: 0.5rem;
  text-align: center;
  max-width: 90%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#notification-overlay p {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}


@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: calc(env(safe-area-inset-top) + 1.5rem);
  }
  .status-bar-spacer {
    height: env(safe-area-inset-top);
    background-color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
  }
  
  body {
    padding-top: env(safe-area-inset-top);
  }
  
  .overlay {
    padding-top: env(safe-area-inset-top);
  }
}


/* già dovresti avere qualcosa del genere per image-modal: */
.overlay {
  position: fixed;
  top: 0; left: 0; right:0; bottom:0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay.hidden { display: none; }
.overlay-content {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  max-width: 90%;
  width: 300px;
  text-align: center;
}

/* Per le modalità standalone su iOS */
@media all and (display-mode: standalone) {
  .status-bar-spacer {
    display: block;
  }
}
