/* ========================================
   AlKetab API - Main Stylesheet
   ======================================== */

:root {
  /* Colors */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --primary-rgb: 16, 185, 129;

  --secondary: #3b82f6;
  --secondary-dark: #2563eb;

  --dark: #0f172a;
  --dark-light: #1e293b;
  --dark-lighter: #334155;

  --light: #f8fafc;
  --light-dark: #e2e8f0;

  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dark: #1e293b;

  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --gradient-dark: linear-gradient(180deg, var(--dark) 0%, var(--dark-light) 100%);
  --gradient-glow: radial-gradient(ellipse at center, rgba(var(--primary-rgb), 0.15) 0%, transparent 70%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(var(--primary-rgb), 0.3);

  /* Spacing */
  --container-width: 1200px;
  --section-padding: 100px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

/* ========================================
   Reset & Base
   ======================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--dark);
  overflow-x: hidden;
}

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

a:hover {
  color: var(--primary-light);
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   Layout
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========================================
   Typography
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.highlight {
  background: linear-gradient(120deg, rgba(var(--primary-rgb), 0.3) 0%, rgba(var(--primary-rgb), 0.1) 100%);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(var(--primary-rgb), 0.4);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--dark-lighter);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 17px;
}

.btn-block {
  width: 100%;
}

/* ========================================
   Navbar
   ======================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all var(--transition-normal);
}

.navbar {
  padding: 20px 0;
  transition: all var(--transition-normal);
}

.navbar.scrolled {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--dark-lighter);
  padding: 12px 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.logo-badge {
  background: var(--gradient-primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.navbar-toggler {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 40px;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--transition-fast);
}

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

.navbar-auth {
  display: flex;
  gap: 12px;
}

/* Mobile Menu */
@media (max-width: 768px) {
  .navbar-toggler {
    display: block;
  }

  .navbar-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--dark-light);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 24px 24px;
    gap: 24px;
    transition: right var(--transition-normal);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .navbar-menu.open {
    right: 0;
  }

  .navbar-nav {
    flex-direction: column;
    gap: 16px;
  }

  .navbar-auth {
    flex-direction: column;
    width: 100%;
  }

  .navbar-auth .btn {
    width: 100%;
  }
}

/* RTL Mobile Menu Support */
@media (max-width: 768px) {
  html[dir="rtl"] .navbar-menu {
    right: auto;
    left: -100%;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  html[dir="rtl"] .navbar-menu.open {
    left: 0;
    right: auto;
  }

  html[dir="rtl"] .navbar-menu {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  html[dir="rtl"] .navbar-nav {
    flex-direction: column !important;
    width: 100% !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  html[dir="rtl"] .navbar-auth {
    flex-direction: column !important;
    width: 100% !important;
    display: flex !important;
    margin-top: 24px;
  }

  html[dir="rtl"] .navbar-auth .btn {
    width: 100% !important;
    display: flex !important;
    justify-content: center;
  }
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0.5;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2310b981' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: float 60s linear infinite;
}

@keyframes float {
  from {
    transform: translate(0, 0) rotate(0deg);
  }

  to {
    transform: translate(-50px, -50px) rotate(360deg);
  }
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(40px, 6vw, 72px);
  margin-bottom: 24px;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: clamp(18px, 2.5vw, 22px);
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 60px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========================================
   Sections Common
   ======================================== */

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-tag {
  display: inline-block;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(32px, 4vw, 48px);
  margin-bottom: 16px;
}

.section-desc {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   About / Features Section
   ======================================== */

.about {
  padding: var(--section-padding) 0;
  background: var(--dark-light);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--dark);
  border: 1px solid var(--dark-lighter);
  border-radius: var(--radius-lg);
  padding: 40px;
  transition: all var(--transition-normal);
}

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

.feature-icon {
  width: 64px;
  height: 64px;
  background: rgba(var(--primary-rgb), 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.feature-icon i {
  font-size: 28px;
  color: var(--primary);
}

.feature-card h3 {
  font-size: 22px;
  margin-bottom: 12px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 15px;
}

/* ========================================
   Demo Section
   ======================================== */

.demo {
  padding: var(--section-padding) 0;
  background: var(--dark);
}

.search-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--dark-light);
  border: 2px solid var(--dark-lighter);
  border-radius: var(--radius-full);
  padding: 8px 8px 8px 24px;
  transition: all var(--transition-normal);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}

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

.search-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lang-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Rubik', sans-serif;
}

.lang-btn.active {
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary);
}

.search-btn {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-normal);
}

.search-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

/* Loading State */
.search-loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--dark-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* AI Explanation */
.ai-explanation {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-top: 24px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient-primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.ai-explanation p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  direction: auto;
}

/* Results */
.results-container {
  margin-top: 24px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--dark-lighter);
  margin-bottom: 16px;
}

.results-header span {
  font-size: 14px;
  color: var(--text-muted);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--dark-light);
  border: 1px solid var(--dark-lighter);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}

