/**
 * PWA Styles
 * Styles for Progressive Web App components
 */

/* Install Banner */
.awp-pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0;
  padding-top: env(safe-area-inset-top, 0px);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
  backdrop-filter: blur(12px);
}

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

/* Banner content - matches JS class names */
.awp-pwa-install-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  max-width: 100%;
  margin: 0 auto;
}

.awp-pwa-install-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px;
  overflow: hidden;
}

.awp-pwa-install-icon svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2.5;
}

.awp-pwa-install-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.awp-pwa-install-text p {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  letter-spacing: 0.01em;
  color: white;
}

.awp-pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.awp-pwa-install-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.01em;
}

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

.awp-pwa-install-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.awp-pwa-install-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  flex-shrink: 0;
  opacity: 0.8;
}

.awp-pwa-install-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  opacity: 1;
  transform: scale(1.05);
}

.awp-pwa-install-close:active {
  transform: scale(0.95);
  opacity: 0.9;
}

.awp-pwa-install-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* iOS Install Instructions */
.awp-pwa-ios-instructions {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
  backdrop-filter: blur(4px);
}

.awp-pwa-ios-instructions-visible {
  opacity: 1;
  visibility: visible;
}

.awp-pwa-ios-instructions-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.awp-pwa-ios-instructions-content h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 500;
  color: #1a1a1a;
}

.awp-pwa-ios-instructions-content ol {
  margin: 0;
  padding-left: 20px;
  color: #4a4a4a;
  line-height: 1.8;
}

.awp-pwa-ios-instructions-content li {
  margin-bottom: 8px;
}

.awp-pwa-ios-instructions-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
  padding: 0;
}

.awp-pwa-ios-instructions-close:hover {
  background: #f0f0f0;
}

/* Share Button */
.awp-pwa-share-btn {
  position: fixed;
  z-index: 999997;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.awp-pwa-share-btn:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.awp-pwa-share-btn:not(.awp-pwa-share-btn-center-left):not(.awp-pwa-share-btn-center-right):not(.awp-pwa-share-btn-custom):hover {
  transform: scale(1.08) translateY(-2px);
}

.awp-pwa-share-btn-center-left:hover,
.awp-pwa-share-btn-center-right:hover {
  transform: translateY(-50%) scale(1.08);
}

.awp-pwa-share-btn:active {
  transform: scale(0.95);
}

.awp-pwa-share-btn-center-left:active,
.awp-pwa-share-btn-center-right:active {
  transform: translateY(-50%) scale(0.95);
}

.awp-pwa-share-btn svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2;
}

