/**
 * PWA UI Styles
 * Styling für Install-Banner, Update-Benachrichtigungen und iOS-Hinweise
 */

/* ============================================
   INSTALL BANNER
============================================ */

.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #B78057 0%, #8B5A3C 100%);
  color: white;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
}

.pwa-install-banner.show {
  transform: translateY(0);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

.pwa-banner-icon img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: white;
  padding: 4px;
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-text strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.pwa-banner-text p {
  font-size: 13px;
  margin: 0;
  opacity: 0.9;
}

.pwa-banner-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-install {
  background: white;
  color: #B78057;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-install:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-install:active {
  transform: translateY(0);
}

.btn-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   UPDATE NOTIFICATION
============================================ */

.pwa-update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  z-index: 10000;
  transform: translateX(400px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
}

.pwa-update-notification.show {
  transform: translateX(0);
}

.update-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.update-icon {
  font-size: 24px;
  animation: rotate 2s linear infinite;
}

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

.update-text {
  flex: 1;
  font-weight: 600;
  color: #232323;
}

.btn-update {
  background: #B78057;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-update:hover {
  background: #8B5A3C;
  transform: translateY(-1px);
}

.btn-close-update {
  background: transparent;
  border: none;
  color: #666;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-close-update:hover {
  background: #f0f0f0;
}

/* ============================================
   CMS UPDATE BANNER (diskret)
============================================ */

.pwa-cms-update-banner {
  position: fixed;
  top: 80px;
  right: 20px;
  background: #4CAF50;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  z-index: 9998;
  transform: translateX(400px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}

.pwa-cms-update-banner.show {
  transform: translateX(0);
}

.cms-update-icon {
  font-size: 18px;
}

/* ============================================
   iOS INSTALL HINT
============================================ */

.pwa-ios-hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-ios-hint.show {
  transform: translateY(0);
}

.pwa-ios-hint.hide {
  transform: translateY(100%);
}

.ios-hint-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.ios-hint-text {
  flex: 1;
}

.ios-hint-text strong {
  display: block;
  font-size: 16px;
  margin-bottom: 8px;
  color: #232323;
}

.ios-hint-text p {
  font-size: 14px;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

.ios-hint-close {
  background: transparent;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.ios-hint-close:hover {
  background: #f0f0f0;
}

/* ============================================
   OFFLINE INDICATOR
============================================ */

.pwa-offline::before {
  content: '📡 Offline-Modus';
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff9800;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10001;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: slideDown 0.3s;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-60px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* ============================================
   STANDALONE MODE ANPASSUNGEN
============================================ */

.pwa-standalone {
  /* Zusätzlicher Padding für Standalone-Apps */
}

.pwa-standalone.pwa-ios {
  /* iOS-spezifische Anpassungen für Safe Area */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================
   RESPONSIVE ANPASSUNGEN
============================================ */

@media (max-width: 768px) {
  .pwa-install-banner {
    padding: 12px 15px;
  }

  .pwa-banner-content {
    flex-wrap: wrap;
    gap: 10px;
  }

  .pwa-banner-icon img {
    width: 40px;
    height: 40px;
  }

  .pwa-banner-text strong {
    font-size: 14px;
  }

  .pwa-banner-text p {
    font-size: 12px;
  }

  .pwa-banner-actions {
    width: 100%;
    margin-left: 55px; /* Align mit Text */
  }

  .btn-install {
    flex: 1;
    padding: 10px 15px;
  }

  .pwa-update-notification {
    right: 10px;
    left: 10px;
    top: 10px;
    max-width: none;
  }

  .pwa-cms-update-banner {
    right: 10px;
    left: 10px;
    top: 70px;
  }

  .pwa-ios-hint {
    padding: 15px;
  }

  .ios-hint-text strong {
    font-size: 15px;
  }

  .ios-hint-text p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .update-content {
    flex-wrap: wrap;
  }

  .btn-update,
  .btn-close-update {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ============================================
   PRINT STYLES (Banner ausblenden)
============================================ */

@media print {
  .pwa-install-banner,
  .pwa-update-notification,
  .pwa-cms-update-banner,
  .pwa-ios-hint,
  .pwa-offline::before {
    display: none !important;
  }
}

/* ============================================
   ACCESSIBILITY
============================================ */

@media (prefers-reduced-motion: reduce) {
  .pwa-install-banner,
  .pwa-update-notification,
  .pwa-cms-update-banner,
  .pwa-ios-hint,
  .update-icon {
    transition: none;
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .pwa-install-banner,
  .pwa-update-notification,
  .pwa-cms-update-banner {
    border: 2px solid currentColor;
  }
}

/* Dark Mode (optional für zukünftige Erweiterung) */
@media (prefers-color-scheme: dark) {
  .pwa-update-notification {
    background: #2d2d2d;
    color: white;
  }

  .update-text {
    color: white;
  }

  .btn-close-update {
    color: #ccc;
  }

  .btn-close-update:hover {
    background: #444;
  }

  .pwa-ios-hint {
    background: #2d2d2d;
    color: white;
  }

  .ios-hint-text strong {
    color: white;
  }

  .ios-hint-text p {
    color: #ccc;
  }

  .ios-hint-close {
    color: #ccc;
  }

  .ios-hint-close:hover {
    background: #444;
  }
}
