/* ==========================================================================
   منصة إحكام - أنماط الاستجابة (Responsive)
   IHKAM Platform - Responsive Styles
   
   هذا الملف يحتوي على أنماط التكيف للشاشات المختلفة
   ========================================================================== */

/* ============================================================================
   زر أغلق القائمة (Mobile Menu)
   =========================================================================== */

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.mobile-menu-toggle:focus {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ============================================================================
   أنماط الأقسام
   =========================================================================== */

.pains-section,
.services-section,
.how-section,
.faqs-section,
.assessment-section {
  width: min(1440px, calc(100% - 64px));
  max-width: 100%;
  margin: 0 auto;
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
  animation: fadeInUp 0.8s ease both;
}

.section-header h2 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.2;
  margin: 0 0 16px;
  color: var(--ink);
  font-weight: 900;
}

.section-header p {
  font-size: 18px;
  color: var(--muted-light);
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================================
   شبكة قسم المشاكل (Pains Grid)
   =========================================================================== */

.pains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.pain-card {
  background: var(--header-bg);
  /* Semi-transparent for glass effect */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  transition: var(--transition-theme);
  animation: fadeInUp 0.6s ease both;
}

.pain-card:nth-child(2) {
  animation-delay: 0.1s;
}

.pain-card:nth-child(3) {
  animation-delay: 0.2s;
}

.pain-card:nth-child(4) {
  animation-delay: 0.3s;
}

.pain-card:nth-child(5) {
  animation-delay: 0.4s;
}

.pain-card:nth-child(6) {
  animation-delay: 0.5s;
}

.pain-card:hover {
  border-color: var(--teal);
  box-shadow: 0 10px 30px rgba(47, 185, 168, 0.15);
  /* Glow effect */
  transform: translateY(-8px);
}

.pain-number {
  font-size: 32px;
  font-weight: 900;
  color: var(--teal);
  margin-bottom: 16px;
  line-height: 1;
}

.pain-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-main);
  transition: var(--transition-theme);
}

.pain-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  transition: var(--transition-theme);
}

/* ============================================================================
   شبكة الخدمات (Services Grid)
   =========================================================================== */

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.service-card {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  transition: var(--transition-theme);
  animation: fadeInUp 0.6s ease both;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 200%;
  background: rgba(47, 185, 168, 0.05);
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 0;
}

.service-card:hover::before {
  transform: scale(1.5);
}

.service-card:hover {
  border-color: var(--teal);
  box-shadow: 0 10px 30px rgba(47, 185, 168, 0.15);
  /* Glow effect */
  transform: translateY(-8px);
}

.service-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-main);
  position: relative;
  z-index: 1;
  transition: var(--transition-theme);
}

.service-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  position: relative;
  transition: var(--transition-theme);
}

/* ============================================================================
   خط الزمن (Timeline)
   =========================================================================== */

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  z-index: 0;
}

.timeline-item {
  position: relative;
  padding: 32px 24px;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  animation: fadeInUp 0.6s ease both;
  z-index: 1;
}

.timeline-item:nth-child(2) {
  animation-delay: 0.1s;
}

.timeline-item:nth-child(3) {
  animation-delay: 0.2s;
}

.timeline-item:nth-child(4) {
  animation-delay: 0.3s;
}

.timeline-number {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: -60px auto 20px;
  line-height: 1;
}

.timeline-item h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
}

.timeline-item p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ============================================================================
   الأسئلة الشائعة (FAQs)
   =========================================================================== */

.faqs-container {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease both;
  overflow: hidden;
}

.faq-item:nth-child(2) {
  animation-delay: 0.1s;
}

.faq-item:nth-child(3) {
  animation-delay: 0.2s;
}

.faq-item:nth-child(4) {
  animation-delay: 0.3s;
}

.faq-item:nth-child(5) {
  animation-delay: 0.4s;
}

.faq-item:nth-child(6) {
  animation-delay: 0.5s;
}

.faq-item summary {
  padding: 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
  background: var(--paper);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 24px;
  font-weight: 300;
  transition: transform 0.3s ease;
}

