/*
 * SAHHILHA (سهّلها) - Design System & Base CSS
 * Production-Ready RTL Arabized Architecture
 */

:root {
  /* Color Palette - Light Mode */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-dark: #065f46;
  --primary-light: #ecfdf5;
  --primary-tint: #d1fae5;
  --primary-border: #a7f3d0;

  --accent: #0284c7;
  --accent-light: #e0f2fe;

  --background: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-hover: #f8fafc;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-arabic: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Cairo", "Tajawal", system-ui, sans-serif;
  --container-max: 1200px;
}

[data-theme="dark"] {
  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-dark: #059669;
  --primary-light: #064e3b;
  --primary-tint: #022c22;
  --primary-border: #047857;

  --accent: #38bdf8;
  --accent-light: #0c4a6e;

  --background: #0f172a;
  --surface: #1e293b;
  --surface-alt: #0f172a;
  --surface-hover: #26354a;

  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --border: #334155;
  --border-light: #1e293b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-arabic);
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  direction: rtl;
  text-align: right;
  background-color: var(--background);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  color: var(--text);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
p { color: var(--text-muted); }

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul {
  list-style: none;
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  right: 1rem;
  background: var(--primary);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 600;
}
.skip-link:focus {
  top: 1rem;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 2.5rem;
}

.section-header h2 {
  margin-bottom: 0.75rem;
  color: var(--text);
}

.section-header p {
  font-size: 1.05rem;
}

.section-tint {
  background-color: var(--surface-alt);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  min-height: 44px;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: var(--surface-alt);
  border-color: var(--text-muted);
}

.btn-disabled {
  background-color: var(--surface-alt);
  color: var(--text-light);
  border: 1px solid var(--border);
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: var(--transition);
}
.btn-icon:hover {
  background-color: var(--surface-alt);
  color: var(--primary);
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .site-header {
  background-color: rgba(30, 41, 59, 0.92);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link.active {
  color: var(--primary);
  font-weight: 700;
  background-color: var(--primary-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--background) 100%);
  overflow: hidden;
}

[data-theme="dark"] .hero {
  background: linear-gradient(180deg, rgba(6, 78, 59, 0.25) 0%, var(--background) 100%);
}

.hero-background-art {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 180px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 1;
}

[data-theme="dark"] .hero-background-art {
  opacity: 0.08;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.hero p {
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 2.25rem;
  color: var(--text-muted);
}

/* Search Box Container */
.search-container {
  max-width: 600px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.4rem 0.6rem 0.4rem 1.25rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  padding: 0.5rem;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-btn {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-btn:hover {
  background-color: var(--primary-hover);
}

/* Popular Search Chips */
.popular-searches {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.popular-label {
  color: var(--text-muted);
  font-weight: 600;
}

.search-chip {
  background-color: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.search-chip:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  border-color: var(--primary-border);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.category-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-info {
  flex: 1;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.category-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--surface-alt);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.category-arrow {
  color: var(--text-light);
  transition: var(--transition);
}

.category-card:hover .category-arrow {
  color: var(--primary);
  transform: translateX(-4px);
}

/* Tool Cards System */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tool-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.tool-card:hover {
  border-color: var(--primary-border);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-favorite {
  background: transparent;
  border: none;
  color: var(--text-light);
  padding: 0.4rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-favorite:hover,
.btn-favorite.active {
  color: var(--danger);
}

.tool-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.tool-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.tool-category-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary);
}

/* No Results Notice */
.no-results {
  text-align: center;
  padding: 3rem 1.5rem;
  background-color: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  grid-column: 1 / -1;
}

.no-results svg {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.no-results h3 {
  margin-bottom: 0.5rem;
}

/* Why Sahhilha Section */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  text-align: center;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Articles / Guides Preview */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.article-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.article-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.article-thumb {
  height: 160px;
  background: linear-gradient(135deg, var(--surface-alt) 0%, var(--border-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.article-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-badge {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.article-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.article-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* About Preview Section */
.about-preview {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.about-preview h2 {
  margin-bottom: 1rem;
}

.about-preview p {
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 750px;
  margin: 0 auto 1.75rem;
}

/* Ad Slot Container (Architecture Ready - Empty) */
.ad-slot {
  display: none; /* Inactive by default */
  width: 100%;
  max-width: 970px;
  margin: 2rem auto;
  text-align: center;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand h3 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.footer-brand p {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 380px;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-bar {
  display: none; /* Desktop default */
}

/* Mobile Drawer Menu */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100%;
  background-color: var(--surface);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 200;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.mobile-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-link {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-link.active {
  color: var(--primary);
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Accessibility Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
