@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@700&display=swap');
:root {
  --bg: #f0f1f5;
  --accent: #0088f6;
  --text: #1a1a1a;
  --muted: #666666;
}
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Arial, "Helvetica Neue", Helvetica, "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* minimalist neural network canvas background */
canvas.code-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
.wrap {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  z-index: 1;
}
header {
  border-top: 4px solid var(--accent);
  background: transparent;
  padding: 16px 0;
  width: 100%;
}
.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 20px;
}
.back-link {
  color: var(--accent);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 200ms ease;
}
.back-link:hover {
  opacity: 0.7;
}
main {
  padding: 40px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}
.center {
  width: 100%;
  max-width: 100%;
  text-align: center;
  position: relative;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  box-sizing: border-box;
}
/* code editor container */
.code-editor {
  background: #ffffffc7;
  border: 1px solid rgba(0, 136, 246, 0.2);
  padding: 32px 40px;
  border-radius: 12px;
  position: relative;
  text-align: left;
  direction: ltr;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 32px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* macOS window controls */
.code-editor::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #28c940;
}
.code-editor::after {
  content: "// Library";
  position: absolute;
  top: 12px;
  left: 72px;
  font-size: clamp(9px, 1.5vw, 11px);
  color: rgba(0, 136, 246, 0.4);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.code-line {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.8;
  color: #1a1a1a;
  font-size: clamp(12px, 2.5vw, 14px);
}
.code-line .comment { color: #6A9955; }
.code-line .string { color: #CE9178; }
.code-line .keyword { color: #0088f6; }
.code-line .identifier { color: #1a1a1a; }
.code-line .operator { color: #1a1a1a; }
.code-line .number { color: #B5CEA8; }

h1 {
  margin: 0 0 12px 0;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.3px;
  text-align: center;
  direction: rtl;
}
.accent {
  color: var(--accent);
}
p {
  margin: 0 0 28px 0;
  font-size: clamp(15px, 2.4vw, 18px);
  color: var(--muted);
  line-height: 1.8;
}

/* Search Container */
.search-container {
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.search-box {
  padding: 16px 20px;
  margin-bottom: 0;
  position: relative;
}
.search-box::after {
  content: "// Search";
}
.search-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 136, 246, 0.3);
  color: #1a1a1a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: clamp(13px, 2vw, 15px);
  padding: 8px 32px 8px 8px;
  outline: none;
  transition: border-color 200ms ease;
  direction: rtl;
}
.search-input:focus {
  border-bottom-color: var(--accent);
}
.search-input::placeholder {
  color: rgba(106, 153, 85, 0.5);
}
.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(0, 136, 246, 0.4);
  pointer-events: none;
}

/* Category Filter */
.category-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
  direction: rtl;
}
.filter-btn {
  background: #ffffffc7;
  border: 1px solid rgba(0, 136, 246, 0.2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: all 200ms ease;
  direction: rtl;
}
.filter-btn:hover {
  border-color: var(--accent);
  background: rgba(0, 136, 246, 0.05);
}
.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Category Section */
.category-section {
  margin-bottom: 60px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* Featured/Highlighted Category Section */
.category-section-featured {
  position: relative;
  padding: 40px 20px;
  background: linear-gradient(135deg, rgba(0, 136, 246, 0.08) 0%, rgba(0, 136, 246, 0.03) 100%);
  border-radius: 16px;
  border: 2px solid rgba(0, 136, 246, 0.2);
  box-shadow: 0 4px 20px rgba(0, 136, 246, 0.1);
  margin-bottom: 60px;
}
.category-section-featured::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(0, 136, 246, 0.5) 100%);
  border-radius: 16px 16px 0 0;
}
.category-section-featured .category-title {
  color: var(--accent);
}
.category-section-featured .category-icon {
  color: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(0, 136, 246, 0.3));
}
.category-section-featured .tool-card {
  border-color: rgba(0, 136, 246, 0.3);
  background: #ffffff;
}
.category-section-featured .tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 136, 246, 0.15);
  transform: translateY(-4px);
}
/* Subcategory Header */
.subcategory-header {
  margin: 48px 0 32px 0;
  padding-top: 32px;
  border-top: 2px solid rgba(0, 136, 246, 0.15);
  text-align: center;
}
.subcategory-title {
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--accent);
  direction: rtl;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
.subcategory-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.subcategory-subtitle {
  text-align: center;
  direction: rtl;
  margin: 0;
  font-size: clamp(11px, 2vw, 13px);
}
.category-header {
  margin-bottom: 32px;
  text-align: center;
}
.category-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text);
  direction: rtl;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
.category-icon {
  width: clamp(28px, 4vw, 36px);
  height: clamp(28px, 4vw, 36px);
  color: var(--accent);
  flex-shrink: 0;
}
.category-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  cursor: help;
  color: var(--muted);
  transition: color 200ms ease;
}
.category-help:hover {
  color: var(--accent);
}
.category-help svg {
  width: 100%;
  height: 100%;
}
.category-help::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 14px;
  background: var(--text);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 6px;
  white-space: normal;
  width: 280px;
  max-width: 90vw;
  text-align: right;
  direction: rtl;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.category-help::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  border: 6px solid transparent;
  border-top-color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 1001;
}
.category-help:hover::before,
.category-help:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.category-subtitle {
  text-align: center;
  direction: rtl;
  margin: 0;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  direction: rtl;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
}

