/* ============================================
   Base CSS - استایل‌های پایه مشترک
   ============================================ */

/* IranYekan Font */
@font-face {
  font-family: 'IranYekan';
  src: url('../fonts/iranyekan.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: optional;
}

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Base HTML and Body Styles */
html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* RTL positioning utilities */
.inset-inline-start-3 {
  inset-inline-start: 0.75rem;
}
body {
  min-height: 100dvh;
  padding-bottom: 3.5rem;
}

/* Scrollbar Hide */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ============================================
   DESIGN SYSTEM TOKENS
   ============================================ */
:root {
  /* Dream Blue Palette */
  --dream-blue-50: #eef2ff;
  --dream-blue-100: #e0e7ff;
  --dream-blue-200: #c7d2fe;
  --dream-blue-300: #a5b4fc;
  --dream-blue-400: #818cf8;
  --dream-blue-500: #6366f1;
  --dream-blue-600: #4f46e5;
  --dream-blue-700: #4338ca;
  --dream-blue-800: #3730a3;
  --dream-blue-900: #312e81;

  /* Golden Accent Palette */
  --golden-accent-50: #fffbeb;
  --golden-accent-100: #fef3c7;
  --golden-accent-200: #fde68a;
  --golden-accent-300: #fcd34d;
  --golden-accent-400: #fbbf24;
  --golden-accent-500: #f59e0b;
  --golden-accent-600: #d97706;
  --golden-accent-700: #b45309;
  --golden-accent-800: #92400e;
  --golden-accent-900: #78350f;

  /* Theme Colors - Will be overridden by theme files */
  --primary: var(--dream-blue-600);
  --accent: var(--golden-accent-500);
  --background-light: #FFFFFF;
  --subtle-light: var(--dream-blue-50);
  --text-light: #111827;
  --muted-light: #6b7280;
  --border-light: var(--dream-blue-200);

  /* ===== SPACING SYSTEM ===== */
  --spacing-section-sm: 1.5rem;
  --spacing-section-md: 2.5rem;
  --spacing-section-lg: 3.5rem;
  --spacing-card: 1.5rem;
  --spacing-card-lg: 2rem;

  /* ===== SHADOW SYSTEM ===== */
  --shadow-card: 0 4px 20px rgba(79, 70, 229, 0.12);
  --shadow-card-hover: 0 8px 32px rgba(79, 70, 229, 0.18);
  --shadow-accent: 0 4px 24px rgba(245, 158, 11, 0.3);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);

  /* ===== BORDER SYSTEM ===== */
  --radius-card: 1.5rem;
  --radius-section: 2rem;
  --radius-button: 0.75rem;
  --border-width: 2px;
  --border-opacity: 0.15;
  --border-opacity-hover: 0.3;

  /* ===== BACKGROUND SYSTEM ===== */
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --bg-section: linear-gradient(to bottom, rgba(238, 242, 255, 0.3), rgba(255, 255, 255, 1));

  /* ===== BACKDROP BLUR ===== */
  --blur-card: blur(10px);
  --blur-section: blur(8px);
}

/* Tailwind Config - Applied via CSS Variables */
/* Note: Tailwind CDN will use these variables */

/* Container Responsive */
.container-responsive {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* Hero Background Gradient */
.hero-gradient {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(245, 158, 11, 0.05) 100%);
  position: relative;
  overflow: hidden;
}

/* Only use will-change on desktop */
@media (min-width: 769px) {
  .hero-gradient {
    will-change: transform;
  }
}
.hero-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

/* Stars Pattern */
.stars-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, rgba(99, 102, 241, 0.3), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(245, 158, 11, 0.2), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(99, 102, 241, 0.4), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(245, 158, 11, 0.3), transparent),
    radial-gradient(2px 2px at 90% 40%, rgba(99, 102, 241, 0.2), transparent),
    radial-gradient(1px 1px at 33% 60%, rgba(245, 158, 11, 0.4), transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: stars 20s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

/* Only use will-change on desktop */
@media (min-width: 769px) {
  .stars-pattern {
    will-change: background-position;
  }
}

/* Reduce animation on mobile for better performance */
@media (max-width: 768px) {
  .stars-pattern {
    animation: stars 30s linear infinite;
    opacity: 0.4;
  }
}

@keyframes stars {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

/* Section Background */
.section-bg {
  background: var(--bg-section);
}

.section-container {
  padding-top: var(--spacing-section-md);
  padding-bottom: var(--spacing-section-md);
}

/* Card Base */
.card-base {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
}

.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  background: var(--bg-card-hover);
}

/* Trust Bar */
.trust-bar {
  backdrop-filter: blur(10px);
}

/* Disable backdrop-filter on mobile for better performance */
@media (max-width: 768px) {
  .trust-bar,
  header.sticky,
  [class*="backdrop-blur"] {
    backdrop-filter: none !important;
  }
  
  .trust-bar {
    background: rgba(255, 255, 255, 0.95) !important;
  }
  
  header.sticky {
    background: rgba(255, 255, 255, 0.95) !important;
  }
  
  /* Reduce shadow effects on mobile */
  [class*="shadow-2xl"],
  [class*="shadow-xl"] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  }
  
  [class*="shadow-lg"] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  }
  
  /* Optimize transitions on mobile */
  [class*="transition-all"] {
    transition-property: background-color, border-color, opacity, transform !important;
    transition-duration: 200ms !important;
  }
}

