/* AyahCompass — Soothing, Elegant & Modern Identity */

:root {
  --bg-page: #faf9f6;
  --bg-card: #ffffff;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --border-light: #e4e4e7;
  --border-subtle: #f4f4f5;
  
  /* Distinctive Palette */
  --accent-emerald: #059669;
  --accent-emerald-light: #ecfdf5;
  --accent-copper: #c2410c;
  --accent-copper-light: #fff7ed;
  --accent-slate: #475569;
  --accent-slate-light: #f1f5f9;
  
  --gold-ornament: #d97706;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 32px -6px rgba(0, 0, 0, 0.06), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
  --shadow-dropdown: 0 20px 40px -12px rgba(0, 0, 0, 0.14), 0 0 1px rgba(0, 0, 0, 0.1);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(#e2e8f0 1.2px, transparent 1.2px),
    radial-gradient(circle at 50% 0%, rgba(5, 150, 105, 0.06) 0%, transparent 60%);
  background-size: 32px 32px, 100% 100%;
}

/* Top Navigation */
.top-nav {
  width: 100%;
  border-bottom: 1px solid rgba(228, 228, 231, 0.8);
  background: rgba(250, 249, 246, 0.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.15);
  transition: transform 0.2s ease;
}

.logo:hover .logo-icon {
  transform: rotate(-6deg) scale(1.04);
}

/* Distinctive Logo Typography */
.logo-text {
  display: flex;
  align-items: baseline;
  user-select: none;
}

.logo-ayah {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: #18181b;
}

.logo-compass {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--accent-emerald);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Language / Translation Selector */
.lang-select {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 5px 10px 5px 12px;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  max-width: 190px;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
}

.nav-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: var(--accent-emerald-light);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* Page Container */
.page-container {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px 60px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex: 1;
}

/* Hero Section */
.hero-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-emerald);
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.18);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
}

.sparkle {
  color: var(--gold-ornament);
  font-size: 0.85rem;
}

/* Option A Calligraphy Banner */
.quran-calligraphy-banner {
  font-family: 'Amiri', serif;
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  color: #71717a;
  padding: 6px 18px;
  line-height: 2.1;
  letter-spacing: 0.5px;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.3rem, 5.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text-primary);
}

.hero-word-emerald {
  color: var(--accent-emerald);
}

.hero-word-copper {
  color: var(--accent-copper);
}

.hero-word-slate {
  color: var(--accent-slate);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.6;
}

/* Search Card & Autocomplete Input */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-card {
  position: relative;
  width: 100%;
}

.search-box-wrapper {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 8px 10px 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.search-box-wrapper:focus-within {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12), var(--shadow-md);
}

.search-icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

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

.search-input::placeholder {
  color: #a1a1aa;
  font-size: 0.95rem;
}

.search-btn {
  background: #18181b;
  color: #ffffff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.search-btn:hover {
  background: #27272a;
  transform: translateY(-1px);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.search-btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* Autocomplete Suggestion Dropdown */
.suggestion-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  padding: 6px;
  animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.suggestion-item {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--accent-emerald-light);
}

.suggestion-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.925rem;
  color: var(--text-primary);
}

.suggestion-icon {
  font-size: 1.05rem;
}

.suggestion-badge {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.suggestion-item:hover .suggestion-badge,
.suggestion-item.active .suggestion-badge {
  color: var(--accent-emerald);
  background: rgba(5, 150, 105, 0.12);
}

/* Quick Suggestion Chips */
.quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
}

.chips-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.chip {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background: var(--accent-emerald-light);
  transform: translateY(-1px);
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 16px;
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(5, 150, 105, 0.15);
  border-top-color: var(--accent-emerald);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.cold-start-notice {
  font-size: 0.85rem;
  color: var(--accent-copper);
  background: var(--accent-copper-light);
  border: 1px solid rgba(194, 65, 12, 0.25);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  max-width: 520px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

/* Alert Box */
.alert-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Ayah Result Card */
.ayah-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 26px;
  animation: cardReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.ayah-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-copper) 100%);
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-mood {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: var(--accent-emerald-light);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-ref {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-copper);
  background: var(--accent-copper-light);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
}

/* Arabic Verse Typography */
.arabic-block {
  padding: 10px 0;
}

.arabic-verse {
  font-family: 'Amiri', 'Traditional Arabic', 'Scheherazade', serif;
  font-size: clamp(1.7rem, 4.2vw, 2.2rem);
  line-height: 2.25;
  text-align: right;
  color: #111827;
  word-spacing: 4px;
}

/* Ornamental Divider */
.ornament-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--gold-ornament);
  opacity: 0.65;
}

.ornament-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.3), transparent);
}

.ornament-glyph {
  font-size: 1.3rem;
}

/* Translation */
.translation-block {
  padding: 4px 0;
}

.translation-verse {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.8;
  color: #27272a;
  font-style: italic;
}

/* Card Footer */
.card-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.source-label {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.grounded-label {
  font-size: 0.775rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

.footer-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: #fafafa;
}

/* Page Footer */
.page-footer {
  text-align: center;
  padding: 28px 0;
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-subtext {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.page-footer a {
  color: var(--accent-emerald);
  text-decoration: none;
  font-weight: 500;
}

.page-footer a:hover {
  text-decoration: underline;
}

/* Scholar Disclaimer */
.scholar-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffbeb;
  border: 1px dashed #fbbf24;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-size: 0.845rem;
  color: #78350f;
  line-height: 1.6;
}

.disclaimer-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.scholar-disclaimer p {
  margin: 0;
}

.scholar-disclaimer strong {
  font-weight: 600;
  color: #92400e;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .page-container {
    padding: 24px 16px 40px 16px;
  }
  .search-box-wrapper {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  .search-btn {
    justify-content: center;
  }
  .ayah-card {
    padding: 24px 20px;
  }
  .arabic-verse {
    font-size: 1.55rem;
    line-height: 2.05;
  }
  .translation-verse {
    font-size: 1.05rem;
  }
  .card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .footer-actions {
    justify-content: flex-end;
  }
}
