/* ============================================
   BuildItByAI — Design System (Arabic RTL)
   Minimalist · Premium · ProductHunt-inspired
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfc;
  --bg-featured: #fef0e0;
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #e85d04;
  --accent-hover: #c44d03;
  --accent-light: #fef3e2;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'IBM Plex Sans Arabic', sans-serif;
  --transition: all 0.2s ease;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #263348;
  --bg-featured: #2a1f0e;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #fb923c;
  --accent-hover: #f97316;
  --accent-light: #1c1810;
  --border: #334155;
  --border-light: #1e293b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: var(--font);
  border: none;
}

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header / Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.85);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0;
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-submit {
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-submit:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.btn-theme {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}

.btn-theme:hover {
  background: var(--border);
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 64px 0 40px;
  background: var(--bg-primary);
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

/* --- Search Bar --- */
.search-wrapper {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}

.search-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.search-wrapper .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* --- Filters / Categories --- */
.filters {
  display: flex;
  gap: 8px;
  padding: 20px 0 32px;
  overflow-x: auto;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.filter-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Tools Count --- */
.tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tools-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- Tool Cards --- */
.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-card);
  transition: var(--transition);
  cursor: pointer;
}

.tool-card:hover {
  background: var(--bg-card-hover);
}

.tool-card.featured {
  background: var(--bg-featured);
}

[data-theme="dark"] .tool-card.featured {
  background: var(--bg-featured);
}

/* --- Category Headers --- */
.category-header {
  padding: 16px 24px 12px;
  background: var(--bg-card);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--accent);
}

.category-header:not(:first-child) {
  border-top: 8px solid var(--bg-secondary);
}

.tool-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.tool-info {
  flex: 1;
  min-width: 0;
}

.tool-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-name .badge-featured {
  font-size: 0.7rem;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}

.tool-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-review-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tool-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.tool-tag {
  font-size: 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 100px;
}

.tool-price {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-visit {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--text-primary);
  color: var(--bg-primary);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-visit:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* --- Newsletter Section --- */
.newsletter {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  padding: 56px 0;
  margin-top: 56px;
  text-align: center;
}

.newsletter h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.newsletter p {
  color: #94a3b8;
  margin-bottom: 28px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid #334155;
  background: #1e293b;
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.newsletter-form input:focus {
  border-color: var(--accent);
}

.newsletter-form input::placeholder {
  color: #64748b;
}

.newsletter-form button {
  padding: 12px 24px;
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  border: 2px solid #fff;
}

.newsletter-form button:hover {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

/* --- Footer --- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
}

.footer-brand {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.footer-brand span {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 16px 0;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-disclosure {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 16px auto 0;
  line-height: 1.6;
}

/* --- No Results --- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results .emoji {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tool-card {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  .tool-price {
    display: none;
  }

  .tool-actions {
    width: 100%;
  }

  .btn-visit {
    width: 100%;
    text-align: center;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .filters {
    justify-content: flex-start;
  }
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-card {
  animation: fadeIn 0.3s ease forwards;
}

.tool-card:nth-child(n) {
  animation-delay: calc(var(--i, 0) * 0.03s);
}

/* --- About Page --- */
.about-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px 0 60px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  transition: var(--transition);
}

.about-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.about-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.about-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.about-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* --- Submit Form --- */
.submit-form-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 0 60px;
}

.submit-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn-submit-form {
  padding: 14px 28px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}

.btn-submit-form:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.submit-success {
  text-align: center;
  padding: 60px 20px;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.submit-success h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.submit-success p {
  color: var(--text-secondary);
  font-size: 1rem;
}