/* ============================================================
   ENGELS811 SPOTIFY HQ – CALLBACK APPEARANCE
   ============================================================

   This file extends the settings page CSS for the OAuth
   Callback Appearance configuration.

   Features:
   - Live 1:1 Preview Container
   - Device Simulator (Desktop, Tablet, Mobile)
   - Zoom Control
   - Preview States (Success, Connecting, Error)
   - Background Configuration Forms

   Dependencies:
   - spotify-hq-system.css
   - spotify-hq-header.css
   - spotify-hq-shared.css
   - spotify-hq-settings.css

   ============================================================ */

/* ============================================================
   RADIO GROUP STYLING (for Background Mode Selection)
   ============================================================ */

.spotify-hq-radio-group {
  display: grid;
  gap: var(--spacing-md);
}

.spotify-hq-radio-item {
  display: flex;
  align-items: flex-start;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.spotify-hq-radio-item:hover {
  background: var(--glass-light);
  border-color: var(--border-red-glow);
}

.spotify-hq-radio-item input[type="radio"] {
  margin-top: 2px;
  margin-right: var(--spacing-md);
  cursor: pointer;
  accent-color: var(--engels-red);
  flex-shrink: 0;
}

.spotify-hq-radio-label {
  flex: 1;
}

.spotify-hq-radio-label strong {
  display: block;
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.spotify-hq-radio-label small {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ============================================================
   RANGE SLIDER (for Overlay Opacity & Blur)
   ============================================================ */

.spotify-hq-range-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.spotify-hq-range-input {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-subtle);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.spotify-hq-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--engels-red), var(--engels-red-bright));
  border: 2px solid var(--bg-card);
  cursor: pointer;
  box-shadow: var(--glow-red-md);
  transition: all var(--transition-fast);
}

.spotify-hq-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--glow-red-lg);
}

.spotify-hq-range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--engels-red), var(--engels-red-bright));
  border: 2px solid var(--bg-card);
  cursor: pointer;
  box-shadow: var(--glow-red-md);
  transition: all var(--transition-fast);
}

.spotify-hq-range-value {
  min-width: 50px;
  text-align: right;
  font-weight: 600;
  color: var(--engels-red-bright);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ============================================================
   FILE INPUT
   ============================================================ */

.spotify-hq-file-input {
  position: relative;
}

.spotify-hq-file-input input[type="file"] {
  display: block;
  width: 100%;
  padding: var(--spacing-xl) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-soft);
  background: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.spotify-hq-file-input input[type="file"]:hover {
  border-color: var(--border-red-glow);
  background: rgba(232, 24, 24, 0.05);
}

.spotify-hq-file-input input[type="file"]:focus {
  outline: none;
  border-color: var(--engels-red);
  box-shadow: var(--glow-red-md);
}

.spotify-hq-file-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--spacing-sm);
}

.spotify-hq-file-current {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.08);
  margin-top: var(--spacing-md);
}

.spotify-hq-file-current strong {
  display: block;
  color: var(--status-success);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-xs);
}

.spotify-hq-file-current code {
  display: block;
  word-break: break-all;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  margin-bottom: var(--spacing-sm);
}

/* ============================================================
   DIVIDER
   ============================================================ */

.spotify-hq-divider {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: var(--spacing-lg) 0;
}

.spotify-hq-divider--spaced {
  margin: var(--spacing-2xl) 0;
}

/* ============================================================
   DEVICE SELECTOR
   ============================================================ */

.spotify-callback-preview-devices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.spotify-callback-preview-device-btn {
  padding: var(--spacing-md) var(--spacing-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--glass-light);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.spotify-callback-preview-device-btn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border-color: var(--border-red-glow);
  color: var(--text-primary);
}

.spotify-callback-preview-device-btn.is-active {
  background: linear-gradient(135deg, rgba(232, 24, 24, 0.15), rgba(232, 24, 24, 0.08));
  border-color: var(--border-red-bright);
  color: var(--engels-red-bright);
  box-shadow: var(--glow-red-sm);
}

/* ============================================================
   ZOOM CONTROL
   ============================================================ */

.spotify-callback-preview-zoom {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--glass-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}

.spotify-callback-preview-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotify-callback-preview-zoom-btn:hover {
  background: var(--glass-lighter);
  border-color: var(--border-red-glow);
  color: var(--engels-red);
}

.spotify-callback-preview-zoom-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-subtle);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.spotify-callback-preview-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--engels-red), var(--engels-red-bright));
  border: 2px solid var(--bg-card);
  cursor: pointer;
  box-shadow: var(--glow-red-sm);
  transition: all var(--transition-fast);
}

.spotify-callback-preview-zoom-value {
  min-width: 40px;
  text-align: right;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--engels-red-bright);
  font-family: var(--font-mono);
}

/* ============================================================
   STATE SELECTOR
   ============================================================ */

.spotify-callback-preview-states {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.spotify-callback-preview-state-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.spotify-callback-preview-state-option:hover {
  background: var(--glass-light);
  border-color: var(--border-red-glow);
}

.spotify-callback-preview-state-option input[type="radio"] {
  cursor: pointer;
  accent-color: var(--engels-red);
}

.spotify-callback-preview-state-option input[type="radio"]:checked + span {
  color: var(--engels-red-bright);
}

/* ============================================================
   LIVE PREVIEW SECTION
   ============================================================ */

.spotify-callback-preview-container {
  width: 100%;
  height: 520px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  background: var(--bg-card);
  position: relative;
}

.spotify-hq-callback-preview-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.spotify-hq-callback-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
  z-index: 1;
}

.spotify-hq-callback-preview-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px;
  padding: 20px;
}

