/* ========================================
   rakez ركز — Components
   ======================================== */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.06);
}

.btn:active::after {
  background: rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--clr-primary-dark), var(--clr-primary));
  color: var(--clr-text-on-primary);
  box-shadow: 0 4px 15px rgba(81, 69, 220, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(81, 69, 220, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--control-bg);
  color: var(--clr-text);
  border: 1px solid var(--control-border);
}

.btn-secondary:hover {
  background: var(--control-hover-bg);
}

.btn-ghost {
  background: var(--control-bg);
  color: var(--clr-text-muted);
  border: 1px solid var(--control-border);
}

.btn-ghost:hover {
  background: var(--control-hover-bg);
  color: var(--clr-text);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--clr-danger));
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #059669, var(--clr-success));
  color: white;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

.btn-icon-sm {
  padding: 5px;
  border-radius: var(--radius-sm);
}

.btn-round {
  border-radius: var(--radius-full);
}

.btn-full {
  width: 100%;
}

/* ─── Form Elements ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-text-muted);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  font-family: var(--font-arabic);
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: all var(--transition-fast);
  outline: none;
  direction: rtl;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: var(--input-bg);
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--clr-text-dim);
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

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

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--input-hover-border);
}

.form-input:disabled,
.form-input[readonly],
.form-select:disabled,
.form-textarea:disabled,
.form-textarea[readonly] {
  background: var(--input-disabled-bg);
  color: var(--clr-text-muted);
  cursor: not-allowed;
}

html.light .form-input,
html.light .form-select,
html.light .form-textarea {
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

html.light .form-input::placeholder,
html.light .form-textarea::placeholder {
  color: #94a3b8;
}

html.light .form-select,
html.light input[type="date"],
html.light input[type="time"],
html.light input[type="number"] {
  color-scheme: light;
}

/* ─── Checkbox ─── */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.08);
}

.checkbox-wrap:hover .checkbox-custom {
  background: rgba(255, 255, 255, 0.15);
}

.checkbox-wrap input:checked~.checkbox-custom {
  background: var(--clr-primary);
}

.checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition-bounce);
}

.checkbox-wrap input:checked~.checkbox-custom::after {
  opacity: 1;
  transform: scale(1);
}

[hidden] {
  display: none !important;
}

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--clr-surface-2);
  border: var(--border-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-bounce);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: none;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-start;
  padding: var(--space-4) var(--space-6) var(--space-6);
  border-top: none;
}

/* ─── Toast Notifications ─── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  background: var(--clr-surface-3);
  border: var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  pointer-events: all;
  animation: slideInLeft 0.3s ease forwards;
  max-width: 320px;
}

.toast.success {
  box-shadow: var(--shadow-lg), 0 0 12px rgba(52, 211, 153, 0.2);
}

.toast.error {
  box-shadow: var(--shadow-lg), 0 0 12px rgba(248, 113, 113, 0.2);
}

.toast.info {
  box-shadow: var(--shadow-lg), 0 0 12px rgba(81, 69, 220, 0.2);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(-20px);
  }
}

/* ─── Task Card ─── */
.task-card {
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.task-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.task-card.drag-over {
  border-color: var(--clr-primary);
  background: var(--clr-primary-subtle);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.task-complete-btn {
  width: 22px;
  height: 22px;
  border-radius: 35%;
  border: none;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.08);
  margin-top: 1px;
}

.task-complete-btn:hover {
  background: rgba(52, 211, 153, 0.2);
}

.task-complete-btn.done {
  background: var(--clr-success);
}

.task-complete-btn.done::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  line-height: 1.4;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--clr-text-muted);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.task-due {
  font-size: 11px;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.task-due.overdue {
  color: var(--clr-danger);
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-high .priority-dot {
  background: var(--clr-priority-high);
  box-shadow: 0 0 6px var(--clr-priority-high);
}

.priority-med .priority-dot {
  background: var(--clr-priority-med);
  box-shadow: 0 0 6px var(--clr-priority-med);
}

.priority-low .priority-dot {
  background: var(--clr-priority-low);
  box-shadow: 0 0 6px var(--clr-priority-low);
}

/* ─── Kanban Board ─── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.kanban-column {
  background: rgba(255, 255, 255, 0.02);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-height: 200px;
}

.kanban-column.drag-target {
  background: var(--clr-primary-subtle);
  box-shadow: 0 0 0 2px var(--clr-primary);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: none;
}

.kanban-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kanban-count {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

/* ─── Prayer Card ─── */
.prayer-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.prayer-card {
  padding: var(--space-5) var(--space-4);
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.prayer-card.prayed {
  background: rgba(52, 211, 153, 0.05);
}

.prayer-card.active-prayer {
  background: var(--clr-primary-subtle);
  box-shadow: var(--shadow-glow);
}

.prayer-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.prayer-time {
  font-size: 13px;
  color: var(--clr-text-muted);
  margin-bottom: var(--space-4);
}

.prayer-check {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all var(--transition-bounce);
  font-size: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.prayer-card.prayed .prayer-check {
  background: var(--clr-success);
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.4);
}

/* ─── Worship Tracker ─── */
.worship-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.worship-card {
  padding: var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.worship-card.done {
  background: var(--clr-primary-subtle);
}

.worship-icon {
  font-size: 32px;
  margin-bottom: var(--space-2);
  display: block;
}

.worship-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.worship-streak {
  font-size: 11px;
  color: var(--clr-text-muted);
}

/* ─── Focus Timer ─── */
.focus-ring-container {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto var(--space-8);
}

.focus-ring-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.focus-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 8;
}

.focus-ring-progress {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-slow);
  filter: drop-shadow(0 0 12px rgba(81, 69, 220, 0.5));
}

.focus-time-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.focus-countdown {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.focus-mode-label {
  font-size: 13px;
  color: var(--clr-text-muted);
  margin-top: var(--space-2);
  font-weight: 600;
}

.focus-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.focus-btn-main {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary-dark), var(--clr-primary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 6px 25px rgba(81, 69, 220, 0.5);
  transition: all var(--transition-bounce);
}

.focus-btn-main:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 30px rgba(81, 69, 220, 0.7);
}

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

.focus-btn-secondary {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.focus-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mode-selector {
  display: flex;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.04);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  border: var(--border-card);
}

.mode-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--clr-primary);
  color: white;
  box-shadow: 0 2px 10px rgba(81, 69, 220, 0.4);
}

