/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT PAGE STYLES - FULLY RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Layout Grid Helper (NEW) ─── */
/* استخدم هذا الكلاس للأقسام التي تحتوي على كروت متعددة */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

/* ─── Stats Cards ─── */
.stat-card {
  background: white;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  text-align: center;
  transition: all 0.3s ease;
  /* Flex layout for better centering */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

html.dark .stat-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(148, 163, 184, 0.1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.stat-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 12px;
  color: white;
  flex-shrink: 0; /* Prevent shrinking on small screens */
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 600;
}

html.dark .stat-label {
  color: #94a3b8;
}

/* ─── Feature Cards ─── */
.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  transition: all 0.3s ease;
  height: 100%; /* Ensure equal height in grid */
}

html.dark .feature-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(148, 163, 184, 0.1);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: white;
}

/* ─── Architecture Diagram ─── */
.architecture-diagram {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.arch-layer {
  background: white;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 1.5rem;
  padding: 2rem;
  transition: all 0.3s ease;
}

html.dark .arch-layer {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(59, 130, 246, 0.3);
}

.arch-layer:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
}

.arch-layer-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #3b82f6;
  text-align: center;
}

.arch-components {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.arch-component {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #3b82f6;
  /* Prevent text wrapping inside pill */
  white-space: nowrap;
}

html.dark .arch-component {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}

.arch-arrow {
  display: flex;
  justify-content: center;
  color: #3b82f6;
  font-size: 1.5rem;
}

/* ─── Security Cards ─── */
.security-card {
  background: white;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(34, 197, 94, 0.2);
  transition: all 0.3s ease;
  overflow: hidden; /* Contains overflowing code blocks */
}

html.dark .security-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(34, 197, 94, 0.2);
}

.security-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.4);
}

.security-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 1rem;
}

.code-preview {
  margin-top: 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b; /* Fallback dark bg */
  width: 100%;
}

.code-preview pre {
  margin: 0 !important;
  font-size: 0.75rem !important;
  max-height: 200px;
  overflow-y: auto; /* Vertical scroll */
  overflow-x: auto; /* Horizontal scroll for long lines */
  padding: 1rem;
  white-space: pre; /* Keeps code formatting */
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #22c55e;
  max-width: 100%;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border-radius: 0.75rem;
  font-weight: 600;
  word-break: break-word; /* Prevents long text overflow */
}

html.dark .checklist-item {
  background: rgba(30, 41, 59, 0.5);
}

/* ─── Tech Stack ─── */
.tech-category {
  background: white;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  height: 100%;
}

html.dark .tech-category {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(148, 163, 184, 0.1);
}

.tech-category-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #3b82f6;
}

.tech-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tech-item:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateX(-4px);
}

/* ─── Component Cards ─── */
.component-card {
  background: white;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

html.dark .component-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(148, 163, 184, 0.1);
}

.component-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 1rem;
  flex-wrap: wrap; /* Allow buttons to wrap on mobile */
  gap: 1rem;
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.demo-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
}

