/* ══ TASKS PAGE LAYOUT ══════════════════════════════════ */
.tasks-container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top, 2rem)) max(2rem, env(safe-area-inset-right, 2rem)) max(2rem, env(safe-area-inset-bottom, 2rem)) max(2rem, env(safe-area-inset-left, 2rem));
}

/* ══ TOP BAR ════════════════════════════════════════════ */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  /* Mirrors the theme-toggle on the right edge: fixed position, same
     vertical center so the two controls sit on a clean axis. */
  position: fixed;
  top: 30px;
  left: 20px;
  z-index: 100;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 8px 16px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s;
}

.back-btn:hover {
  border-color: var(--accent-from);
  background: var(--surface-2);
}

/* Mobile: tighter position + smaller — keeps the button aligned with
   the theme-toggle on the right at the same vertical level. */
@media (max-width: 600px) {
  .back-btn {
    top: 30px;
    left: 12px;
    padding: 0.5rem 0.75rem;
    font-size: 12px;
  }
}

.clock-section {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--accent-grad);
  padding: 12px 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 16px rgba(15, 130, 190, 0.25);
}

.live-clock {
  font-size: 24px;
  font-weight: 700;
  direction: ltr;
}

.date-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 13px;
}

.day-name {
  font-weight: 600;
}

.date-full {
  opacity: 0.9;
  font-size: 12px;
}

/* ══ MAIN CONTENT: SIDE BY SIDE ════════════════════════ */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ══ TASKS SECTION (RIGHT) ══════════════════════════════ */
.tasks-section {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  height: 100%;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.tasks-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-grad);
}

.section-header h1 {
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.section-header .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: white;
  font-size: 20px;
}

.section-header .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 1.5rem;
}

/* ══ ARCHIVE SECTION (LEFT) ═════════════════════════════ */
.archive-section {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  height: 100%;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.archive-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-grad);
}

.archive-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-top: 1rem;
  background: var(--accent-light);
  border: 1.5px solid var(--accent-from);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.archive-toggle:hover {
  background: var(--accent-grad);
  color: white;
}

.archive-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--accent-grad);
  color: white;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.archive-count-badge:empty {
  display: none;
}

.chevron {
  margin-inline-start: auto;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.chevron.open {
  transform: rotate(180deg);
}

.archive-body {
  margin-top: 1rem;
  max-height: 600px;
  overflow-y: auto;
}

/* ══ RESPONSIVE ═════════════════════════════════════════ */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .archive-section {
    order: 2;
  }
  
  .tasks-section {
    order: 1;
  }
}

@media (max-width: 640px) {
  /* Container — much less side padding on small screens so cards use the full width */
  .tasks-container {
    padding: 1rem 12px;
  }
  /* Top bar (legacy — kept defensive in case used elsewhere) */
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .clock-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .date-info {
    align-items: center;
  }
}