.awp-pwa-share-btn-top-left {
  top: 100px;
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-share-btn-top-right {
  top: 100px;
  right: max(24px, env(safe-area-inset-right));
}

.awp-pwa-share-btn-bottom-left {
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-share-btn-bottom-right {
  bottom: max(24px, env(safe-area-inset-bottom));
  right: max(24px, env(safe-area-inset-right));
}

.awp-pwa-share-btn-center-left {
  left: max(24px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

.awp-pwa-share-btn-center-right {
  right: max(24px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
}

/* Notifications Button */
.awp-pwa-notifications-btn {
  position: fixed;
  z-index: 999997;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
  transition: all 0.3s;
  padding: 0;
  position: relative;
}

.awp-pwa-notifications-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(245, 87, 108, 0.5);
}

.awp-pwa-notifications-btn:active {
  transform: scale(0.95);
}

.awp-pwa-notifications-btn svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

.awp-pwa-notifications-btn-enabled {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.awp-pwa-notifications-btn-enabled:hover {
  box-shadow: 0 6px 16px rgba(79, 172, 254, 0.5);
}

.awp-pwa-notifications-btn-disabled {
  background: #999;
  box-shadow: 0 4px 12px rgba(153, 153, 153, 0.4);
  opacity: 0.6;
}

.awp-pwa-notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4444;
  color: white;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  padding: 0 6px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.awp-pwa-notifications-btn-top-left {
  top: 100px;
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-notifications-btn-top-right {
  top: 100px;
  right: max(24px, env(safe-area-inset-right));
}

.awp-pwa-notifications-btn-bottom-left {
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-notifications-btn-bottom-right {
  bottom: max(24px, env(safe-area-inset-bottom));
  right: max(24px, env(safe-area-inset-right));
}

/* Install Button (Site Redirect) */
.awp-pwa-install-btn-floating {
  position: fixed;
  z-index: 999997;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.awp-pwa-install-btn-floating:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.awp-pwa-install-btn-floating:not(.awp-pwa-install-btn-floating-center-left):not(.awp-pwa-install-btn-floating-center-right):not(.awp-pwa-install-btn-floating-custom):hover {
  transform: scale(1.08) translateY(-2px);
}

.awp-pwa-install-btn-floating-center-left:hover,
.awp-pwa-install-btn-floating-center-right:hover {
  transform: translateY(-50%) scale(1.08);
}

.awp-pwa-install-btn-floating:active {
  transform: scale(0.95);
}

.awp-pwa-install-btn-floating-center-left:active,
.awp-pwa-install-btn-floating-center-right:active {
  transform: translateY(-50%) scale(0.95);
}

.awp-pwa-install-btn-floating svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2;
}

.awp-pwa-install-btn-floating-top-left {
  top: 100px;
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-install-btn-floating-top-right {
  top: 100px;
  right: max(24px, env(safe-area-inset-right));
}

.awp-pwa-install-btn-floating-bottom-left {
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
}

.awp-pwa-install-btn-floating-bottom-right {
  bottom: max(24px, env(safe-area-inset-bottom));
  right: max(24px, env(safe-area-inset-right));
}

.awp-pwa-install-btn-floating-center-left {
  left: max(24px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

.awp-pwa-install-btn-floating-center-right {
  right: max(24px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
}

/* Sağ-alt köşe varsayılan olarak PrintWise sohbet asistanı (chatbot) ile
   paylaşılır; masaüstü/tablette ikisi de fixed konumlandığı için üst üste
   binmemesi adına paylaşım/kurulum/bildirim butonlarını asistan FAB'ının
   üstüne kaydırıyoruz. Mobilde (≤768px) bu kontroller JS ile alt gezinme
   çubuğuna taşınır (bkz. mobile-ux-layer.css/js), bu yüzden burada dokunmuyoruz. */
@media (min-width: 769px) {
  body:has(.awp-assistant) .awp-pwa-share-btn-bottom-right,
  body:has(.awp-assistant) .awp-pwa-notifications-btn-bottom-right,
  body:has(.awp-assistant) .awp-pwa-install-btn-floating-bottom-right {
    bottom: calc(max(24px, env(safe-area-inset-bottom)) + 68px);
  }
}

/* Desktop stacking adjustments */
@media (min-width: 769px) {
  /* Bottom-right stacking */
  .awp-pwa-share-btn-bottom-right ~ .awp-pwa-install-btn-floating-bottom-right,
  .awp-pwa-notifications-btn-bottom-right
    ~ .awp-pwa-install-btn-floating-bottom-right {
    bottom: 96px;
  }

  /* Bottom-left stacking */
  .awp-pwa-share-btn-bottom-left ~ .awp-pwa-install-btn-floating-bottom-left,
  .awp-pwa-notifications-btn-bottom-left
    ~ .awp-pwa-install-btn-floating-bottom-left {
    bottom: 96px;
  }

  /* Top stacking */
  .awp-pwa-share-btn-top-right ~ .awp-pwa-install-btn-floating-top-right,
  .awp-pwa-notifications-btn-top-right
    ~ .awp-pwa-install-btn-floating-top-right {
    top: 172px;
  }

  .awp-pwa-share-btn-top-left ~ .awp-pwa-install-btn-floating-top-left,
  .awp-pwa-notifications-btn-top-left ~ .awp-pwa-install-btn-floating-top-left {
    top: 172px;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .awp-pwa-install-content {
    padding: 12px 16px;
    gap: 12px;
  }

  .awp-pwa-install-icon {
    width: 36px;
    height: 36px;
    padding: 7px;
    border-radius: 6px;
  }

  .awp-pwa-install-icon svg {
    width: 18px;
    height: 18px;
  }

  .awp-pwa-install-text p {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
  }

  .awp-pwa-install-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 7px;
    font-weight: 500;
  }

  .awp-pwa-install-close {
    width: 26px;
    height: 26px;
  }

  .awp-pwa-install-close svg {
    width: 15px;
    height: 15px;
  }

  .awp-pwa-share-btn,
  .awp-pwa-notifications-btn,
  .awp-pwa-install-btn-floating {
    width: 52px;
    height: 52px;
  }

  .awp-pwa-share-btn svg,
  .awp-pwa-notifications-btn svg,
  .awp-pwa-install-btn-floating svg {
    width: 22px;
    height: 22px;
  }

  /* Symmetric positioning for mobile - all buttons have same spacing */
  .awp-pwa-share-btn-bottom-right,
  .awp-pwa-notifications-btn-bottom-right,
  .awp-pwa-install-btn-floating-bottom-right {
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
  }

  .awp-pwa-share-btn-bottom-left,
  .awp-pwa-notifications-btn-bottom-left,
  .awp-pwa-install-btn-floating-bottom-left {
    bottom: max(20px, env(safe-area-inset-bottom));
    left: max(20px, env(safe-area-inset-left));
  }

  .awp-pwa-share-btn-top-right,
  .awp-pwa-notifications-btn-top-right,
  .awp-pwa-install-btn-floating-top-right {
    top: 80px;
    right: max(20px, env(safe-area-inset-right));
  }

  .awp-pwa-share-btn-top-left,
  .awp-pwa-notifications-btn-top-left,
  .awp-pwa-install-btn-floating-top-left {
    top: 80px;
    left: max(20px, env(safe-area-inset-left));
  }

  .awp-pwa-share-btn-center-left,
  .awp-pwa-install-btn-floating-center-left {
    left: max(16px, env(safe-area-inset-left));
  }

  .awp-pwa-share-btn-center-right,
  .awp-pwa-install-btn-floating-center-right {
    right: max(16px, env(safe-area-inset-right));
  }
}

/* Ensure buttons don't overlap - stacking with proper spacing */
@media (max-width: 768px) {
  /* Bottom-right stacking: Share button above install button */
  .awp-pwa-share-btn-bottom-right ~ .awp-pwa-install-btn-floating-bottom-right,
  .awp-pwa-notifications-btn-bottom-right
    ~ .awp-pwa-install-btn-floating-bottom-right {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  /* Bottom-left stacking: Share button above install button */
  .awp-pwa-share-btn-bottom-left ~ .awp-pwa-install-btn-floating-bottom-left,
  .awp-pwa-notifications-btn-bottom-left
    ~ .awp-pwa-install-btn-floating-bottom-left {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  /* When share and notifications are both on same side */
  .awp-pwa-share-btn-bottom-right + .awp-pwa-notifications-btn-bottom-right,
  .awp-pwa-notifications-btn-bottom-right + .awp-pwa-share-btn-bottom-right {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .awp-pwa-share-btn-bottom-left + .awp-pwa-notifications-btn-bottom-left,
  .awp-pwa-notifications-btn-bottom-left + .awp-pwa-share-btn-bottom-left {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  /* Top stacking */
  .awp-pwa-share-btn-top-right ~ .awp-pwa-install-btn-floating-top-right,
  .awp-pwa-notifications-btn-top-right
    ~ .awp-pwa-install-btn-floating-top-right {
    top: 148px;
  }

  .awp-pwa-share-btn-top-left ~ .awp-pwa-install-btn-floating-top-left,
  .awp-pwa-notifications-btn-top-left ~ .awp-pwa-install-btn-floating-top-left {
    top: 148px;
  }
}