.demo-btn-search {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.demo-btn-attach {
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.demo-select-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  max-width: 100%;
}

.demo-select {
  background: transparent;
  border: none;
  outline: none;
  font-weight: 600;
  color: #3b82f6;
  cursor: pointer;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE MEDIA QUERIES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tablet & Smaller Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
  .stat-card, .feature-card, .arch-layer, .security-card, .tech-category, .component-card {
    padding: 1.5rem; /* Reduce padding slightly */
  }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr; /* Force single column */
    gap: 1rem;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .arch-layer {
    padding: 1.5rem 1rem;
  }

  .arch-components {
    /* Keeping wrap usually looks better than column for pills,
       but if you strictly want a list, use column */
    /* flex-direction: column; */
    gap: 0.5rem;
  }

  .arch-component {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }

  .tech-items {
    gap: 0.75rem;
  }

  .component-preview {
    padding: 1.5rem 1rem;
  }

  .demo-btn {
    width: 100%; /* Full width buttons on mobile */
  }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
  .stat-card, .feature-card, .security-card {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .stat-icon, .feature-icon, .security-icon {
    width: 40px;
    height: 40px;
  }

  .arch-layer-title {
    font-size: 1.1rem;
  }

  .checklist-item {
    font-size: 0.9rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENHANCED MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Navigation ── */
@media (max-width: 767px) {
  /* Nav stays h-16, mobile menu slides below it */
  #mobile-nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 8px 16px 16px;
    animation: navSlideDown 0.2s ease-out;
  }

  html.dark #mobile-nav-menu {
    background: rgba(15, 23, 42, 0.97);
    border-bottom-color: rgba(51, 65, 85, 0.6);
  }

  @keyframes navSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Hero section ── */
  section:first-of-type {
    padding-top: 100px !important;
    padding-bottom: 48px !important;
  }

  /* Heading sizes */
  h1.text-5xl {
    font-size: 2.5rem !important;
    line-height: 1.15 !important;
  }

  p.text-xl {
    font-size: 1rem !important;
  }

  /* CTA buttons: stack on small screens */
  .flex.flex-wrap.items-center.justify-center.gap-4 > a {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  /* Stats grid: 2 columns always */
  .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin-top: 2.5rem !important;
  }

  .stat-card {
    padding: 1.25rem 1rem !important;
  }

  .stat-number {
    font-size: 1.75rem !important;
  }

  /* ── Section padding ── */
  section {
    padding-top: 3.5rem !important;
    padding-bottom: 3.5rem !important;
  }

  section .max-w-7xl.mx-auto {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* ── Section headings ── */
  h2.text-4xl,
  h2.text-5xl {
    font-size: 1.875rem !important;
    line-height: 1.2 !important;
  }

  /* ── Features grid ── */
  .grid.md\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .feature-card {
    padding: 1.25rem !important;
  }

  .feature-icon {
    width: 46px !important;
    height: 46px !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
  }

  /* ── Architecture ── */
  .arch-layer {
    padding: 1rem !important;
    border-radius: 1rem !important;
  }

  .arch-layer-title {
    font-size: 1rem !important;
  }

  /* ── Security section ── */
  .grid.md\:grid-cols-2,
  .grid.md\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .security-card {
    padding: 1.25rem !important;
  }

  /* ── Tech stack grid ── */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4,
  .grid.grid-cols-1.md\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .tech-category {
    padding: 1.25rem !important;
  }

  /* ── Component cards ── */
  .component-card {
    padding: 1.25rem !important;
    gap: 1rem !important;
  }

  .component-preview {
    padding: 1rem !important;
  }

  /* ── Charts ── */
  canvas {
    max-height: 240px !important;
  }

  /* ── Code preview ── */
  .code-preview pre {
    font-size: 0.7rem !important;
    max-height: 160px !important;
  }

  /* ── Footer ── */
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    text-align: center !important;
  }

  footer .flex.flex-wrap {
    justify-content: center !important;
  }

  /* ── Checklist items ── */
  .checklist-item {
    padding: 0.6rem 0.75rem !important;
    font-size: 0.875rem !important;
  }

  /* ── Demo buttons: full width ── */
  .demo-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ── Badge overflow fix ── */
  .inline-flex.items-center.gap-2.px-4.py-2 {
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
  }
}

/* Extra small phones */
@media (max-width: 380px) {
  h1.text-5xl {
    font-size: 2rem !important;
  }

  .stat-card {
    padding: 1rem 0.75rem !important;
  }

  .stat-number {
    font-size: 1.5rem !important;
  }

  .stat-label {
    font-size: 0.75rem !important;
  }

  .stat-icon {
    width: 36px !important;
    height: 36px !important;
  }

  h2.text-4xl,
  h2.text-5xl {
    font-size: 1.6rem !important;
  }

  section {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  .feature-card:hover,
  .stat-card:hover,
  .security-card:hover,
  .tech-item:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .arch-layer:hover {
    transform: none !important;
  }
}