/**
 * Therafull PWA Styles
 * Progressive Web App için özel stiller
 */

/* ==========================================
   PWA Install Banner
   ========================================== */
.pwa-install-banner {
  position: fixed;
  bottom: -200px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  z-index: 999999;
  transition: bottom 0.3s ease-in-out;
  font-family: 'Poppins', sans-serif;
}

.pwa-install-banner.show {
  bottom: 0;
}

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

.pwa-banner-icon img {
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

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

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

.pwa-banner-text p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
  max-width: 100%;
  overflow-wrap: break-word;
}

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

.pwa-install-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 10px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.pwa-close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pwa-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* ==========================================
   Network Status Banner
   ========================================== */
.network-status-banner {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: white;
  padding: 12px 24px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999999;
  transition: top 0.3s ease;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}

.network-status-banner.offline {
  background: #ef4444;
}

.network-status-banner.show {
  top: 0;
}

/* ==========================================
   PWA Update Notification
   ========================================== */
.pwa-update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 20px;
  z-index: 999999;
  max-width: 350px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.pwa-update-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.pwa-update-content p {
  margin: 0 0 15px 0;
  font-weight: 500;
  color: #1f2937;
}

.pwa-update-content button {
  margin-right: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

#pwa-update-btn {
  background: #667eea;
  color: white;
}

#pwa-update-btn:hover {
  background: #5568d3;
}

#pwa-update-close {
  background: #e5e7eb;
  color: #6b7280;
}

#pwa-update-close:hover {
  background: #d1d5db;
}

/* ==========================================
   PWA Standalone Mode
   ========================================== */
body.pwa-standalone {
  /* Standalone modda özel ayarlar */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* iOS Safari için */
@supports (-webkit-touch-callout: none) {
  body.pwa-standalone {
    padding-top: max(env(safe-area-inset-top), 20px);
  }
}

/* ==========================================
   Splash Screen Styles
   ========================================== */
.pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  animation: fadeOut 0.5s ease 2s forwards;
}

.pwa-splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 30px;
  animation: pulse 1.5s ease infinite;
}

.pwa-splash-text {
  color: white;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 15px;
}

.pwa-splash-loading {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

@keyframes fadeOut {
  to { opacity: 0; visibility: hidden; }
}

/* ==========================================
   Mobile Responsive
   ========================================== */
@media (max-width: 768px) {
  .pwa-banner-text p {
    display: none;
  }
  
  .pwa-banner-content {
    gap: 10px;
  }
  
  .pwa-install-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .pwa-update-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .pwa-banner-icon img {
    width: 40px;
    height: 40px;
  }
  
  .pwa-banner-text strong {
    font-size: 14px;
  }
  
  .pwa-install-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ==========================================
   PWA Loading Indicator
   ========================================== */
.pwa-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform-origin: left;
  animation: loading 2s ease-in-out infinite;
  z-index: 999999;
}

@keyframes loading {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(0.5); }
  100% { transform: scaleX(1); }
}

/* ==========================================
   PWA Install Button (Custom)
   ========================================== */
.pwa-custom-install-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pwa-custom-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.pwa-custom-install-btn::before {
  content: '📱';
  font-size: 18px;
}

/* ==========================================
   Offline Page Styles
   ========================================== */
.offline-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #ef4444;
  color: white;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  z-index: 999999;
  display: none;
}

.offline-indicator.show {
  display: block;
}

/* ==========================================
   PWA Share Button
   ========================================== */
.pwa-share-btn {
  background: transparent;
  border: 2px solid #667eea;
  color: #667eea;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.pwa-share-btn:hover {
  background: #667eea;
  color: white;
}

/* ==========================================
   iOS Safari Specific
   ========================================== */
@supports (-webkit-touch-callout: none) {
  /* iOS için özel ayarlar */
  .pwa-install-banner {
    padding-bottom: max(15px, env(safe-area-inset-bottom));
  }
}

/* ==========================================
   Dark Mode Support
   ========================================== */
@media (prefers-color-scheme: dark) {
  .pwa-update-notification {
    background: #1f2937;
  }
  
  .pwa-update-content p {
    color: #f9fafb;
  }
  
  #pwa-update-close {
    background: #374151;
    color: #9ca3af;
  }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
  .pwa-install-banner,
  .network-status-banner,
  .pwa-update-notification {
    display: none !important;
  }
}
