/* ============================================================
   رفيق — Custom Styles (RTL Islamic Theme)
   ============================================================ */

/* ── Root Variables ── */
:root {
  --green-dark:   #1B4332;
  --green-mid:    #2d6a4f;
  --green-light:  #52b788;
  --gold:         #D4AF37;
  --gold-light:   #f0d060;
  --bg:           #F5F5F0;
  --surface:      #ffffff;
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --danger:       #dc2626;
  --success:      #16a34a;
  --warn:         #d97706;
}

/* ── Body & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  direction: rtl;
  font-family: 'Segoe UI', 'Arial', 'Helvetica Neue', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  margin: 0;
}

/* ── Islamic Geometric SVG Background Pattern ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cg fill='none' stroke='%231B4332' stroke-width='1'%3E%3Cpolygon points='40,5 55,20 75,20 75,40 75,60 55,60 40,75 25,60 5,60 5,40 5,20 25,20'/%3E%3Cpolygon points='40,15 52,26 68,26 68,40 68,54 52,54 40,65 28,54 12,54 12,40 12,26 28,26'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3Cline x1='40' y1='5' x2='40' y2='15'/%3E%3Cline x1='40' y1='65' x2='40' y2='75'/%3E%3Cline x1='5' y1='40' x2='15' y2='40'/%3E%3Cline x1='65' y1='40' x2='75' y2='40'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--green-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dark); }

/* ── Typography helpers ── */
.font-arabic { font-family: 'Segoe UI', 'Arial', sans-serif; }
.text-gold { color: var(--gold); }
.text-green-dark { color: var(--green-dark); }

/* ── Prayer Card ── */
.prayer-card {
  border-radius: 14px;
  padding: 14px 16px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.prayer-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 14px 14px 0;
}
.prayer-card.status-done {
  background: #f0fdf4;
  border-color: #86efac;
}
.prayer-card.status-done::before { background: var(--success); }
.prayer-card.status-missed {
  background: #fef2f2;
  border-color: #fca5a5;
}
.prayer-card.status-missed::before { background: var(--danger); }
.prayer-card.status-pending {
  background: #fffbeb;
  border-color: #fcd34d;
}
.prayer-card.status-pending::before { background: var(--warn); }
.prayer-card.status-future {
  background: #f9fafb;
  border-color: #e5e7eb;
}
.prayer-card.status-future::before { background: #9ca3af; }
.prayer-card.status-current {
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.2);
}
.prayer-card.status-current::before { background: var(--gold); }

/* ── Progress Ring ── */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.progress-ring-container canvas {
  display: block;
}
.progress-ring-label {
  position: absolute;
  text-align: center;
  pointer-events: none;
  line-height: 1.2;
}

/* ── Navigation Tabs ── */
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  color: #6b7280;
  font-size: 11px;
  text-decoration: none;
  border: none;
  background: transparent;
  min-width: 56px;
}
.nav-tab svg { width: 22px; height: 22px; transition: all 0.2s; }
.nav-tab.active {
  color: var(--green-dark);
  background: rgba(27,67,50,0.08);
  font-weight: 600;
}
.nav-tab.active svg { color: var(--green-dark); transform: scale(1.1); }
.nav-tab:hover:not(.active) {
  color: var(--green-mid);
  background: rgba(27,67,50,0.04);
}

