/* responsive-fix.css */
/* =========================================
   GLOBAL RESPONSIVE FIXES
   برای رفع مشکلات ریسپانسیو همه صفحات
========================================= */

/* رفع مشکلات عمومی */
* {
  box-sizing: border-box;
  max-width: 100%;
}

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  width: 100%;
  overflow-x: hidden;
  font-family: "Vazirmatn", "Dana", "IranSans", sans-serif;
}

/* تنظیمات عمومی کانتینر */
.container,
.bx-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* تنظیم فونت‌های ریسپانسیو */
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3.5vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 3vw, 1.5rem); }
p, li, a, span { font-size: clamp(0.9rem, 2vw, 1rem); }

/* رفع مشکلات گرید */
.grid-fix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.5rem;
}

/* رفع مشکلات کارت‌ها */
.card-fix {
  width: 100%;
  min-height: auto;
  padding: clamp(1rem, 3vw, 1.5rem);
}

/* =========================================
   BREAKPOINT SPECIFIC FIXES
========================================= */

/* تبلت (768px به پایین) */
@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }
  
  .container,
  .bx-container {
    padding: 0 15px;
  }
  
  /* رفع مشکلات لایه‌بندی */
  .blog-layout,
  .docs-layout,
  .contact-grid,
  .market-container {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  
  /* سایدبارها */
  .blog-sidebar,
  .docs-sidebar,
  .sidebar {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    margin-bottom: 2rem;
  }
  
  /* کارت‌های دو ستونه */
  .posts-grid,
  .blog-posts,
  .tutorial-grid,
  .pricing-grid,
  .related-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* هدر صفحات */
  .page-hero,
  .blog-hero,
  .about-hero,
  .contact-hero {
    padding: 3rem 1.5rem !important;
    text-align: center;
  }
  
  .page-hero h1,
  .blog-hero h1 {
    font-size: 1.8rem !important;
    line-height: 1.3;
  }
  
  /* فوتر */
  .footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }
  
  /* فرم‌ها */
  .bx-form-grid,
  .contact-grid {
    grid-template-columns: 1fr !important;
  }
  
  input, textarea, select, button {
    font-size: 16px !important; /* جلوگیری از زوم در iOS */
  }
}

/* موبایل کوچک (480px به پایین) */
@media (max-width: 480px) {
  :root {
    font-size: 13px;
  }
  
  .container,
  .bx-container {
    padding: 0 12px;
  }
  
  /* هدرها */
  .page-hero h1,
  .blog-hero h1,
  .post-article h1 {
    font-size: 1.5rem !important;
  }
  
  /* کارت‌های بلند */
  .blog-card,
  .post-card {
    flex-direction: column !important;
  }
  
  .blog-thumb,
  .post-card img {
    width: 100% !important;
    height: 200px !important;
    margin-bottom: 1rem;
  }
  
  /* دکمه‌ها */
  .btn,
  .bx-btn,
  .share-btn {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
  }
  
  /* متا اطلاعات */
  .post-meta,
  .blog-meta,
  .changelog-meta {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  /* لیست‌ها */
  .post-tags,
  .blog-tags,
  .why-card-keywords {
    justify-content: flex-start;
  }
  
  /* مودال‌ها */
  .modal-content,
  .glass-modal {
    width: 95% !important;
    padding: 1.5rem !important;
    margin: 1rem !important;
  }
}

/* =========================================
   FIXES FOR SPECIFIC PAGES
========================================= */

/* صفحه بلاگ */
@media (max-width: 768px) {
  .single-post {
    padding: 1.5rem 0;
  }
  
  .post-article {
    padding: 1.5rem !important;
  }
  
  .post-cover {
    max-height: 250px !important;
    margin: 1rem 0;
  }
  
  .post-body h2 {
    font-size: 1.3rem !important;
  }
  
  .post-body h3 {
    font-size: 1.1rem !important;
  }
}

/* صفحه مارکت */
@media (max-width: 768px) {
  .market-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100% !important;
    order: -1;
    margin-bottom: 2rem;
  }
  
  .bot-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 1rem;
  }
}

/* صفحه پست‌ها */
@media (max-width: 768px) {
  .blog-container {
    grid-template-columns: 1fr !important;
  }
  
  .posts-grid {
    grid-template-columns: 1fr !important;
  }
  
  .post-card {
    margin-bottom: 1.5rem;
  }
}

/* صفحه داکیومنت */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  
  .docs-sidebar {
    position: relative !important;
    top: auto !important;
    order: -1;
  }
}

/* صفحه تماس */
@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  
  .contact-form-wrap {
    padding: 1.5rem !important;
  }
}

/* =========================================
   UTILITY CLASSES
========================================= */

.text-responsive {
  font-size: clamp(0.9rem, 2vw, 1rem);
  line-height: 1.6;
}

.heading-responsive {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  line-height: 1.2;
}

.padding-responsive {
  padding: clamp(1rem, 3vw, 2rem);
}

.margin-responsive {
  margin: clamp(0.5rem, 2vw, 1.5rem);
}

.grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

/* =========================================
   FIX FOR COMMON COMPONENTS
========================================= */

/* دکمه‌های اکشن */
.bx-bot-actions,
.bx-success-actions,
.hero-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

/* ریتینگ */
.bx-rating {
  justify-content: center;
  flex-wrap: wrap;
}

/* ناوبری */
.bx-nav ul {
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================
   VIEWPORT FIXES
========================================= */

@viewport {
  width: device-width;
  zoom: 1.0;
}

@-ms-viewport {
  width: device-width;
}

/* جلوگیری از زوم در فرم‌ها در iOS */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;
  }
}