/* ============================================
   UX Enhancements - SEO Safe Optimizations
   - Mobile Touch Optimization
   - Accessibility Improvements  
   - Loading States & Skeleton Screens
   - Empty States Design
   - Microcopy Enhancements
   - Brand Consistency
   ============================================ */

/* ==========================================
   1. MOBILE TOUCH OPTIMIZATION
   ========================================== */

/* Ensure all interactive elements meet 44x44px minimum touch target */
@media (max-width: 768px) {
  .btn,
  .nav-links a,
  .access-link,
  .download-card .btn,
  .pricing-card .btn,
  .channel-item .btn,
  .faq-question,
  .dropdown-menu a,
  .menu-toggle {
    min-height: 44px;
    min-width: 44px;
  }

  /* Enhance button touch areas */
  .btn {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Navigation links touch enhancement */
  .nav-links a {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Access items touch enhancement */
  .access-link {
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
  }

  /* Dropdown menu touch enhancement */
  .nav-links .dropdown-menu a {
    padding: 14px 20px;
    min-height: 48px;
  }

  /* User guide cards touch enhancement */
  .user-guide a {
    min-height: 120px;
    padding: 25px 20px;
  }
}

/* Touch feedback - active states */
.btn:active,
.nav-links a:active,
.access-link:active,
.download-card:active,
.pricing-card:active,
.channel-item:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Prevent text selection on touch for interactive elements */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .nav-links a,
  .access-item,
  .download-card,
  .pricing-card,
  .faq-question {
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
    -webkit-touch-callout: none;
    user-select: none;
  }
}

/* ==========================================
   2. ACCESSIBILITY OPTIMIZATION
   ========================================== */

/* Focus visible styles for keyboard navigation */
:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 12px 24px;
  z-index: 10000;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}

/* Enhanced focus states for interactive elements */
.btn:focus-visible,
.nav-links a:focus-visible,
.access-link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Focus styles for cards */
.card:focus-visible,
.download-card:focus-visible,
.pricing-card:focus-visible,
.access-item:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }

  .card,
  .download-card,
  .pricing-card {
    border-width: 2px;
  }

  .nav-links a {
    text-decoration: underline;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-wave-decor,
  .soundwave-bar,
  .gradient-line {
    animation: none !important;
  }
}

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

/* Ensure proper color contrast for text */
.text-contrast-light {
  color: #1e293b;
  background-color: #ffffff;
}

.text-contrast-dark {
  color: #f8fafc;
  background-color: #1e293b;
}

/* ==========================================
   3. SKELETON LOADING STATES
   ========================================== */

/* Skeleton base styles */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton variants */
.skeleton-text {
  height: 16px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-title {
  height: 28px;
  width: 60%;
  margin-bottom: 16px;
  border-radius: 6px;
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: 12px;
}

.skeleton-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.skeleton-button {
  height: 48px;
  width: 150px;
  border-radius: 8px;
}

.skeleton-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* Card loading state */
.card-loading,
.download-card-loading,
.pricing-card-loading {
  position: relative;
  overflow: hidden;
}

.card-loading::after,
.download-card-loading::after,
.pricing-card-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ==========================================
   4. EMPTY STATES DESIGN
   ========================================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 64px;
  color: var(--secondary-color);
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 24px;
  color: var(--text-color);
  margin-bottom: 12px;
  font-weight: 600;
}

.empty-state-description {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 24px;
  line-height: 1.6;
}

.empty-state-action {
  margin-top: 20px;
}

/* Search empty state */
.search-empty {
  background: var(--light-bg);
  padding: 40px;
  border-radius: 16px;
  border: 2px dashed var(--border-color);
}

.search-empty-icon {
  font-size: 48px;
  color: var(--accent-color);
  margin-bottom: 16px;
}

/* Model empty state */
.model-empty {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 50px 30px;
  border-radius: 16px;
}

.model-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.model-empty-icon i {
  font-size: 36px;
  color: var(--primary-color);
}

