/**
 * PWA Install Button Styles
 * Mobile-first design for BlackJackTrainer PRO
 */

/* Install Button - Mobile First */
.pwa-install-button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.pwa-install-button.pwa-install-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  animation: slideDownPWA 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-button.pwa-install-minimized {
  top: 0.5rem;
  right: 0.5rem;
  transform: scale(0.95);
}

.pwa-install-button.pwa-install-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50px);
}

.pwa-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #00d4ff 0%, #00a5cc 100%);
  color: #0a0e17;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4),
              0 2px 8px rgba(0, 212, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

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

.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.5),
              0 4px 12px rgba(0, 212, 255, 0.4);
  background: linear-gradient(135deg, #00e5ff 0%, #00b8e6 100%);
}

.pwa-install-btn i {
  font-size: 1.1rem;
}

.pwa-install-text {
  font-size: 1rem;
  letter-spacing: 0.3px;
}

@keyframes slideDownPWA {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* iOS Guide Modal - Mobile First */
.pwa-ios-guide-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 20000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeInModal 0.3s ease-out;
}

.pwa-ios-guide-modal[style*="flex"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pwa-ios-guide-content {
  background: linear-gradient(135deg, rgba(26, 33, 56, 0.98) 0%, rgba(10, 14, 23, 0.98) 100%);
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(0, 212, 255, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 0 40px rgba(0, 212, 255, 0.1);
  animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}

.pwa-ios-guide-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.25rem;
  transition: all 0.3s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

.pwa-ios-guide-close:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.2);
}

.pwa-ios-guide-header {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.pwa-ios-guide-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: floatIcon 3s ease-in-out infinite;
}

.pwa-ios-guide-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #00d4ff 0%, #00ff96 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pwa-ios-guide-header p {
  font-size: 1rem;
  color: #b8c2d9;
  margin: 0;
  line-height: 1.5;
}

.pwa-ios-guide-steps {
  padding: 1.5rem;
}

.pwa-ios-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.pwa-ios-step:last-child {
  margin-bottom: 0;
}

.pwa-ios-step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff 0%, #00a5cc 100%);
  color: #0a0e17;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.pwa-ios-step-content {
  flex: 1;
  padding-top: 0.25rem;
}

.pwa-ios-step-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.pwa-ios-step-content p {
  font-size: 0.95rem;
  color: #b8c2d9;
  margin: 0;
  line-height: 1.6;
}

.pwa-ios-step-content strong {
  color: #00d4ff;
  font-weight: 600;
}

.pwa-ios-icon {
  font-size: 1.2rem;
  display: inline-block;
  margin: 0 0.25rem;
}

/* Apple Share Icon (real iOS icon) */
.pwa-ios-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.25rem;
  width: 24px;
  height: 24px;
}

.pwa-ios-share-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* App Icon Preview in instructions */
.pwa-app-icon-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.5rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background: #fff;
  padding: 2px;
}

.pwa-app-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.pwa-ios-guide-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  margin: 1rem 1.5rem;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  flex-wrap: wrap;
}

.pwa-ios-visual-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 80px;
}

.pwa-ios-visual-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 212, 255, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

/* Apple Share Icon in visual guide */
.pwa-share-icon-visual {
  background: rgba(0, 122, 255, 0.1);
  border-color: rgba(0, 122, 255, 0.3);
  padding: 8px;
}

.pwa-share-icon-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* App Icon in visual guide */
.pwa-app-icon-visual {
  background: #fff;
  padding: 4px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pwa-app-icon-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.pwa-ios-visual-step p {
  font-size: 0.75rem;
  color: #b8c2d9;
  text-align: center;
  margin: 0;
  line-height: 1.3;
}

.pwa-ios-visual-arrow {
  font-size: 1.5rem;
  color: #00d4ff;
  font-weight: 700;
}

.pwa-ios-guide-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(0, 212, 255, 0.2);
  background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 23, 0.5) 100%);
}