.result-card:hover {
  border-color: var(--primary);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.result-surah {
  display: flex;
  align-items: center;
  gap: 12px;
}

.surah-number {
  width: 36px;
  height: 36px;
  background: rgba(var(--primary-rgb), 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.surah-name {
  font-weight: 700;
  color: var(--text);
}

.surah-name-ar {
  font-family: 'Rubik', sans-serif;
  color: var(--text-muted);
  font-size: 14px;
}

.result-position {
  font-size: 13px;
  color: var(--text-muted);
}

.result-verse {
  font-family: 'Rubik', 'Traditional Arabic', serif;
  font-size: 24px;
  line-height: 2;
  color: var(--text);
  direction: rtl;
  text-align: right;
  margin-bottom: 12px;
}

.result-verse mark {
  background: rgba(var(--primary-rgb), 0.3);
  color: var(--primary-light);
  padding: 2px 4px;
  border-radius: 4px;
}

.result-translation {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Error State */
.search-error {
  text-align: center;
  padding: 40px;
  color: var(--error);
}

.search-error i {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ========================================
   Pricing Section
   ======================================== */

.pricing {
  padding: var(--section-padding) 0;
  background: var(--dark-light);
}

.pricing-card {
  max-width: 400px;
  margin: 0 auto;
  background: var(--dark);
  border: 2px solid var(--dark-lighter);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  transition: all var(--transition-normal);
}

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

.pricing-header {
  margin-bottom: 32px;
}

.pricing-header h3 {
  font-size: 24px;
  margin-bottom: 16px;
}

.pricing-value {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.pricing-value .currency {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 8px;
}

.pricing-value .amount {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.pricing-value .period {
  font-size: 16px;
  color: var(--text-muted);
  align-self: flex-end;
  margin-bottom: 12px;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 32px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--dark-lighter);
  color: var(--text-muted);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features i {
  color: var(--primary);
}

/* Itqan Sponsor Button */
.itqan-sponsor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 400px;
  width: 100%;
  margin: 40px auto 0;
  padding: 20px 24px;
  border: 1px solid var(--dark-lighter);
  border-radius: var(--radius-lg);
  background: rgba(var(--primary-rgb), 0.05);
  color: var(--text-muted);
  font-size: 18px;
  transition: all var(--transition-normal);
  text-align: center;
}

.itqan-sponsor:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--text);
}

.itqan-logo {
  height: 64px;
  width: auto;
  opacity: 0.9;
  transition: opacity var(--transition-fast);
}

.itqan-sponsor:hover .itqan-logo {
  opacity: 1;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  background: var(--dark);
  border-top: 1px solid var(--dark-lighter);
  padding: 60px 0 0;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 14px;
}

.copyright-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 14px;
}

.mimv-logo {
  height: 20px;
  width: auto;
  opacity: 0.8;
}

.footer-links h4 {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--text);
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

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

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

.footer-bottom {
  border-top: 1px solid var(--dark-lighter);
  padding: 24px 0;
  text-align: center;
}

.footer-bottom p {
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .footer-content {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: span 1;
  }
}