/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:          #0D0D0D;
  --surface:     #161616;
  --surface-alt: #1e1e1e;
  --border:      #2a2a2a;
  --accent:      #6B1A2A;
  --accent-dim:  #4d1320;
  --accent-glow: rgba(107, 26, 42, 0.35);
  --text:        #F5E6C8;
  --text-muted:  #a08c6e;
  --success:     #2e6b3e;
  --error:       #7a1c1c;
  --radius:      8px;
  --shadow:      0 4px 24px rgba(0, 0, 0, 0.6);
}

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

/* ── Base ──────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--text); text-decoration: none; }
ul { list-style: none; }

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-logo {
  font-family: 'Amiri', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

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

.nav-active {
  color: var(--text) !important;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.nav-logout-form { margin: 0; flex-shrink: 0; }

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-logout:hover {
  color: #e07070;
  border-color: #4a2020;
  background: rgba(122,28,28,0.12);
}

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(107,26,42,0.18) 0%, transparent 70%);
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.login-brand { text-align: center; }

.login-logo {
  font-family: 'Amiri', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1;
}

.login-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(107,26,42,0.15);
}

.login-title {
  font-family: 'Amiri', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-form { display: flex; flex-direction: column; gap: 1.1rem; }

.input-wrapper { position: relative; }

.input-wrapper .form-input { padding-left: 2.75rem; }

.toggle-pass {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.toggle-pass:hover { color: var(--text); }

.btn-full { width: 100%; justify-content: center; padding: 0.7rem; font-size: 1rem; margin-top: 0.25rem; }

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

/* ── Main ──────────────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: 'Amiri', serif;
  font-size: 1.6rem;
  font-weight: 700;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(46, 107, 62, 0.15);
  border-color: var(--success);
  color: #7ecb93;
}

.alert-error {
  background: rgba(122, 28, 28, 0.2);
  border-color: var(--error);
  color: #e07070;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
}
.btn-primary:hover { background: #7e1f32; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

.btn-edit {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}
.btn-edit:hover { border-color: var(--accent); }

.btn-delete {
  background: transparent;
  color: #c05050;
  border-color: #4a2020;
}
.btn-delete:hover { background: rgba(122, 28, 28, 0.25); }

/* ── Drag hint ─────────────────────────────────────────────────────────────── */
.drag-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Dhikr list ────────────────────────────────────────────────────────────── */
.dhikr-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dhikr-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}

.dhikr-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.dhikr-card.dhikr-inactive {
  opacity: 0.45;
}

.dhikr-card.dragging {
  opacity: 0.35;
  border-style: dashed;
}

.dhikr-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1.1rem;
  letter-spacing: -2px;
  padding: 0 0.25rem;
  user-select: none;
  flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }

.dhikr-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.dhikr-text {
  font-size: 1.05rem;
  font-family: 'Amiri', serif;
  line-height: 1.5;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dhikr-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dhikr-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.dhikr-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.dhikr-actions form { margin: 0; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.dhikr-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.form-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  width: 100%;
  transition: border-color 0.2s;
  direction: rtl;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { padding: 0.75rem 1rem; }
  .main-content { padding: 1.25rem 1rem; }

  .dhikr-text { font-size: 0.95rem; }
  .dhikr-actions { flex-direction: column; }

  .dhikr-card { flex-wrap: wrap; }
  .dhikr-status { display: none; }
}