.faq-item[open] summary {
  background: var(--sand);
  color: var(--teal-deep);
}

.faq-item[open] summary::after {
  content: '−';
  transform: rotate(180deg);
}

.faq-item[open] summary:hover {
  background: var(--sand);
}

.faq-item summary:hover {
  background: var(--sand);
  color: var(--teal-deep);
}

.faq-item p {
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  padding-inline: 20px;
  background: transparent;
}

.faq-item[open] p {
  padding: 20px;
  max-height: none;
  background: transparent;
}

/* ============================================================================
   نموذج التقييم (Assessment Form)
   =========================================================================== */

.assessment-form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-main);
  padding: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 32px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--bg-main);
  color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(47, 185, 168, 0.1);
}

.form-group input.error,
.form-group textarea.error {
  border-color: #d94b38;
  background: rgba(217, 75, 56, 0.05);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.assessment-form .button {
  width: 100%;
  height: 52px;
  font-size: 16px;
}

/* ============================================================================
   تذييل الصفحة (Footer)
   =========================================================================== */

.site-footer {
  background: var(--ink);
  color: white;
  padding: 60px 0 30px;
  margin-top: 120px;
}

.footer-content {
  width: min(1440px, calc(100% - 64px));
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section h3,
.footer-section h4 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
  color: white;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  transition: color 0.2s ease;
}

.footer-section ul a:hover {
  color: var(--teal);
}

.social-links {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.social-links a {
  display: inline-block;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.social-links a:hover {
  background: var(--teal);
  color: white;
}

.footer-bottom {
  width: min(1440px, calc(100% - 64px));
  max-width: 100%;
  margin: 0 auto;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin: 0;
}

.version {
  opacity: 0.5;
  font-size: 11px !important;
}

/* ============================================================================
   أنماط عامة متقدمة
   =========================================================================== */

/* رابط التخطي (Skip Link) */
.skip-link {
  position: absolute;
  top: -100px;
  right: 0;
  background: var(--ink);
  color: white;
  padding: 12px 24px;
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

/* تحميل حركات */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   الأنماط المتجاوبة (Tablet)
   =========================================================================== */

@media screen and (max-width: 1024px) {

  .pains-section,
  .services-section,
  .how-section,
  .faqs-section,
  .assessment-section {
    width: calc(100% - 48px);
    padding: 60px 0;
  }

  .section-header {
    margin-bottom: 40px;
  }

  .section-header h2 {
    font-size: 32px;
  }

  .pains-grid,
  .services-grid {
    gap: 20px;
  }

  .pain-card,
  .service-card {
    padding: 24px;
  }

  .timeline {
    gap: 24px;
  }

  .timeline::before {
    display: none;
  }

  .assessment-form {
    padding: 32px;
  }

  .footer-content {
    gap: 32px;
  }
}

/* ============================================================================
   الأنماط المتجاوبة (Mobile)
   =========================================================================== */

@media screen and (max-width: 768px) {
  .site-header {
    grid-template-columns: auto 1fr;
  }

  .site-header nav {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .pains-section,
  .services-section,
  .how-section,
  .faqs-section,
  .assessment-section {
    width: calc(100% - 32px);
    padding: 40px 0;
  }

  .section-header h2 {
    font-size: 24px;
  }

  .section-header p {
    font-size: 16px;
  }

  .pains-grid,
  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pain-card,
  .service-card {
    padding: 20px;
  }

  .timeline {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    padding: 24px 16px;
  }

  .timeline-number {
    margin-top: 0;
    margin-bottom: 16px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .faqs-container {
    max-width: 100%;
  }

  .faq-item summary {
    padding: 16px;
    font-size: 14px;
  }

  .faq-item p {
    padding: 16px;
  }

  .assessment-form {
    padding: 24px;
    margin: 0 auto;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 16px;
    /* منع التكبير على iOS */
  }

  .button {
    min-height: 48px;
    padding: 0 16px;
    font-size: 14px;
  }

  .button-sm {
    min-height: 40px;
    padding: 0 12px;
  }

  .footer-bottom {
    width: calc(100% - 32px);
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer {
    padding: 40px 0 20px;
    margin-top: 60px;
  }

  .footer-content {
    width: calc(100% - 32px);
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .footer-section:nth-child(1),
  .footer-section:nth-child(4) {
    grid-column: span 2;
  }
}

/* إصلاح التمرير الأفقي الزائد */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ============================================================================
   الأنماط المتجاوبة (Small Mobile)
   =========================================================================== */

@media screen and (max-width: 480px) {
  .site-header {
    width: calc(100% - 16px);
    padding: 0.75rem 0.5rem;
  }

  .pains-section,
  .services-section,
  .how-section,
  .faqs-section,
  .assessment-section {
    width: calc(100% - 16px);
    padding: 24px 0;
  }

  .section-header h2 {
    font-size: 20px;
  }

  .section-header p {
    font-size: 14px;
  }

  .pain-number {
    font-size: 28px;
  }

  .pain-card h3,
  .service-card h3 {
    font-size: 16px;
  }

  .faq-item summary {
    padding: 12px;
    font-size: 13px;
  }

  .assessment-form {
    padding: 16px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .assessment-form .button {
    height: 44px;
    font-size: 14px;
  }

  .footer-section h3,
  .footer-section h4 {
    font-size: 14px;
  }

  .footer-section p,
  .footer-section ul a {
    font-size: 12px;
  }

  .footer-bottom p {
    font-size: 11px;
  }
}

/* ============================================================================
   تجاوب المكونات الجديدة (New Components Responsive)
   =========================================================================== */

/* Hero Visual */
@media (max-width: 1024px) {
  .how-steps {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .assessment-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .integrations-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fc-1 {
    bottom: 0;
    right: 0;
  }

  .fc-2 {
    top: 10px;
    left: 0;
  }
}

@media (max-width: 768px) {
  .stats-section,
  .pains-section,
  .services-section,
  .how-section,
  .faqs-section,
  .integrations-section,
  .pricing-section,
  .assessment-section {
    padding: 3rem 1rem;
    width: 100%;
  }

  .hero-visual {
    padding: 0;
  }

  .hero-image-wrap {
    width: 88%;
    margin: 0 auto;
  }

  .hero-img {
    width: 75%;
    max-width: none;
  }

  .floating-card {
    display: flex;
    zoom: .72;
    padding: 9px 11px;
    border-radius: 9px;
  }

  .fc-1 { right: 0; bottom: 15%; }
  .fc-2 { left: 0; top: 10%; }
  .fc-3 { top: 0; }
  .fc-4 { bottom: 0; }
  .fc-5 { top: 0; }
  .fc-6 { bottom: 0; }
  .fc-7 { right: 0; }
  .fc-8 { left: 0; }

  .fc-icon {
    font-size: 18px;
  }

  .how-steps {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .how-step::after {
    display: none;
  }

  .step-num {
    font-size: 36px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .assessment-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .integrations-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .cta-blob {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-image-wrap {
    width: 92%;
  }

  .floating-card {
    zoom: .58;
  }

  .hero-img {
    border-radius: 10px;
  }

  .stat-card .stat-number {
    font-size: 2rem;
  }
}

/* ============================================================================
   وضع أداء منخفض (Prefers Reduced Motion)
   =========================================================================== */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   نموذج التقييم بعرض كامل على الجوال
   =========================================================================== */

@media screen and (max-width: 768px) {
  .assessment-section {
    width: 100%;
    padding-inline: 12px;
    box-sizing: border-box;
  }

  .assessment-inner,
  .assessment-form {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  .assessment-form {
    padding: 24px 18px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 480px) {
  .assessment-section {
    padding-inline: 8px;
  }

  .assessment-form {
    padding: 18px 12px;
    border-radius: 10px;
  }
}

/* ============================================================================
   طباعة
   =========================================================================== */

@media print {

  .site-header,
  .header-actions,
  .button,
  .assessment-form,
  .mobile-menu-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .pains-section,
  .services-section,
  .how-section,
  .faqs-section,
  .assessment-section {
    page-break-inside: avoid;
  }
}