/* CSS Variables for theming */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-color: #059669;
  --accent-hover: #047857;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --accent-color: #10b981;
    --accent-hover: #059669;
  }
}

/* Dark mode toggle support */
body.dark-mode {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --accent-color: #10b981;
  --accent-hover: #059669;
}

/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {
  .header {
    background-color: rgba(15, 23, 42, 0.8);
  }
}

.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.site-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-color);
}

/* Main content */
.main {
  flex: 1;
  padding: 24px 0;
}

/* Search section */
.search-section {
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Category filter */
.category-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

.category-btn {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.category-btn:hover {
  background-color: var(--bg-card);
  border-color: var(--accent-color);
}

.category-btn.active {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Phrases list */
.phrases-list {
  display: grid;
  gap: 16px;
}

/* Phrase card */
.phrase-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.phrase-card:hover {
  box-shadow: var(--shadow-md);
}

.phrase-card.large {
  padding: 32px 24px;
}

.phrase-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.phrase-card .phrase-arabic {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.8;
  direction: rtl;
}

.phrase-card.large .phrase-arabic {
  font-size: 2.75rem;
  margin-bottom: 16px;
}

.phrase-card .phrase-transliteration {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 8px;
}

.phrase-card .phrase-meaning {
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

.phrase-card .phrase-category {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: capitalize;
  color: var(--accent-color);
  background-color: rgba(5, 150, 105, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
  margin-top: 8px;
}

.phrase-card.large .phrase-category {
  display: none;
}

/* Copy button */
.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background-color: var(--accent-color);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.copy-btn:hover {
  background-color: var(--accent-hover);
}

.copy-btn:active {
  transform: scale(0.98);
}

.copy-btn.copied {
  background-color: var(--accent-hover);
}

.copy-btn.large {
  padding: 16px 32px;
  font-size: 1.125rem;
  max-width: 200px;
  margin: 24px auto;
}

.copy-icon {
  flex-shrink: 0;
}

/* Single phrase page */
.single-phrase .phrase-card {
  border: none;
  box-shadow: var(--shadow-lg);
}

/* Translations section */
.translations-section,
.usage-section,
.share-section,
.related-phrases {
  margin-top: 32px;
}

.translations-section h2,
.usage-section h2,
.share-section h2,
.related-phrases h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.meaning {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.translations-list {
  display: grid;
  gap: 12px;
}

.translation-item {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.translation-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.translation-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

/* Usage section */
.usage-section p {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.quran-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--accent-color);
  margin-top: 12px;
}

.quran-ref svg {
  width: 16px;
  height: 16px;
}

/* Share buttons */
.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.share-btn:active {
  transform: scale(0.96);
}

.share-btn.whatsapp {
  background-color: #25D366;
}

.share-btn.telegram {
  background-color: #0088cc;
}

.share-btn.copy {
  background-color: var(--text-secondary);
}

/* Related phrases */
.related-list {
  display: grid;
  gap: 8px;
}

.related-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color 0.2s;
}

.related-item:hover {
  background-color: var(--border-color);
}

.related-item .arabic {
  font-family: 'Amiri', serif;
  font-size: 1.125rem;
  direction: rtl;
}

.related-item .arrow {
  color: var(--text-muted);
}

/* Footer */
.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  margin-top: auto;
}

.footer p {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (min-width: 640px) {
  .container {
    padding: 0 24px;
  }

  .phrase-card .phrase-arabic {
    font-size: 2.5rem;
  }

  .phrase-card.large .phrase-arabic {
    font-size: 3.5rem;
  }

  .share-buttons {
    flex-wrap: nowrap;
  }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.no-results {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
