/* Added styles for progress bar colors */
.progress-bar-low {
  background-color: #f44336; /* Red for low completion */
}

.progress-bar-medium {
  background-color: #FFD54F; /* Yellow for medium completion */
}

.progress-bar-high {
  background-color: #66BB6A; /* Green for high completion */
}

/* Dark mode progress bar colors */
body.dark-mode .progress-bar-low {
  background-color: #d32f2f;
}

body.dark-mode .progress-bar-medium {
  background-color: #FBC02D;
}

body.dark-mode .progress-bar-high {
  background-color: #388E3C;
}

/* Rest of the CSS remains unchanged */
/* Added styles for modals and calendar */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal.active {
  display: block;
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

body.dark-mode .modal-content {
  background-color: #2d2d2d;
  color: #f0f0f0;
}

.close {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 24px;
  cursor: pointer;
}

.calendar-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 15px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-day {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  min-height: 80px;
}

.calendar-day:hover {
  background-color: #f0f0f0;
}

body.dark-mode .calendar-day:hover {
  background-color: #3a3a3a;
}

.completion-high {
  background-color: #e0f7fa;
}

.completion-medium {
  background-color: #fff9c4;
}

.completion-low {
  background-color: #ffebee;
}

body.dark-mode .completion-high {
  background-color: #004d40;
}

body.dark-mode .completion-medium {
  background-color: #FFD54F; /* Improved yellow shade */
  color: #000; /* Better text contrast */
}

body.dark-mode .completion-low {
  background-color: #4a0000;
}

.day-number {
  font-weight: bold;
  margin-bottom: 5px;
}

.day-stats {
  font-size: 0.8em;
}

.day-details {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

/* Recurring tasks styles */
.recurring-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.recurring-form input,
.recurring-form select,
.recurring-form button {
  padding: 10px;
}

.add-recurring-button, .update-recurring-button {
  grid-column: span 2;
  color: white;
  border: none;
}

.add-recurring-button {
  background-color: #4CAF50;
}

.update-recurring-button {
  background-color: #2196F3;
}

.days-of-week {
  grid-column: span 2;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
}

.recurring-tasks-list {
  margin-top: 20px;
}

.recurring-task-item {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recurring-task-actions button {
  margin-left: 5px;
  padding: 5px 10px;
}

/* Dark mode editing background */
body.dark-mode .task-card.editing {
  background-color: #1a2e1a;
  color: #f0f0f0;
  border-left: 4px solid #3e834d;
}

/* Progress bar styles */
.progress-container {
  width: 100%;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 5px;
}

.progress-bar {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* Dark mode progress bar */
body.dark-mode .progress-container {
  background-color: #3a3a3a;
}

/* Rest of existing CSS remains the same */
body {
  font-family: Arial;
  margin: 20px;
  padding: 10px;
  box-sizing: border-box;
  background-color: white;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background-color: #121212;
  color: #f0f0f0;
}

body.dark-mode .task-card {
  background-color: #1e1e1e;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  border-left: 4px solid #64B5F6;
}

body.dark-mode .stats-table th {
  background-color: #1976D2;
}

body.dark-mode .stats-table td {
  background-color: #2d2d2d;
  color: #f0f0f0;
}

body.dark-mode .points-table th {
  background-color: #388E3C;
}

body.dark-mode .points-table td {
  background-color: #2d2d2d;
  color: #f0f0f0;
}

/* Table border colors for dark mode */
body.dark-mode .stats-table th,
body.dark-mode .stats-table td,
body.dark-mode .points-table th,
body.dark-mode .points-table td {
  border-color: #444;
}

body.dark-mode input,
body.dark-mode select {
  background-color: #2d2d2d;
  color: #f0f0f0;
  border: 1px solid #444;
}

/* Touch-friendly improvements */
button, 
input, 
select {
  min-height: 44px; /* Minimum touch target size */
}

.task-card {
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

button {
  cursor: pointer;
  color: white;
  border: none;
  font-size: 15px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

.mode-toggle-button, .view-deleted-tasks-button,
.view-done-tasks-button, .countdown-toggle-button,
.track-progess-button, .access-recurring-tasks-button{
  width: 30px;
  padding: 0;
  margin: 2px;
}
.mode-toggle-icon, .view-deleted-tasks-icon,
.view-done-tasks-icon, .countdown-toggle-icon,
.track-progess-icon, .access-recurring-tasks-icon{
  width: 100%;
  margin: 0;
}

.nav-button, .add-todo-button {
  background-color: #4CAF50;
  padding: 10px 15px;
  margin-right: 10px;
}

.todo-grid, .todo-input-grid {
  display: grid;
  row-gap: 10px;
  align-items: center;
}

.todo-input-grid {
  margin-bottom: 20px;
  grid-template-columns: 200px 150px 100px 100px 100px;
  column-gap: 10px;
}

.todo-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.due-date-input, .name-input, .due-time-input, .complexity-input {
  font-size: 15px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.add-todo-button {
  background-color: green;
  padding: 12px;
}

.delete-todo-button, .delete-recurring-button, .permanent-delete-button {
  background-color: darkred;
  padding: 10px;
}

.edit-todo-button, .edit-recurring-button {
  background-color: #2196F3;
  padding: 10px;
}

.done-todo-button {
  background-color: limegreen;
  padding: 10px;
}

.restore-todo-button {
  background-color: #FF9800;
  padding: 10px;
}

.task-card {
  background-color: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  border-left: 4px solid #2196F3;
}

.task-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.task-card.editing {
  border-left-color: #4CAF50;
  background-color: #f0f9ff;
}

.current-score, .daily-score {
  margin: 0;
  font-weight: bold;
}

.title-and-score-data{
  display: grid;
  grid-template-columns: 300px 200px 1fr ;
  justify-content: space-between;
}

.today-list-title {
  grid-column: 1;
  margin: 0;
  color: #2c3e50;
  white-space: nowrap;
}

body.dark-mode .today-list-title {
  color: #f0f0f0;
}

.count-down-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.countdown-display {
  display: inline-block;
  flex-direction: column;
  align-items: center;
}

.count-down {
  margin: 0;
  font-size: 2.5rem;
  justify-content: center;
}

.countdown-toggle {
  background-color: #2196F3;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
}

.hidden {
  display: none;
}

/* Stats Tables */
.stats-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 15px;
}

.stats-table, .points-table {
  border-collapse: collapse;
  min-width: 280px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-radius: 8px;
  overflow: hidden;
}

.stats-table th, 
.stats-table td, 
.points-table th, 
.points-table td {
  padding: 12px 15px;
  text-align: center;
  border: 1px solid #eee;
}

.stats-table th {
  background-color: #3498db;
  color: white;
  font-weight: bold;
}

.stats-table td {
  font-size: 1.1em;
  background: white;
}

.stats-table td, .points-table td {
  font-weight: bold;
  color: #2c3e50;
}

.points-table th {
  text-align: right;
  background-color: #2ecc71;
  color: white;
  border-right: none;
}

.points-table td {
  text-align: left;
  border-left: none;
  background: white;
}

/* Mobile-specific task card layout */
.task-card.mobile-view div:last-child {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card.mobile-view button {
  width: 100%;
  margin: 2px 0;
}

/* Improved Mobile Responsiveness */
@media (max-width: 1024px) {
  .title-and-score-data {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  
  .today-list-title,
  .count-down-container,
  .stats-container {
    grid-column: 1;
    justify-content: center;
  }
  
  .stats-container {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .title-and-score-data {
    grid-template-columns: 1fr;
    gap: 15px;
    text-align: center;
  }
  
  .today-list-title {
    grid-column: 1;
    font-size: 1.5rem;
    margin-bottom: 10px;
  }
  
  .stats-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .stats-table, .points-table {
    width: 100%;
    font-size: 0.9rem;
  }
  
  .stats-table th, 
  .stats-table td, 
  .points-table th, 
  .points-table td {
    padding: 8px 10px;
  }
  
  /* Button grid for mobile */
  .today-list-title + div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin: 10px 0;
    justify-content: center;
  }
  
  .today-list-title + div button {
    width: 100%;
    padding: 8px;
    min-height: 40px;
  }
  
  .todo-input-grid {
    grid-template-columns: 1fr 1fr;
    row-gap: 15px;
  }
  
  .todo-input-grid .name-input {
    grid-column: 1 / 3;
  }
  
  .todo-input-grid .js-add-todo-button {
    grid-column: 1 / 3;
    padding: 12px;
  }

  .stats-container {
    flex-direction: column;
  }

  .stats-table, .points-table {
    width: 100%;
  }
  
  /* Modal improvements for mobile */
  .modal-content {
    margin: 10% auto;
    width: 95%;
    padding: 15px;
    max-height: 85vh;
  }
  
  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }
  
  .calendar-day {
    padding: 5px;
    min-height: 60px;
    font-size: 0.8rem;
  }
  
  .recurring-form {
    grid-template-columns: 1fr;
  }
  
  .add-recurring-button, 
  .update-recurring-button {
    grid-column: 1;
  }
  
  .days-of-week {
    grid-column: 1;
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .days-of-week label {
    flex: 1 0 25%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  body {
    margin: 10px;
    padding: 5px;
  }
  
  /* Prevent zoom on input focus for iOS */
  input, select, textarea {
    font-size: 16px;
  }
  
  .due-date-input, .due-time-input {
    min-height: 44px;
  }
  
  .todo-input-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .todo-input-grid .name-input,
  .todo-input-grid .js-add-todo-button {
    grid-column: 1;
  }
  
  .todo-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .task-card {
    padding: 12px;
    margin: 5px 0;
  }
  
  .task-card button {
    width: 100%;
    margin: 2px 0;
    padding: 10px;
    font-size: 14px;
  }
  
  /* Stack buttons vertically in task cards */
  .task-card div:last-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  
  .count-down {
    font-size: 1.8rem;
  }
  
  .task-card {
    padding: 12px;
  }
  
  button {
    font-size: 14px;
    padding: 8px 10px;
  }
  
  /* Hide less important elements on very small screens */
  .stats-table th:nth-child(4),
  .stats-table td:nth-child(4) {
    display: none;
  }
}

/* Very small screens (under 360px) */
@media (max-width: 360px) {
  body {
    margin: 5px;
    padding: 5px;
  }
  
  .today-list-title {
    font-size: 1.3rem;
  }
  
  .stats-table th, 
  .stats-table td {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .points-table {
    font-size: 0.8rem;
  }
  
  /* Simplify stats table further */
  .stats-table th:nth-child(3),
  .stats-table td:nth-child(3) {
    display: none;
  }
  
  .calendar-day {
    min-height: 50px;
    font-size: 0.7rem;
  }
  
  .day-stats {
    font-size: 0.7rem;
  }
  
  .today-list-title + div {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .todo-input-grid {
    grid-template-columns: 1fr;
  }
}