/* Badge Pulse */
.badge-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .7;
  }
}

/* Glow Effects */
.glow-accent {
  box-shadow: var(--shadow-accent);
}

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 300px;
  height: 300px;
}

/* Stars Pattern */
.stars-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, rgba(99, 102, 241, 0.3), transparent),
    radial-gradient(1px 1px at 60px 80px, rgba(245, 158, 11, 0.2), transparent),
    radial-gradient(1.5px 1.5px at 100px 50px, rgba(99, 102, 241, 0.25), transparent);
  background-size: 200px 200px;
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================
   UNIFIED COMPONENT SYSTEM
   ============================================ */

/* Card Base - پایه یکسان برای تمام کارت‌ها */
.card-base {
  background: var(--bg-card);
  border: var(--border-width) solid rgba(79, 70, 229, var(--border-opacity));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--blur-card);
  padding: var(--spacing-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card Hover - هاور یکسان */
.card-hover {
  background: var(--bg-card);
  border: var(--border-width) solid rgba(79, 70, 229, var(--border-opacity));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--blur-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.card-hover:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(79, 70, 229, var(--border-opacity-hover));
  box-shadow: var(--shadow-card-hover);
}

/* Section Container - کانتینر یکسان برای sections */
.section-container {
  padding-top: var(--spacing-section-sm);
  padding-bottom: var(--spacing-section-sm);
}
@media (min-width: 768px) {
  .section-container {
    padding-top: var(--spacing-section-md);
    padding-bottom: var(--spacing-section-md);
  }
}
@media (min-width: 1024px) {
  .section-container {
    padding-top: var(--spacing-section-lg);
    padding-bottom: var(--spacing-section-lg);
  }
}

/* Section Background - پس‌زمینه یکسان */
.section-bg {
  background: linear-gradient(to bottom, rgba(238, 242, 255, 0.3), rgba(255, 255, 255, 1));
}

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
.ripple:active::after {
  width: 300px;
  height: 300px;
}

/* Stepper Card Animation */
.stepper-card {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.stepper-card:hover {
  transform: rotate(1.5deg) scale(1.03) translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(79, 70, 229, 0.2);
}

/* Auto-growing Textarea */
.auto-grow {
  resize: none;
  overflow: hidden;
  min-height: 120px;
  max-height: 300px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 100px;
  inset-inline-start: 20px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
@media (prefers-reduced-motion: no-preference) {
  .fab {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  .fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  }
}

/* Trust Bar */
.trust-bar {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

/* Drawer */
.drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.drawer.open {
  max-height: 500px;
}

/* Chat-like Cards */
.chat-card {
  position: relative;
  padding-right: 60px;
}

/* Badge Pulse */
.badge-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Input Focus States */
input:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

/* Glow Effects */
.glow-primary {
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
}
.glow-accent {
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.4), 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Card Variants */
.card-gradient {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.5) 100%);
}

/* Line Clamp Utilities */
.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;
}
.line-clamp-6 {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Word Break for Persian Text */
.break-words {
  word-break: break-word;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Smooth Transitions */
/* Scoped transitions for interactive elements only */
@media (prefers-reduced-motion: no-preference) {
  button, a, input, textarea, select, .card-hover, .stepper-card, .chip-item, .tab-btn {
    transition-property: color, background-color, border-color, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
  }
}

/* Respect 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;
    scroll-behavior: auto !important;
  }
}

/* Responsive Container */
@media (min-width: 768px) {
  .container-responsive {
    max-width: 768px;
    margin: 0 auto;
  }
}
@media (min-width: 1024px) {
  .container-responsive {
    max-width: 1200px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
@media (min-width: 1280px) {
  .container-responsive {
    max-width: 1400px;
    padding-left: 3rem;
    padding-right: 3rem;
  }
}
@media (min-width: 1536px) {
  .container-responsive {
    max-width: 1600px;
  }
}