/* Error state */
.error-state {
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 40px;
  border-radius: 16px;
}

.error-state-icon {
  font-size: 48px;
  color: var(--danger-color);
  margin-bottom: 16px;
}

/* ==========================================
   5. MICROCOPY ENHANCEMENTS
   ========================================== */

/* Help text styling */
.help-text {
  font-size: 0.875em;
  color: var(--text-light);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-text i {
  color: var(--accent-color);
}

/* Success message */
.success-message {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95em;
}

.success-message i {
  color: #10b981;
  font-size: 1.2em;
}

/* Warning message */
.warning-message {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95em;
}

.warning-message i {
  color: #f59e0b;
  font-size: 1.2em;
}

/* Error message */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95em;
}

.error-message i {
  color: #ef4444;
  font-size: 1.2em;
}

/* Info message */
.info-message {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95em;
}

.info-message i {
  color: #3b82f6;
  font-size: 1.2em;
}

/* Inline validation states */
.input-error {
  border-color: var(--danger-color) !important;
  background-color: #fef2f2 !important;
}

.input-success {
  border-color: #10b981 !important;
  background-color: #ecfdf5 !important;
}

.input-warning {
  border-color: var(--warning-color) !important;
  background-color: #fffbeb !important;
}

/* Button loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: btn-spin 0.8s linear infinite;
}

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

/* Button states */
.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

/* ==========================================
   6. BRAND CONSISTENCY
   ========================================== */

/* Design tokens documentation via CSS custom properties */
:root {
  /* Brand Colors */
  --brand-primary: #6366f1;
  --brand-secondary: #94a3b8;
  --brand-accent: #f59e0b;
  --brand-success: #10b981;
  --brand-warning: #fbbf24;
  --brand-danger: #f87171;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Border Radius Scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadow Scale */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Animation Timing */
  --ease-fast: 150ms;
  --ease-normal: 250ms;
  --ease-slow: 400ms;
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Consistent component styles */
.brand-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--ease-normal) ease;
}

.brand-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
  transition: all var(--ease-fast) ease;
  cursor: pointer;
  border: none;
}

.brand-button-primary {
  background: var(--brand-primary);
  color: white;
}

.brand-button-primary:hover {
  background: var(--primary-hover);
}

/* ==========================================
   7. TOOLTIP & POPOVER
   ========================================== */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--ease-fast) ease;
  z-index: 1000;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: all var(--ease-fast) ease;
}

.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ==========================================
   8. PROGRESS INDICATORS
   ========================================== */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--light-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width var(--ease-slow) ease;
}

.progress-bar-success .progress-bar-fill {
  background: var(--brand-success);
}

.progress-bar-warning .progress-bar-fill {
  background: var(--brand-warning);
}

/* Steps progress */
.steps-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-bg);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-light);
  transition: all var(--ease-normal) ease;
}

.step-indicator.active .step-number {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: white;
}

.step-indicator.completed .step-number {
  background: var(--brand-success);
  border-color: var(--brand-success);
  color: white;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 8px;
  margin-bottom: 24px;
}

.step-line.completed {
  background: var(--brand-success);
}

/* ==========================================
   9. RESPONSIVE ENHANCEMENTS
   ========================================== */

@media (max-width: 768px) {
  .empty-state {
    padding: 40px 16px;
  }

  .empty-state-icon {
    font-size: 48px;
  }

  .empty-state-title {
    font-size: 20px;
  }

  .steps-progress {
    flex-direction: column;
    gap: 16px;
  }

  .step-line {
    width: 2px;
    height: 24px;
    margin: 0;
  }
}

/* ==========================================
   10. PRINT STYLES
   ========================================== */

@media print {
  .skip-link,
  .menu-toggle,
  .hero-wave-decor,
  .soundwave-container {
    display: none !important;
  }

  .btn {
    border: 1px solid currentColor;
    background: white !important;
    color: black !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}