/* ─── Sound Board ─── */
.sound-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.sound-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-card);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
  color: var(--clr-text-muted);
  font-weight: 500;
}

.sound-btn.active {
  background: var(--clr-primary-subtle);
  color: var(--clr-primary-light);
}

.sound-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--clr-text);
}

.sound-btn.active:hover {
  background: var(--clr-primary-subtle);
}

.sound-icon {
  font-size: 24px;
}

/* ─── Habit Heatmap ─── */
.heatmap-grid {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.heatmap-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  transition: transform var(--transition-fast);
  cursor: default;
}

.heatmap-cell:hover {
  transform: scale(1.3);
}

.heatmap-cell[data-level="1"] {
  background: rgba(81, 69, 220, 0.2);
}

.heatmap-cell[data-level="2"] {
  background: rgba(81, 69, 220, 0.4);
}

.heatmap-cell[data-level="3"] {
  background: rgba(81, 69, 220, 0.65);
}

.heatmap-cell[data-level="4"] {
  background: var(--clr-primary);
  box-shadow: 0 0 6px rgba(81, 69, 220, 0.5);
}

/* ─── Streak Card ─── */
.streak-display {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
}

.streak-number {
  font-size: 56px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--clr-primary-light), var(--clr-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-8);
  color: var(--clr-text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  display: block;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: 13px;
}

/* ─── Tag ─── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: var(--clr-text-muted);
  border: none;
}

/* ─── Toggle Switch ─── */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle-switch input:checked~.toggle-track {
  background: var(--clr-primary);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-bounce);
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked~.toggle-track .toggle-thumb {
  transform: translateX(-20px);
}

/* ─── Calendar Strip ─── */
.calendar-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) 0;
  scrollbar-width: none;
}

.calendar-strip::-webkit-scrollbar {
  display: none;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 54px;
  transition: all var(--transition-fast);
  border: var(--border-card);
  background: rgba(255, 255, 255, 0.02);
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.05);
}

.calendar-day.today {
  background: var(--clr-primary-subtle);
}

.calendar-day.selected {
  background: var(--clr-primary);
  color: white;
}

.cal-dow {
  font-size: 11px;
  font-weight: 500;
  color: var(--clr-text-muted);
}

.cal-date {
  font-size: 18px;
  font-weight: 700;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--clr-primary);
  opacity: 0;
}

.calendar-day.has-tasks .cal-dot {
  opacity: 1;
}

/* ─── Filter Bar ─── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.03);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 160px;
  background: none;
  border: none;
  outline: none;
  color: var(--clr-text);
  font-size: 14px;
  font-family: var(--font-arabic);
}

.filter-search::placeholder {
  color: var(--clr-text-dim);
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.chip {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.04);
  color: var(--clr-text-muted);
}

.chip.active,
.chip:hover {
  background: var(--clr-primary-subtle);
  color: var(--clr-primary-light);
}

/* ─── Hijri Date Badge ─── */
.hijri-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, rgba(81, 69, 220, 0.1), rgba(67, 56, 202, 0.05));
  border: none;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
}

/* ─── Notification Dot ─── */
.notif-dot {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 8px;
  height: 8px;
  background: var(--clr-danger);
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 0 2px var(--clr-bg);
}

/* ─── Range Slider ─── */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--clr-primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(81, 69, 220, 0.5);
}

/* ─── Canvas Charts ─── */
.chart-container {
  position: relative;
  width: 100%;
}