/* Variablen für konsistentes Design */
:root {
  --amazon-orange: #FF9900;
  --amazon-orange-dark: #e88a00;
  --card-bg-color: #ffffff;
  --card-bg-color-dark: #1A202C;
  --text-color: #2D3748;
  --text-color-dark: #E2E8F0;
  --border-color: #E2E8F0;
  --border-color-dark: #4A5568;
  --error-color: #E53E3E;
  --success-color: #48BB78;
}

.bg-amazon {
  background-color: var(--amazon-orange) !important;
}

.hover\:bg-orange-600:hover {
  background-color: var(--amazon-orange-dark) !important;
}

.dark {
  --card-bg-color: var(--card-bg-color-dark);
  --text-color: var(--text-color-dark);
  --border-color: var(--border-color-dark);
}

/* Accessibility - Screenreader-only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Fokus-Stile für Keyboard-Navigation */
:focus {
  outline: 2px solid var(--amazon-orange);
  outline-offset: 2px;
}

.dark :focus {
  outline-color: #FFD700;
}

/* Skip-Link für Keyboard-Benutzer */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--amazon-orange);
  color: white;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 0;
}

/* Collapsible Form */
.collapsible-form {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.collapsible-form.expanded {
  max-height: 200px;
}

/* Button Styles */
.compact-button {
  background-color: var(--amazon-orange);
  color: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.compact-button:hover {
  background-color: var(--amazon-orange-dark);
  transform: translateY(-1px);
}

.compact-button:active {
  transform: translateY(0) scale(0.98);
}

.compact-button .button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.compact-button .icon-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Button states */
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

button:active {
  transform: scale(0.98);
}

/* Toast Notifications */
.clipboard-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--card-bg-color);
  color: var(--text-color);
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 1050;
  max-width: 350px;
  font-size: 0.9rem;
  border-left: 4px solid var(--amazon-orange);
  animation: fadeInUp 0.3s ease-out;
}

.clipboard-toast .toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: bold;
}

.clipboard-toast .toast-body {
  word-break: break-word;
}

.clipboard-toast.success {
  background-color: rgba(72, 187, 120, 0.9);
  color: white;
  border-left: 4px solid #38A169;
}

.clipboard-toast.error {
  background-color: rgba(229, 62, 62, 0.9);
  color: white;
  border-left: 4px solid #C53030;
}

/* QR Code */
#qrcode {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  min-height: 150px;
}

#qrcode img {
  max-width: 150px;
  height: auto;
  border-radius: 6px;
}

.qr-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 150px;
  width: 150px;
  color: var(--amazon-orange);
  font-size: 2rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Loading Indicator */
#loading .animate-spin {
  animation: spin 1s linear infinite;
}

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

/* History Item */
.history-item {
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
  transition: background-color 0.2s;
}

.history-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark .history-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Install Button */
#install-app-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  padding: 12px 20px;
  background-color: var(--amazon-orange);
  color: white;
  border-radius: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: none;
}

#install-app-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInUp 0.3s ease-out;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .card {
    margin: 0.25rem auto;
    max-width: 100%;
  }
  
  .instruction-text {
    font-size: 0.7rem;
    gap: 0.3rem;
  }
  
  .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }
  
  /* Vergrößerte Touch-Targets für Mobile */
  button, 
  input[type="submit"],
  .btn {
    min-height: 44px;
  }
  
  .history-item {
    padding: 12px 8px;
  }
  
  #install-app-btn {
    bottom: 10px;
    right: 10px;
    padding: 10px 16px;
  }
  
  .clipboard-toast {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* iOS Optimizations */
@supports (-webkit-touch-callout: none) {
  .min-h-screen {
    min-height: -webkit-fill-available;
  }
  
  input[type="text"], 
  input[type="url"] {
    border-radius: 8px;
    -webkit-appearance: none;
  }
  
  /* iOS-spezifische Einstellungen */
  .ios-instructions {
    font-size: 0.85rem;
    line-height: 1.3;
  }
}

/* Utility Classes */
.no-tap-highlight {
  -webkit-tap-highlight-color: transparent;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* iOS Standalone Mode */
@media all and (display-mode: standalone) {
  body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .standalone-only {
    display: block;
  }
  
  .browser-only {
    display: none;
  }
  
  /* Spezieller Header-Bereich für iOS */
  .ios-standalone-header {
    padding-top: 0;
    padding-top: env(safe-area-inset-top);
  }
}

/* Dark mode adjustments for better contrast */
.dark .text-gray-500 {
  color: #A0AEC0;
}

.dark .text-gray-400 {
  color: #CBD5E0;
}

/* iOS-spezifische Toast-Anpassungen */
@supports (-webkit-touch-callout: none) {
  /* iOS-Geräte erkennen */
  .clipboard-toast {
    /* Schmaler und weniger prägnant */
    max-width: 280px;
    width: auto;
    padding: 6px 10px;  /* Reduziertes Padding */
    font-size: 0.75rem; /* Kleinere Schrift */
    border-radius: 12px;
    opacity: 0.9;
    
    /* Position anpassen */
    bottom: 15px;
    left: auto;
    right: 15px;
    
    /* Schatten reduzieren */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    
    /* Animationen optimieren */
    animation: fadeInUpSmall 0.2s ease-out;
    
    /* Höhe reduzieren */
    line-height: 1.1;  /* Kompaktere Zeilenhöhe */
  }
  
  /* Toast-Header in iOS kleiner */
  .clipboard-toast .toast-header {
    margin-bottom: 2px; /* Reduzierter Abstand */
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    min-height: unset; /* Entfernt minimale Höhe, falls vorhanden */
  }
  
  /* Toast-Body in iOS kleiner */
  .clipboard-toast .toast-body {
    font-size: 0.75rem;
    line-height: 1.2;
    padding-top: 0;
    padding-bottom: 1px;
  }
  
  /* Optimierung für Buttons im Toast */
  .clipboard-toast button {
    padding: 2px;
    margin-left: 5px;
  }
  
  /* Kleinere Fade-In-Animation für Toast */
  @keyframes fadeInUpSmall {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 0.9;
      transform: translateY(0);
    }
  }
}

/* Spezifische Anpassung für kleinere iOS-Geräte */
@media (max-width: 375px) and (-webkit-touch-callout: none) {
  .clipboard-toast {
    max-width: 250px;
    padding: 4px 8px; /* Noch kompakteres Padding für kleine Geräte */
    font-size: 0.7rem;
    bottom: 10px;
    right: 10px;
  }
  
  .clipboard-toast .toast-header {
    margin-bottom: 1px;
  }
  
  .clipboard-toast .toast-body {
    line-height: 1.1;
  }
}
