/* ─── صفحة العادات اليومية ─── */

.habits-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.habits-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.habits-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ─── بطاقة العادة ─── */
.habit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.habit-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
}
.habit-card.disabled {
  opacity: 0.45;
}

.habit-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.habit-info {
  flex: 1;
  min-width: 0;
}
.habit-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.habit-schedule {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.habit-schedule-tag {
  background: rgba(124, 106, 239, 0.12);
  color: var(--purple);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.habit-time-preview {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.habit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.habit-edit-btn,
.habit-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  color: var(--text-muted);
}
.habit-edit-btn:hover {
  background: rgba(124, 106, 239, 0.15);
  color: var(--purple);
}
.habit-delete-btn:hover {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

/* ─── مفتاح التفعيل ─── */
.habit-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.habit-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.habit-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: 0.25s;
}
.habit-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  right: 3px;
  bottom: 3px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: 0.25s;
}
.habit-toggle input:checked + .habit-toggle-slider {
  background: var(--success);
}
.habit-toggle input:checked + .habit-toggle-slider::before {
  transform: translateX(-20px);
  background: #fff;
}

/* ─── زر إضافة عادة ─── */
.habit-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: rgba(124, 106, 239, 0.08);
  border: 1px dashed rgba(124, 106, 239, 0.25);
  border-radius: var(--radius-sm);
  color: var(--purple);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.habit-add-btn:hover {
  background: rgba(124, 106, 239, 0.15);
  border-color: rgba(124, 106, 239, 0.4);
}

/* ─── نافذة إضافة/تعديل عادة ─── */
.habit-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.habit-form-overlay.active {
  display: flex;
}

.habit-form-modal {
  background: linear-gradient(145deg, #1a1f3d, #141830);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.hf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hf-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hf-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hf-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hf-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  direction: rtl;
}
.hf-input:focus {
  border-color: rgba(124, 106, 239, 0.4);
}
.hf-input::placeholder {
  color: var(--text-muted);
}

/* ─── أزرار اختيار نوع الجدولة ─── */
.hf-schedule-types {
  display: flex;
  gap: 6px;
}
.hf-type-btn {
  flex: 1;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.4;
}
.hf-type-btn:hover {
  background: rgba(124, 106, 239, 0.08);
  border-color: rgba(124, 106, 239, 0.2);
}
.hf-type-btn.active {
  background: rgba(124, 106, 239, 0.15);
  border-color: rgba(124, 106, 239, 0.4);
  color: var(--purple);
}

/* ─── حقول الصلاة ─── */
.hf-prayer-row {
  display: flex;
  gap: 10px;
}
.hf-prayer-row .hf-field {
  flex: 1;
}

.hf-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.hf-select:focus {
  border-color: rgba(124, 106, 239, 0.4);
}
.hf-select option {
  background: #1a1f3d;
  color: var(--text-primary);
}

/* ─── حقول الوقت ─── */
.hf-time-row {
  display: flex;
  gap: 10px;
}
.hf-time-row .hf-field {
  flex: 1;
}

/* ─── الإزاحة ─── */
.hf-offset-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hf-offset-input {
  width: 70px;
  text-align: center;
}
.hf-offset-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── معاينة الوقت المحسوب ─── */
.hf-preview {
  padding: 12px;
  background: rgba(124, 106, 239, 0.06);
  border: 1px solid rgba(124, 106, 239, 0.15);
  border-radius: 8px;
  text-align: center;
}
.hf-preview-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.hf-preview-time {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--purple);
  direction: ltr;
}

/* ─── أنشطة مسبقة (مُعاد استخدامها) ─── */
.hf-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hf-preset {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.hf-preset:hover {
  background: rgba(255, 255, 255, 0.1);
}
.hf-preset.selected {
  border-color: rgba(124, 106, 239, 0.4);
  background: rgba(124, 106, 239, 0.12);
  color: var(--purple);
}

/* ─── أزرار الحفظ والحذف ─── */
.hf-save-btn {
  width: 100%;
  padding: 12px;
  background: var(--purple);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.hf-save-btn:hover {
  background: #6a5ad4;
}

.hf-delete-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 8px;
  color: var(--danger);
  font-family: 'Cairo', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: none;
}
.hf-delete-btn:hover {
  background: rgba(255, 107, 107, 0.2);
}

/* ─── ملاحظة ─── */
.hf-note {
  resize: none;
  min-height: 50px;
}

/* ─── قسم مخفي ─── */
.hf-section-hidden {
  display: none;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .hf-schedule-types {
    flex-direction: column;
  }
  .hf-prayer-row,
  .hf-time-row {
    flex-direction: column;
  }
  .habit-card {
    padding: 12px;
    gap: 10px;
  }
  .habit-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
}
