/**
 * ===========================================================================
 * PremiumUXEngine.css — Phase 8: Premium User Experience Layer
 *
 * Apple, Canva, Linear, Arc Browser, & Framer aesthetic design system.
 * Full responsive coverage: Ultra-wide, Desktop, Laptop, Tablet, Android,
 * iPhone, Foldables, and Small Mobile screens.
 * ===========================================================================
 */

/* ─── Glassmorphism & Tokens ─────────────────────────────────────────────── */
:root {
  --lux-font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --lux-font-serif: 'Cinzel', 'Great Vibes', serif;
  --lux-glass-bg: rgba(255, 255, 255, 0.72);
  --lux-glass-border: rgba(255, 255, 255, 0.65);
  --lux-glass-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 0 0 1px 1px rgba(255, 255, 255, 0.9) inset;
  --lux-spring-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --lux-smooth-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --lux-radius-sm: 10px;
  --lux-radius-md: 16px;
  --lux-radius-lg: 24px;
  --lux-radius-pill: 9999px;
  --lux-focus-ring: 0 0 0 4px rgba(255, 107, 139, 0.35);
  --lux-touch-target: 44px;
}

/* ─── Global Responsive Layout Safeguards ───────────────────────────────── */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* ─── Skeleton Shimmer Loading ───────────────────────────────────────────── */
@keyframes luxShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.lux-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.6) 37%, rgba(255,255,255,0.2) 63%);
  background-size: 200% 100%;
  animation: luxShimmer 1.8s infinite ease-in-out;
  border-radius: var(--lux-radius-sm);
}

/* ─── Magnetic & Ripple Micro-Interactions ───────────────────────────────── */
.lux-interactive {
  transition: transform 0.3s var(--lux-spring-ease), box-shadow 0.3s var(--lux-smooth-ease), background 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: var(--lux-touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lux-interactive:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
}

.lux-interactive:active {
  transform: translateY(0) scale(0.985);
}

@keyframes luxRipple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

.lux-ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: luxRipple 0.6s linear;
  pointer-events: none;
}

/* ─── Toasts & Notifications ─────────────────────────────────────────────── */
#luxToastContainer {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 400px;
  width: calc(100vw - 48px);
}

.lux-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--lux-radius-md);
  box-shadow: 0 16px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
  font-family: var(--lux-font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: #2c3e50;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.4s var(--lux-spring-ease), opacity 0.3s ease;
}

.lux-toast.lux-toast-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.lux-toast-icon {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lux-toast-success { border-left: 4px solid #10b981; }
.lux-toast-error   { border-left: 4px solid #ef4444; }
.lux-toast-warning { border-left: 4px solid #f59e0b; }
.lux-toast-info    { border-left: 4px solid #3b82f6; }

/* ─── Live Preview Device Frame Switcher ─────────────────────────────────── */
.lux-preview-toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  padding: 6px;
  border-radius: var(--lux-radius-pill);
  border: 1px solid var(--lux-glass-border);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  margin-bottom: 16px;
  max-width: 100%;
  overflow-x: auto;
}

.lux-preview-btn {
  border: none;
  background: transparent;
  padding: 10px 18px;
  min-height: var(--lux-touch-target);
  border-radius: var(--lux-radius-pill);
  font-family: var(--lux-font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.25s var(--lux-smooth-ease);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.lux-preview-btn.active {
  background: #ffffff;
  color: #ff4770;
  box-shadow: 0 4px 12px rgba(255, 71, 112, 0.2);
}

.lux-preview-wrapper {
  transition: width 0.4s var(--lux-smooth-ease), height 0.4s var(--lux-smooth-ease), border-radius 0.4s ease;
  margin: 0 auto;
  max-width: 100%;
}

.lux-preview-desktop { width: 100%; max-width: 100%; border-radius: var(--lux-radius-md); }
.lux-preview-tablet  { width: 768px; max-width: 100%; border-radius: var(--lux-radius-lg); border: 12px solid #1e293b; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.lux-preview-mobile  { width: 375px; max-width: 100%; border-radius: 36px; border: 10px solid #0f172a; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3); }

/* ─── Theme Browser Filter & Favorites ──────────────────────────────────── */
.lux-search-bar {
  width: 100%;
  min-height: var(--lux-touch-target);
  padding: 12px 20px 12px 44px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--lux-radius-pill);
  font-family: var(--lux-font-sans);
  font-size: 0.95rem;
  color: #2c3e50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.lux-search-bar:focus {
  outline: none;
  background: #ffffff;
  box-shadow: var(--lux-focus-ring), 0 8px 25px rgba(255, 107, 139, 0.15);
}

.lux-fav-btn {
  background: none;
  border: none;
  min-width: 36px;
  min-height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s var(--lux-spring-ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lux-fav-btn:hover {
  transform: scale(1.3);
}

/* ─── Luxury Modal Overlay ───────────────────────────────────────────────── */
.lux-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lux-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.lux-modal-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--lux-radius-lg);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s var(--lux-spring-ease);
}

.lux-modal-backdrop.active .lux-modal-card {
  transform: scale(1) translateY(0);
}

/* ─── Accessibility & Motion ─────────────────────────────────────────────── */
:focus-visible {
  outline: none !important;
  box-shadow: var(--lux-focus-ring) !important;
}

@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;
  }
}

/* ===========================================================================
   RESPONSIVE BREAKPOINTS (Ultra-wide, Desktop, Tablet, Mobile, Foldables)
   =========================================================================== */

/* ─── 1. Ultra-Wide & 4K Displays (>= 1920px) ───────────────────────────── */
@media (min-width: 1920px) {
  #luxToastContainer {
    right: 48px;
    bottom: 48px;
    max-width: 460px;
  }

  .lux-modal-card {
    max-width: 640px;
    padding: 40px;
  }
}

/* ─── 2. Tablets & Small Laptops (768px - 1199px) ────────────────────────── */
@media (max-width: 1199px) {
  .lux-preview-tablet {
    width: 100%;
    border-width: 8px;
  }
}

/* ─── 3. Mobile & Android / iPhone (< 768px) ────────────────────────────── */
@media (max-width: 767px) {
  #luxToastContainer {
    right: 16px;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
  }

  .lux-toast {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .lux-preview-toolbar {
    width: 100%;
    justify-content: space-around;
  }

  .lux-preview-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    flex: 1;
    justify-content: center;
  }

  .lux-preview-mobile {
    width: 100%;
    border-width: 6px;
    border-radius: 24px;
  }

  .lux-modal-card {
    padding: 24px 20px;
    border-radius: var(--lux-radius-md);
  }
}

/* ─── 4. Small Mobiles & Foldables (< 380px) ─────────────────────────────── */
@media (max-width: 379px) {
  .lux-preview-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .lux-search-bar {
    padding-left: 36px;
    font-size: 0.85rem;
  }
}