.pwa-ios-guide-got-it {
  width: 100%;
  background: linear-gradient(135deg, #00d4ff 0%, #00a5cc 100%);
  color: #0a0e17;
  border: none;
  border-radius: 50px;
  padding: 1rem 2rem;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  -webkit-tap-highlight-color: transparent;
}

.pwa-ios-guide-got-it:active {
  transform: scale(0.98);
}

.pwa-ios-guide-got-it:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.5);
  background: linear-gradient(135deg, #00e5ff 0%, #00b8e6 100%);
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatIcon {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
  .pwa-install-button {
    top: 1.5rem;
    right: 1.5rem;
  }

  .pwa-install-btn {
    padding: 1rem 2rem;
    font-size: 1.05rem;
    min-width: 180px;
    gap: 0.75rem;
  }

  .pwa-ios-guide-content {
    max-width: 550px;
    border-radius: 28px;
  }

  .pwa-ios-guide-header {
    padding: 3rem 2rem 2rem;
  }

  .pwa-ios-guide-icon {
    font-size: 4rem;
  }

  .pwa-ios-guide-header h2 {
    font-size: 2rem;
  }

  .pwa-ios-guide-header p {
    font-size: 1.1rem;
  }

  .pwa-ios-guide-steps {
    padding: 2rem;
  }

  .pwa-ios-step {
    margin-bottom: 2rem;
  }

  .pwa-ios-step-number {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .pwa-ios-step-content h3 {
    font-size: 1.2rem;
  }

  .pwa-ios-step-content p {
    font-size: 1rem;
  }

  .pwa-ios-visual-icon {
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
  }

  .pwa-ios-visual-step p {
    font-size: 0.85rem;
  }

  .pwa-app-icon-preview {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 1024px) {
  .pwa-install-button {
    top: 2rem;
    right: 2rem;
  }

  .pwa-ios-guide-content {
    max-width: 600px;
  }
}

/* Prevent button from showing on very small screens if needed */
@media (max-width: 320px) {
  .pwa-install-button {
    top: 0.75rem;
    right: 0.75rem;
  }

  .pwa-install-btn {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    min-width: auto;
    gap: 0.4rem;
  }

  .pwa-install-text {
    font-size: 0.85rem;
  }

  .pwa-install-btn i {
    font-size: 1rem;
  }
}

/* Update Notification Button */
.pwa-update-button {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  width: 100%;
  max-width: 500px;
  padding: 0 1rem;
}

.pwa-update-button.pwa-update-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  animation: slideDownUpdate 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-update-button.pwa-update-minimized {
  top: 0.5rem;
  transform: translateX(-50%) scale(0.95);
}

.pwa-update-button.pwa-update-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-50px);
}

.pwa-update-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(26, 33, 56, 0.98) 0%, rgba(10, 14, 23, 0.98) 100%);
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3),
              0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.pwa-update-icon {
  font-size: 1.5rem;
  animation: rotateUpdate 2s linear infinite;
  flex-shrink: 0;
}

.pwa-update-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pwa-update-text strong {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.pwa-update-text span {
  color: #b8c2d9;
  font-size: 0.85rem;
  line-height: 1.3;
}

.pwa-update-btn {
  background: linear-gradient(135deg, #00d4ff 0%, #00a5cc 100%);
  color: #0a0e17;
  border: none;
  border-radius: 50px;
  padding: 0.625rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 212, 255, 0.4);
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

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

.pwa-update-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.5);
  background: linear-gradient(135deg, #00e5ff 0%, #00b8e6 100%);
}

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

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

/* Tablet and Desktop - Update Button */
@media (min-width: 768px) {
  .pwa-update-button {
    top: 1.5rem;
    max-width: 600px;
  }

  .pwa-update-content {
    padding: 1.25rem 1.5rem;
  }

  .pwa-update-text strong {
    font-size: 1rem;
  }

  .pwa-update-text span {
    font-size: 0.9rem;
  }

  .pwa-update-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* Hide on print */
@media print {
  .pwa-install-button,
  .pwa-ios-guide-modal,
  .pwa-update-button {
    display: none !important;
  }
}