/* Sidebar nav links (desktop) */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
}
.sidebar-link.active {
  background: rgba(212,175,55,0.2);
  color: var(--gold);
  font-weight: 600;
}
.sidebar-link:hover:not(.active) {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* ── Gold Border Card ── */
.gold-border {
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: linear-gradient(135deg, #fefce8 0%, #fff 60%);
  box-shadow: 0 2px 12px rgba(212,175,55,0.15);
}

/* ── Input & Select Styles ── */
.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: var(--text);
  outline: none;
  direction: rtl;
}
.input-field:focus {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}
.input-field::placeholder { color: #9ca3af; }

select.input-field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231B4332' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--green-dark);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--green-mid); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-gold {
  background: var(--gold);
  color: var(--green-dark);
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--green-dark);
  border: 2px solid var(--green-dark);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-outline:hover { background: var(--green-dark); color: white; }

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-danger:hover { background: #b91c1c; }

/* ── Toggle Button ── */
.toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  text-align: right;
}
.toggle-btn.active {
  border-color: var(--green-mid);
  background: #f0fdf4;
  color: var(--green-dark);
  font-weight: 600;
}
.toggle-btn .check-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.toggle-btn.active .check-icon {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: white;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 2px 12px rgba(0,0,0,0.04);
}
.card-sm {
  background: white;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.section-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-dark);
  margin: 0;
}
.section-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  min-width: 220px;
  text-align: center;
  pointer-events: auto;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--green-mid); }
.toast.warn    { background: var(--warn); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
#modal-overlay.open { display: flex; }
.modal-box {
  background: white;
  border-radius: 20px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  direction: rtl;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Loading Overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,67,50,0.92);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: white;
}
#loading-overlay.active { display: flex; }
.spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status Badges ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-gold   { background: #fef9c3; color: #854d0e; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

/* ── Counter Buttons ── */
.counter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.counter-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--green-mid);
  background: white;
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}
.counter-btn:hover { background: var(--green-dark); color: white; border-color: var(--green-dark); }
.counter-value {
  min-width: 40px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark);
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  background: #e5e7eb;
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--green-dark), var(--green-light));
}
.progress-bar-fill.gold { background: linear-gradient(90deg, #b7860a, var(--gold)); }

/* ── Calendar Grid ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s;
  font-size: 13px;
  font-weight: 600;
}
.calendar-day:hover { transform: scale(1.05); }
.calendar-day.today {
  border: 2px solid var(--gold);
  background: #fef9c3 !important;
}
.calendar-day.future { background: #f9fafb; color: #9ca3af; cursor: default; }
.calendar-day.all-done { background: #dcfce7; color: #166534; }
.calendar-day.partial  { background: #fef3c7; color: #92400e; }
.calendar-day.none     { background: #fee2e2; color: #991b1b; }
.calendar-day.empty    { background: transparent; cursor: default; }
.prayer-dots { display: flex; gap: 2px; }
.prayer-dot  { width: 5px; height: 5px; border-radius: 50%; }

/* ── Heatmap ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: auto repeat(7, 1fr);
  gap: 4px;
  align-items: center;
}
.heatmap-cell {
  height: 32px;
  border-radius: 6px;
}

/* ── Settings Tabs ── */
.settings-tab-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
}
.settings-tab-btn.active {
  background: var(--green-dark);
  color: white;
  font-weight: 600;
}

/* ── Streak Card ── */
.streak-card {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  border-radius: 16px;
  padding: 18px;
  color: white;
}

/* ── Quote Card ── */
.quote-card {
  position: relative;
  padding: 20px 24px;
  text-align: center;
}
.quote-card::before, .quote-card::after {
  content: '❝';
  font-size: 36px;
  color: var(--gold);
  opacity: 0.5;
  position: absolute;
  line-height: 1;
}
.quote-card::before { top: 8px; right: 16px; }
.quote-card::after  { content: '❞'; bottom: 8px; left: 16px; }

/* ── Responsive helpers ── */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .card { padding: 14px; }
}
@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
}

/* ── Countdown ── */
.countdown {
  font-size: 28px;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: 1px;
}

/* ── Number input no arrows ── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ── Login page specific ── */
.login-bg {
  background: linear-gradient(160deg, var(--green-dark) 0%, #2d6a4f 50%, #1a3d2b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: white;
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}
.tab-active {
  color: var(--green-dark);
  border-bottom: 3px solid var(--green-dark);
  font-weight: 700;
}
.tab-inactive {
  color: #9ca3af;
  border-bottom: 3px solid transparent;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(212,175,55,0); }
}
.pulse-gold { animation: pulse-gold 2s infinite; }