.spotify-hq-callback-preview-card {
  background: rgba(13, 11, 18, 0.95);
  border: 1px solid rgba(232, 24, 24, 0.28);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.spotify-hq-callback-preview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e81818, transparent);
  opacity: 0.6;
}

.spotify-hq-callback-preview-icon-wrapper {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 24, 24, 0.12);
  border: 1px solid rgba(232, 24, 24, 0.28);
  border-radius: 16px;
  animation: spotifyPulse 2s ease-in-out infinite;
}

.spotify-hq-callback-preview-icon {
  font-size: 40px;
  line-height: 1;
}

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

.spotify-hq-callback-preview-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(232, 24, 24, 0.15);
  border: 1px solid rgba(232, 24, 24, 0.28);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e81818;
  margin-bottom: 20px;
}

.spotify-hq-callback-preview-headline {
  margin: 0 0 12px 0;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  letter-spacing: -0.02em;
}

.spotify-hq-callback-preview-message {
  margin: 0 0 24px 0;
  font-size: 15px;
  line-height: 1.6;
  color: #9898b0;
}

.spotify-hq-callback-preview-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  background: #e81818;
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 8px 24px rgba(232, 24, 24, 0.3);
  width: 100%;
}

.spotify-hq-callback-preview-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(232, 24, 24, 0.4);
  filter: brightness(1.08);
}

.spotify-hq-callback-preview-button:active:not(:disabled) {
  transform: translateY(0);
}

.spotify-hq-callback-preview-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.spotify-hq-callback-preview-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  font-size: 12px;
  color: #5c5c74;
  font-weight: 500;
}

/* ============================================================
   CALLBACK CARD STATES (Success/Connecting/Error)
   ============================================================ */

.spotify-callback-card {
  animation: callbackCardFadeIn 0.4s ease-out;
}

@keyframes callbackCardFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Success State */
.spotify-callback-card[data-callback-state="success"] .spotify-callback-icon-wrapper {
  animation: spotifyPulse 2s ease-in-out infinite;
}

/* Connecting State */
.spotify-callback-card[data-callback-state="connecting"] .spotify-callback-icon-wrapper {
  animation: spotifyConnecting 1.5s ease-in-out infinite;
}

@keyframes spotifyConnecting {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

.spotify-callback-card[data-callback-state="connecting"] .spotify-callback-button {
  animation: buttonBlink 1s ease-in-out infinite;
}

@keyframes buttonBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Error State */
.spotify-callback-card[data-callback-state="error"] .spotify-callback-icon-wrapper {
  animation: spotifyError 0.5s ease-in-out 3;
}

@keyframes spotifyError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.spotify-callback-card[data-callback-state="error"] .spotify-callback-badge,
.spotify-callback-card[data-callback-state="error"] .spotify-callback-icon-wrapper {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================
   DEVICE SIMULATOR – Preview Responsive Sizes
   ============================================================ */

.spotify-callback-preview-container {
  transition: transform 0.3s ease;
}

/* Desktop */
.spotify-callback-preview-container[data-device="desktop"] {
  width: 100%;
  aspect-ratio: 16 / 9;
}

/* Tablet */
.spotify-callback-preview-container[data-device="tablet"] {
  width: 768px;
  aspect-ratio: 4 / 3;
  margin: 0 auto;
}

/* Mobile */
.spotify-callback-preview-container[data-device="mobile"] {
  width: 390px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 1100px) {
  .spotify-hq-callback-preview-container {
    height: 480px;
  }
}

@media (max-width: 768px) {
  .spotify-hq-range-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .spotify-hq-range-value {
    align-self: flex-end;
    text-align: right;
  }

  .spotify-hq-callback-preview-container {
    height: 420px;
  }

  .spotify-hq-callback-preview-card {
    padding: 32px 24px;
  }

  .spotify-hq-callback-preview-icon-wrapper {
    width: 60px;
    height: 60px;
  }

  .spotify-hq-callback-preview-icon {
    font-size: 32px;
  }

  .spotify-hq-callback-preview-headline {
    font-size: 1.5rem;
  }

  .spotify-hq-callback-preview-message {
    font-size: 14px;
  }

  .spotify-hq-callback-preview-button {
    padding: 12px 18px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .spotify-hq-callback-preview-container {
    height: 350px;
  }

  .spotify-hq-callback-preview-card {
    padding: 24px 16px;
    border-radius: 12px;
  }

  .spotify-hq-callback-preview-icon-wrapper {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }

  .spotify-hq-callback-preview-icon {
    font-size: 28px;
  }

  .spotify-hq-callback-preview-badge {
    font-size: 0.65rem;
    padding: 5px 12px;
    margin-bottom: 16px;
  }

  .spotify-hq-callback-preview-headline {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }

  .spotify-hq-callback-preview-message {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .spotify-hq-callback-preview-button {
    padding: 11px 16px;
    font-size: 12px;
  }

  .spotify-hq-callback-preview-footer {
    margin-top: 24px;
    padding-top: 16px;
    font-size: 11px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .spotify-hq-radio-item,
  .spotify-hq-range-input::-webkit-slider-thumb,
  .spotify-hq-range-input::-moz-range-thumb,
  .spotify-hq-file-input input[type="file"],
  .spotify-hq-callback-preview-card {
    transition: none;
    animation: none;
  }
}

@media (prefers-contrast: more) {
  .spotify-hq-radio-item {
    border-width: 2px;
  }

  .spotify-hq-file-input input[type="file"] {
    border-width: 2px;
  }

  .spotify-hq-callback-preview-container {
    border-width: 3px;
  }

  .spotify-hq-callback-preview-card {
    border-width: 2px;
  }

  .spotify-hq-callback-preview-button {
    box-shadow: 0 0 0 2px rgba(232, 24, 24, 0.5);
  }
}

/* ============================================================
   END: spotify-hq-callback-appearance.css
   ============================================================ */
