@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --bg-deep: #070a14;
  --bg-surface: rgba(14, 20, 38, 0.85);
  --bg-card: rgba(20, 28, 50, 0.7);
  --bg-card-hover: rgba(30, 42, 72, 0.85);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-glow: rgba(99, 102, 241, 0.4);

  --primary-rgb: 99, 102, 241;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);

  --accent-cyan: #10b981;
  --accent-cyan-glow: rgba(16, 185, 129, 0.35);
  --accent-purple: #818cf8;
  --accent-gold: #fbbf24;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;

  --font-ar: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-lux: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --backdrop: blur(24px) saturate(190%);
}

[lang="ar"] { font-family: var(--font-ar); }
[lang="en"] { font-family: var(--font-en); }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  width: 100%;
  transform: translateZ(0);
}

/* Ambient Glow Orbs - Subtle */
.ambient-glow-1 {
  position: fixed;
  top: -100px;
  right: -100px;
  width: clamp(300px, 40vw, 600px);
  height: clamp(300px, 40vw, 600px);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 60%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb1 20s ease-in-out infinite alternate;
}

.ambient-glow-2 {
  position: fixed;
  bottom: -120px;
  left: -120px;
  width: clamp(350px, 45vw, 700px);
  height: clamp(350px, 45vw, 700px);
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 60%);
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb2 24s ease-in-out infinite alternate;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 40px) scale(1.05); }
  100% { transform: translate(20px, -15px) scale(0.97); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(35px, -30px) scale(1.08); }
  100% { transform: translate(-20px, 20px) scale(0.93); }
}

#bg-canvas-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3.5vw, 42px) 90px clamp(16px, 3.5vw, 42px);
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 3vw, 32px);
  margin-top: clamp(10px, 2vw, 18px);
  margin-bottom: clamp(20px, 3vw, 36px);
  background: rgba(16, 22, 40, 0.75);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.header-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent-cyan), transparent);
  opacity: 0.6;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: clamp(38px, 4vw, 44px);
  height: clamp(38px, 4vw, 44px);
  background: var(--primary-gradient);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(18px, 2.5vw, 22px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.brand-name {
  font-size: clamp(20px, 2.8vw, 26px);
  font-weight: 900;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================ */
/* MODERN BUTTON SYSTEM                         */
/* ============================================ */
/* ============================================ */
/* ULTRA-PROFESSIONAL BUTTON SYSTEM & SEARCH    */
/* ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn:active {
  transform: translateY(1px) scale(0.97) !important;
}

/* Primary Liquid Gradient Button */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}

/* Glass Floating Button */
.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.btn-glass:hover, .btn-glass.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.45);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.25);
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, rgba(14, 20, 38, 0.6) 100%);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 60px) clamp(20px, 4vw, 44px);
  margin-bottom: clamp(24px, 4vw, 40px);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lux);
}

.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-gold);
  font-size: clamp(11px, 1.4vw, 13px);
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-title {
  font-size: clamp(26px, 4.5vw, 48px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: clamp(14px, 1.9vw, 17px);
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto clamp(22px, 3.5vw, 36px) auto;
  font-weight: 400;
}

/* Spotlight Search Bar */
.search-bar-wrap {
  display: flex;
  align-items: center;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  padding: 8px 14px 8px 22px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 5;
}

.search-bar-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), 0 16px 45px rgba(99, 102, 241, 0.25);
  transform: translateY(-2px);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: clamp(14px, 1.9vw, 16px);
  font-family: inherit;
  padding: 8px 12px;
  width: 100%;
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.trending-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  position: relative;
  z-index: 5;
}

.tag-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tag-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* Controls & Categories Bar */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: clamp(20px, 3vw, 32px);
  background: rgba(14, 20, 38, 0.75);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 14px clamp(16px, 2.5vw, 24px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.categories-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.cat-chip {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cat-chip:hover {
  background: rgba(99, 102, 241, 0.12);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

.cat-chip.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.filter-select {
  background: rgba(10, 14, 26, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.fx-quick-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(10, 14, 26, 0.75);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.fx-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fx-btn.active, .fx-btn:hover {
  background: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 2px 12px var(--accent-cyan-glow);
}

@keyframes pulseGlow {
  0% { box-shadow: 0 4px 16px var(--primary-glow); }
  100% { box-shadow: 0 4px 24px var(--primary-glow); }
}

@media (max-width: 640px) {
  .header-nav { flex-direction: column; align-items: stretch; text-align: center; }
  .brand-logo { justify-content: center; }
  .nav-actions { justify-content: center; width: 100%; }
  .btn { flex: 1; min-width: 100px; text-align: center; }
  .controls-bar { flex-direction: column; align-items: stretch; }
}

/* Universal Device & Safe Area */
.app-container {
  padding-left: max(clamp(16px, 3.5vw, 42px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 3.5vw, 42px), env(safe-area-inset-right));
  padding-bottom: max(90px, env(safe-area-inset-bottom));
}

@media (hover: none) {
  .wp-card:hover {
    transform: none !important;
  }
  .wp-card::before {
    display: none !important;
  }
  .wp-overlay {
    opacity: 1 !important;
    background: linear-gradient(180deg, transparent 40%, rgba(10, 14, 26, 0.92) 100%) !important;
  }
}

@media (max-width: 480px) {
  .nav-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .nav-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 9px 8px;
    font-size: 11px;
  }
  .hero-title {
    font-size: 22px !important;
  }
  .hero-desc {
    font-size: 13px !important;
  }
  .fx-quick-bar {
    justify-content: center;
    width: 100%;
  }
  .filter-select {
    width: 100%;
    text-align: center;
  }
}

/* Performance Mode */
body.perf-mode * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  animation: none !important;
  transition: transform 0.15s ease, opacity 0.15s ease !important;
}

body.perf-mode .ambient-glow-1,
body.perf-mode .ambient-glow-2,
body.perf-mode #bg-canvas-fx {
  display: none !important;
}

body.perf-mode .header-nav,
body.perf-mode .controls-bar,
body.perf-mode .hero-banner,
body.perf-mode .wp-card,
body.perf-mode .wp-info,
body.perf-mode .modal-container,
body.perf-mode .studio-panel,
body.perf-mode .mockup-stage {
  background: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.perf-mode .wp-card::before {
  display: none !important;
}

body.perf-mode .wp-card:hover {
  transform: translateY(-3px) !important;
}

/* Loading skeleton animation */
.wp-card.loading {
  background: linear-gradient(90deg, rgba(20,28,50,0.7) 25%, rgba(40,50,80,0.7) 50%, rgba(20,28,50,0.7) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Better focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

/* Smooth image loading */
.wp-card img {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.wp-card img.loaded {
  opacity: 1;
}

/* Print styles */
@media print {
  .ambient-glow-1, .ambient-glow-2, #bg-canvas-fx,
  .header-nav, .controls-bar, .fx-quick-bar,
  #cookie-banner, .modal { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Selection color */
::selection {
  background: rgba(99, 102, 241, 0.4);
  color: #fff;
}

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