/* Tool Card */
.tool-card {
  background: #ffffffc7;
  border: 1px solid rgba(0, 136, 246, 0.2);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  text-align: left;
  direction: ltr;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 136, 246, 0.4);
}
.tool-image-wrapper {
  width: 100%;
  height: 160px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 136, 246, 0.05);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 136, 246, 0.1);
}
.tool-image {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  transition: transform 200ms ease;
}
.tool-card:hover .tool-image {
  transform: scale(1.05);
}
.tool-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  direction: rtl;
  text-align: right;
}
.tool-description {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 16px 0;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  direction: rtl;
  text-align: right;
  flex-grow: 1;
}
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  direction: rtl;
}
.tag {
  background: rgba(0, 136, 246, 0.1);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-weight: 500;
}
.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  transition: gap 200ms ease, opacity 200ms ease;
  direction: rtl;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 136, 246, 0.15);
}
.tool-link:hover {
  gap: 12px;
  opacity: 0.8;
}
.tool-link svg {
  width: 16px;
  height: 16px;
}

/* Hidden class for filtering */
.hidden {
  display: none !important;
}

footer {
  padding: 18px 20px 28px;
  color: var(--muted);
  font-size: clamp(10px, 2vw, 13px);
  text-align: center;
  border-top: 1px solid rgba(0,0,0,0.08);
  white-space: nowrap;
  line-height: 1.5;
}
footer span {
  display: inline;
  margin: 0;
}
a.link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.link:focus, a.link:hover {
  border-bottom-color: var(--accent);
  outline: none;
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in { opacity: 0; transform: translateY(6px); animation: fade 600ms ease forwards; }
  .fade-in.delay-1 { animation-delay: 120ms; }
  .fade-in.delay-2 { animation-delay: 240ms; }
  .fade-in.delay-3 { animation-delay: 360ms; }
  @keyframes fade { to { opacity: 1; transform: none; } }
}

/* Responsive Design */
@media (max-width: 768px) {
  .code-editor {
    padding: 24px 20px;
    margin: 0 0 24px 0;
    width: 100%;
    max-width: 100%;
  }
  .code-editor::before {
    width: 10px;
    height: 10px;
    top: 8px;
    left: 10px;
    box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #28c940;
  }
  .code-editor::after {
    font-size: clamp(8px, 1.5vw, 10px);
    top: 8px;
    left: 60px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  .tool-card {
    padding: 20px;
    margin: 0;
    width: 100%;
    max-width: 100%;
  }
  .tool-image-wrapper {
    height: 140px;
  }
  .category-filter {
    gap: 8px;
  }
  .filter-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  .search-box {
    padding: 12px 16px;
  }
  .search-input {
    font-size: 13px;
    padding: 6px 28px 6px 6px;
  }
  .search-icon {
    right: 16px;
    width: 16px;
    height: 16px;
  }
  main {
    padding: 24px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .center {
    width: 100%;
    max-width: 100%;
  }
  header {
    padding: 16px;
  }
  .category-section-featured {
    padding: 32px 16px;
    margin-bottom: 40px;
  }
  .subcategory-header {
    margin: 32px 0 24px 0;
    padding-top: 24px;
  }
  .subcategory-title {
    font-size: clamp(18px, 2.5vw, 22px);
    gap: 8px;
  }
  .subcategory-title svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .code-editor {
    padding: 16px 12px;
    margin: 0 0 20px 0;
    width: 100%;
    max-width: 100%;
  }
  .code-editor::before {
    width: 9px;
    height: 9px;
    top: 6px;
    left: 8px;
    box-shadow: 14px 0 0 #ffbd2e, 28px 0 0 #28c940;
  }
  .code-editor::after {
    font-size: clamp(7px, 1.5vw, 9px);
    top: 6px;
    left: 50px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  .tool-card {
    padding: 16px 12px;
    margin: 0;
    width: 100%;
    max-width: 100%;
  }
  .tool-image-wrapper {
    height: 120px;
    margin-bottom: 12px;
  }
  .tool-title {
    font-size: 18px;
    margin: 0 0 10px 0;
  }
  .tool-description {
    font-size: 13px;
    margin: 0 0 12px 0;
  }
  .tag {
    font-size: 10px;
    padding: 3px 8px;
  }
  .tool-link {
    font-size: 13px;
  }
  .category-filter {
    gap: 6px;
  }
  .filter-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .category-title {
    font-size: clamp(20px, 3vw, 24px);
    gap: 8px;
  }
  .category-icon {
    width: clamp(24px, 3vw, 28px);
    height: clamp(24px, 3vw, 28px);
  }
  .category-help {
    width: 18px;
    height: 18px;
    margin-right: 6px;
  }
  .category-help::before {
    width: 240px;
    font-size: 12px;
    padding: 8px 12px;
  }
  .search-box {
    padding: 10px 12px;
  }
  .search-input {
    font-size: 12px;
    padding: 6px 24px 6px 6px;
  }
  .search-icon {
    right: 12px;
    width: 14px;
    height: 14px;
  }
  main {
    padding: 20px 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .center {
    width: 100%;
    max-width: 100%;
  }
  .category-section-featured {
    padding: 24px 12px;
    margin-bottom: 32px;
  }
  .subcategory-header {
    margin: 24px 0 20px 0;
    padding-top: 20px;
  }
  .subcategory-title {
    font-size: clamp(16px, 2vw, 20px);
    gap: 6px;
  }
  .subcategory-title svg {
    width: 16px;
    height: 16px;
  }
}

