
/* Modern, clean, Islamic-inspired theme (no external fonts). */
:root {
  --bg: #0a0f0d;
  --panel: #0f1512;
  --panel-2: #111a17;
  --ink: #e8f0ec;
  --muted: #a9b7b0;
  --accent: #1fa37e;   /* emerald */
  --accent-2: #bfa66b; /* gold-ish */
  --card: #121a17;
  --border: #1d2a25;
  --hl: #2b7a66;
  --danger: #b23b3b;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: radial-gradient(1200px 800px at 10% 0%, rgba(31,163,126,0.06), transparent 60%),
              radial-gradient(900px 600px at 100% 50%, rgba(191,166,107,0.08), transparent 60%),
              var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: 
    "header header"
    "nav main";
  min-height: 100vh;
}

/* Header */
.header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(15,21,18,0.85), rgba(15,21,18,0.65));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Logo */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.logo .mark {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, var(--accent), #0f5a47);
  box-shadow: inset 0 0 0 2px #0c3b2f, 0 2px 8px rgba(0,0,0,0.4);
}
.logo .brand {
  font-weight: 700; letter-spacing: .3px;
}

/* Search bar */
.searchbar {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
}
.searchbar input[type="text"] {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.searchbar input[type="text"]::placeholder { color: var(--muted); }
.searchbar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,163,126,0.25);
}
.button {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #16382f, #0f2923);
  color: white;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.button:active { transform: translateY(1px); }

/* Title under search */
.subtitle {
  margin-left: calc(28px + 10px + 8px);
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: center;
  padding: 10px 18px 16px;
  max-width: 1400px;
  margin: 0 auto;
}
.filters .group {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
}
.filters label {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
}

/* Sidebar nav */
.sidebar {
  grid-area: nav;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15,21,18,0.65), rgba(15,21,18,0.15));
  position: sticky; top: 62px; /* height of header approx */
  align-self: start;
  height: calc(100vh - 62px);
  overflow: auto;
}
.sidebar .slist {
  list-style: none; margin: 0; padding: 10px;
  display: grid; gap: 6px;
}
.sbtn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform .06s, border-color .2s, background .2s;
}
.sbtn:hover { border-color: var(--accent); }
.sbtn.active { background: #122d25; border-color: var(--accent); }

/* Main content */
.main {
  grid-area: main;
  padding: 14px 18px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: grid; gap: 14px;
}

/* Section headers */
.section-title {
  font-weight: 700;
  letter-spacing: .3px;
  margin: 6px 2px 2px;
  color: var(--accent-2);
}

/* Results list */
.results {
  display: grid; gap: 12px;
}

/* Verse row: always single-row, horizontally scrollable if narrow */
.verse-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

/* Card per translator */
.tcard {
  min-width: 260px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #131c19, #101815);
  scroll-snap-align: start;
}
.tcard .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.tcard .name {
  font-weight: 700; color: var(--accent);
}
.tcard .text {
  white-space: pre-wrap;
}

/* Highlight */
mark.hl {
  background: linear-gradient(180deg, rgba(31,163,126,0.35), rgba(31,163,126,0.25));
  padding: 0 2px; border-radius: 4px;
}

/* Loading overlay */
.loading {
  position: fixed; inset: 0;
  display: none; place-items: center;
  background: rgba(0,0,0,0.35);
  z-index: 20;
}
.loading.show { display: grid; }
.spinner {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Empty state */
.empty {
  color: var(--muted);
  padding: 20px; border: 1px dashed var(--border);
  border-radius: 14px; background: rgba(16, 24, 21, 0.4);
}

/* Mobile tweaks */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  .sidebar { position: static; height: auto; order: 2; }
}

/* ensure button text direction left-to-right and horizontal layout */
button, .btn { writing-mode: horizontal-tb !important; text-orientation: mixed !important; }
