/* ===== AZM - عزم Time Manager ===== */
:root {
  --primary: #C41E3A;
  --primary-hover: #E0243F;
  --primary-dark: #9B1830;
  --bg-dark: #0D0D0D;
  --bg-card: #1A1A1A;
  --bg-card-hover: #222222;
  --bg-sidebar: #111111;
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0B0;
  --text-muted: #777777;
  --border: #2A2A2A;
  --success: #2E7D32;
  --danger: #D32F2F;
  --warning: #F9A825;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --transition: all 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-text .ar {
  font-size: 22px;
  font-weight: 800;
  color: white;
}

.logo-text .en {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 2px;
}

.nav-menu {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: var(--transition);
}

.nav-item i {
  width: 22px;
  text-align: center;
  font-size: 18px;
}

.nav-item:hover {
  background: var(--bg-card);
  color: white;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(196, 30, 58, 0.2), transparent);
  color: var(--primary);
  border-right: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.next-prayer-mini {
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.next-prayer-mini i {
  color: var(--primary);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-right: 260px;
  padding: 20px 28px 40px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.menu-toggle {
  display: none;
  background: var(--bg-card);
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
}

.current-time {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

.user-greeting {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ===== Sections ===== */
.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 28px;
}

.section-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: #333;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header i {
  color: var(--primary);
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.prayer-card {
  background: linear-gradient(145deg, #1A1A1A, #1F1215);
  border: 1px solid rgba(196, 30, 58, 0.3);
}

.prayer-info {
  text-align: center;
  padding: 10px 0;
}

.prayer-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.prayer-time {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
}

.countdown {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(196, 30, 58, 0.15);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.tasks-icon { background: rgba(46, 125, 50, 0.2); color: #66BB6A; }
.notes-icon { background: rgba(249, 168, 37, 0.2); color: #FFCA28; }
.progress-icon { background: rgba(196, 30, 58, 0.2); color: var(--primary); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tasks-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-dark);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.task-preview-item.done {
  opacity: 0.6;
}

.task-preview-item .cat {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(196, 30, 58, 0.2);
  color: var(--primary);
}

.quick-actions {
  display: flex;
  gap: 14px;
  margin-top: 24px;
}

/* ===== Buttons ===== */
.btn-primary, .btn-secondary, .btn-danger, .btn-sm {
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 12px 22px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: white;
  border: 1px solid var(--border);
  padding: 12px 22px;
}

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

.btn-danger {
  background: rgba(211, 47, 47, 0.15);
  color: #EF5350;
  border: 1px solid rgba(211, 47, 47, 0.3);
  padding: 10px 18px;
}

.btn-danger:hover {
  background: rgba(211, 47, 47, 0.25);
}

.btn-sm {
  background: transparent;
  color: var(--primary);
  padding: 6px 12px;
  font-size: 13px;
}

.btn-sm:hover {
  background: rgba(196, 30, 58, 0.1);
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* ===== Tasks ===== */
.tasks-controls {
  margin-bottom: 24px;
}

.add-task-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.add-task-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  color: white;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.add-task-form input[type="text"]:focus,
.add-task-form select:focus,
.add-task-form input[type="time"]:focus {
  border-color: var(--primary);
}

.add-task-form select,
.add-task-form input[type="time"] {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  color: white;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  outline: none;
}

.add-task-form select option {
  background: #1A1A1A;
}

.filter-tabs {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 20px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.task-item:hover {
  border-color: #333;
}

.task-item.done {
  opacity: 0.55;
}

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

.task-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.task-item.done .task-check {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.task-text {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.task-cat {
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

.cat-study { background: rgba(33, 150, 243, 0.2); color: #42A5F5; }
.cat-university { background: rgba(156, 39, 176, 0.2); color: #AB47BC; }
.cat-work { background: rgba(255, 152, 0, 0.2); color: #FFA726; }
.cat-prayer { background: rgba(76, 175, 80, 0.2); color: #66BB6A; }
.cat-personal { background: rgba(233, 30, 99, 0.2); color: #EC407A; }
.cat-other { background: rgba(158, 158, 158, 0.2); color: #BDBDBD; }

.task-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 6px;
  transition: var(--transition);
}

.task-delete:hover {
  color: #EF5350;
}

/* ===== Notes ===== */
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  min-height: 520px;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
}

.note-item {
  background: var(--bg-card);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.note-item:hover, .note-item.active {
  border-color: var(--primary);
  background: rgba(196, 30, 58, 0.08);
}

.note-item h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item p {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-editor {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-title-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  padding: 10px 4px;
  font-size: 22px;
  font-weight: 700;
  color: white;
  font-family: 'Cairo', sans-serif;
  outline: none;
}

.note-title-input:focus {
  border-color: var(--primary);
}

.note-content-input {
  flex: 1;
  min-height: 280px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  color: white;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.note-content-input:focus {
  border-color: var(--primary);
}

.note-actions {
  display: flex;
  gap: 12px;
}

/* ===== Prayers ===== */
.prayer-location {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 15px;
  color: var(--text-secondary);
}

.prayer-location i {
  color: var(--primary);
}

.prayers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.prayer-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.prayer-item.next {
  border-color: var(--primary);
  background: linear-gradient(145deg, #1A1A1A, #1F1215);
  box-shadow: 0 0 20px rgba(196, 30, 58, 0.15);
}

.prayer-item .name {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prayer-item .time {
  font-size: 22px;
  font-weight: 700;
}

.prayer-item.next .name {
  color: var(--primary);
  font-weight: 700;
}

.method-card select {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: white;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  margin-top: 10px;
  outline: none;
}

.method-card select:focus {
  border-color: var(--primary);
}

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.settings-grid .card h3 {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.settings-grid .card h3 i {
  color: var(--primary);
}

.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  cursor: pointer;
}

.switch-label input {
  display: none;
}

.slider {
  width: 46px;
  height: 26px;
  background: #333;
  border-radius: 20px;
  position: relative;
  transition: var(--transition);
}

.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 3px;
  right: 3px;
  transition: var(--transition);
}

.switch-label input:checked + .slider {
  background: var(--primary);
}

.switch-label input:checked + .slider::before {
  transform: translateX(-20px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-family: 'Cairo', sans-serif;
}

.hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.settings-grid .card button {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: white;
  padding: 14px 28px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: all 0.35s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .prayer-card {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0;
  }
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .notes-layout {
    grid-template-columns: 1fr;
  }
  .notes-list {
    max-height: 200px;
  }
}

@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .prayer-card {
    grid-column: span 1;
  }
  .add-task-form {
    flex-direction: column;
  }
  .main-content {
    padding: 16px;
  }
  .current-time {
    font-size: 22px;
  }
}
