/**
 * Shared CSS for AITOPIA Store
 *
 * Used by:
 *   - public/store.html (main store)
 *   - public/agent/*.html (static detail pages)
 *   - public/category/*.html (static category pages)
 *
 * This ensures visual consistency across all store pages.
 * Works alongside Tailwind CDN - these are additions/overrides.
 */

/* =============================================================================
   CSS CUSTOM PROPERTIES
   ============================================================================= */

/* Light mode (default) */
:root {
  /* Background & Foreground */
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;

  /* Primary (Purple) */
  --primary: 262 83% 58%;
  --primary-foreground: 0 0% 100%;

  /* Secondary */
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;

  /* Muted */
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;

  /* Border */
  --border: 214.3 31.8% 91.4%;

  /* iOS System Colors */
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-orange: #FF9500;
  --ios-red: #FF3B30;
  --ios-purple: #AF52DE;
  --ios-teal: #5AC8FA;
}

/* Dark mode */
.dark {
  /* Background & Foreground */
  --background: 0 0% 4%;
  --foreground: 0 0% 98%;
  --card: 0 0% 7%;
  --card-foreground: 0 0% 98%;

  /* Primary (Purple) */
  --primary: 262 83% 58%;
  --primary-foreground: 0 0% 100%;

  /* Secondary */
  --secondary: 0 0% 15%;
  --secondary-foreground: 0 0% 98%;

  /* Muted */
  --muted: 0 0% 15%;
  --muted-foreground: 0 0% 64%;

  /* Border */
  --border: 0 0% 18%;
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   GLASSMORPHISM
   ============================================================================= */

.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.dark .glass {
  background: rgba(23, 23, 23, 0.8);
}

.glass-light {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* =============================================================================
   iOS-STYLE COMPONENTS
   ============================================================================= */

/* App Icon (iOS rounded square) */
.app-icon {
  border-radius: 22.37%;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.15);
}

.dark .app-icon {
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Card hover effect */
.card-hover {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

.dark .card-hover:hover {
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
}

.card-hover:active {
  transform: scale(0.98);
}

/* Button press effect */
.btn-press {
  transition: transform 0.15s ease;
}

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

/* Image zoom on hover */
.img-zoom {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover {
  transform: scale(1.05);
}

/* =============================================================================
   TIER BADGES
   ============================================================================= */

.tier-free {
  background: rgba(52, 199, 89, 0.1);
  color: #34C759;
}

.tier-starter {
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
}

.tier-pro {
  background: rgba(175, 82, 222, 0.1);
  color: #AF52DE;
}

.tier-enterprise {
  background: rgba(255, 149, 0, 0.1);
  color: #FF9500;
}

/* =============================================================================
   SCROLLBAR & OVERFLOW
   ============================================================================= */

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Hide scrollbar */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

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

/* =============================================================================
   TEXT UTILITIES
   ============================================================================= */

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 50%, #AF52DE 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

/* Fade up (for staggered lists) */
@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.4s ease-out forwards;
}

/* Stagger animation delays */
.stagger-item { animation: fadeUp 0.4s ease-out forwards; }
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }

/* Shimmer loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.05) 25%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
}

/* Pulse soft */
@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-pulse-soft {
  animation: pulseSoft 2s infinite;
}

/* =============================================================================
   SAFE AREAS (iOS notch)
   ============================================================================= */

.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}

.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.safe-left {
  padding-left: env(safe-area-inset-left, 0px);
}

.safe-right {
  padding-right: env(safe-area-inset-right, 0px);
}

/* =============================================================================
   RESPONSIVE UTILITIES
   ============================================================================= */

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .card-hover:hover {
    transform: none;
    box-shadow: none;
  }

  .img-zoom:hover {
    transform: none;
  }
}

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

/* Print */
@media print {
  header,
  footer,
  nav {
    display: none;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }
}
