// =============================================================================
// Todo App Styles
// =============================================================================

// -----------------------------------------------------------------------------
// Container
// -----------------------------------------------------------------------------

.todo-container {
  display: flex;
  height: calc(100vh - 200px);
  min-height: 500px;
  background: var(--surface-color);
  border-radius: var(--bs-border-radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

// -----------------------------------------------------------------------------
// Sidebar
// -----------------------------------------------------------------------------

.todo-sidebar {
  width: 260px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.todo-sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

// -----------------------------------------------------------------------------
// Navigation
// -----------------------------------------------------------------------------

.todo-nav {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.todo-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: var(--default-color);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;

  i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    color: var(--muted-color);
  }

  span:first-of-type {
    flex: 1;
  }

  &:hover {
    background: var(--background-color);
  }

  &.active {
    background: color-mix(in srgb, var(--accent-color), transparent 92%);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 500;

    i {
      color: var(--accent-color);
    }
  }
}

.todo-nav-count {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  background: var(--background-color);
  color: var(--muted-color);
}

// -----------------------------------------------------------------------------
// Projects
// -----------------------------------------------------------------------------

.todo-projects {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.todo-projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;

  span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

.todo-projects-add {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: var(--background-color);
    color: var(--default-color);
  }
}

.todo-projects-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-project-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--default-color);
  cursor: pointer;
  border-radius: var(--bs-border-radius);
  margin: 0 -0.5rem;

  span:nth-child(2) {
    flex: 1;
  }

  &:hover {
    background: var(--background-color);
  }

  &.active {
    background: color-mix(in srgb, var(--accent-color), transparent 92%);
    color: var(--accent-color);
    font-weight: 500;
  }
}

.todo-project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

// -----------------------------------------------------------------------------
// Tags
// -----------------------------------------------------------------------------

.todo-tags {
  padding: 1rem 1.25rem;
}

.todo-tags-header {
  margin-bottom: 0.75rem;

  span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

.todo-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.todo-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 10px;
  background: var(--background-color);
  color: var(--muted-color);
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: color-mix(in srgb, var(--accent-color), transparent 90%);
    color: var(--accent-color);
  }
}

// -----------------------------------------------------------------------------
// Main Area
// -----------------------------------------------------------------------------

.todo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

// -----------------------------------------------------------------------------
// Header
// -----------------------------------------------------------------------------

.todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.todo-header-title {
  h5 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--heading-color);
    margin: 0;
  }
}

.todo-header-count {
  font-size: 0.8125rem;
  color: var(--muted-color);
}

.todo-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.todo-search {
  position: relative;
  width: 200px;

  .form-control {
    padding-left: 2.25rem;
    background: var(--background-color);
    border-color: transparent;
    font-size: 0.875rem;

    &:focus {
      background: var(--surface-color);
      border-color: var(--border-color);
    }
  }
}

.todo-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-color);
  font-size: 0.875rem;
}

.todo-filter-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius);
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--muted-color);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: var(--background-color);
    color: var(--default-color);
  }
}

.todo-view-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--bs-border-radius);
  overflow: hidden;
}

.todo-view-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface-color);
  color: var(--muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;

  &:not(:last-child) {
    border-right: 1px solid var(--border-color);
  }

  &:hover {
    background: var(--background-color);
    color: var(--default-color);
  }

  &.active {
    background: var(--accent-color);
    color: var(--contrast-color);
  }
}

// -----------------------------------------------------------------------------
// Todo List
// -----------------------------------------------------------------------------

.todo-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
  }
}

// -----------------------------------------------------------------------------
// Section
// -----------------------------------------------------------------------------

.todo-section {
  margin-bottom: 1rem;
}

.todo-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  position: sticky;
  top: 0;
  background: var(--surface-color);
  z-index: 1;

  h6 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--heading-color);
    margin: 0;
    flex: 1;
  }
}

.todo-section-toggle {
  width: 24px;
  height: 24px;
  border-radius: var(--bs-border-radius);
  border: none;
  background: none;
  color: var(--muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: var(--background-color);
    color: var(--default-color);
  }
}

.todo-section-count {
  font-size: 0.75rem;
  color: var(--muted-color);
  background: var(--background-color);
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.todo-section-content {
  padding: 0.25rem 0;
}

// -----------------------------------------------------------------------------
// Todo Item
// -----------------------------------------------------------------------------

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
  border-left: 3px solid transparent;

  &:hover {
    background: var(--background-color);
  }

  &.selected {
    background: color-mix(in srgb, var(--accent-color), transparent 95%);
    border-left-color: var(--accent-color);
  }

  &.completed {
    .todo-item-title {
      text-decoration: line-through;
      color: var(--muted-color);
    }

    .todo-item-content {
      opacity: 0.7;
    }
  }
}

.todo-item-check {
  padding-top: 0.125rem;

  .todo-checkbox {
    display: none;

    + label {
      display: block;
      width: 20px;
      height: 20px;
      border: 2px solid var(--border-color-dark);
      border-radius: 50%;
      cursor: pointer;
      transition: all 0.2s;
      position: relative;

      &:hover {
        border-color: var(--accent-color);
      }

      &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0);
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--accent-color);
        transition: transform 0.2s;
      }
    }

    &:checked + label {
      border-color: var(--accent-color);
      background: var(--accent-color);

      &::after {
        content: '';
        width: 5px;
        height: 9px;
        border: solid var(--contrast-color);
        border-width: 0 2px 2px 0;
        border-radius: 0;
        background: transparent;
        transform: translate(-50%, -60%) rotate(45deg);
      }
    }
  }
}

.todo-item-content {
  flex: 1;
  min-width: 0;
}

.todo-item-title {
  font-size: 0.9375rem;
  color: var(--default-color);
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

.todo-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.todo-item-project {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--project-color, var(--accent-color)), transparent 85%);
  color: var(--project-color, var(--accent-color));
  font-weight: 500;
}

.todo-item-due {
  font-size: 0.75rem;
  color: var(--muted-color);
  display: flex;
  align-items: center;
  gap: 0.25rem;

  i {
    font-size: 0.6875rem;
  }
}

.todo-item-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  background: var(--background-color);
  color: var(--muted-color);
}

.todo-item-completed-date {
  font-size: 0.75rem;
  color: var(--muted-color);
}

.todo-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.todo-item-star {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted-color);
  cursor: pointer;
  font-size: 1rem;
  opacity: 0;
  transition: all 0.2s;

  &:hover {
    color: var(--warning-color);
  }

  &.starred {
    color: var(--warning-color);
    opacity: 1;
  }

  .todo-item:hover & {
    opacity: 1;
  }
}

.todo-item-priority {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;

  &.high {
    background: var(--danger-color-light);
    color: var(--danger-color);
  }

  &.medium {
    background: var(--warning-color-light);
    color: var(--warning-color);
  }

  &.low {
    background: var(--success-color-light);
    color: var(--success-color);
  }
}

.todo-item-more {
  width: 28px;
  height: 28px;
  border-radius: var(--bs-border-radius);
  border: none;
  background: none;
  color: var(--muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;

  &:hover {
    background: var(--background-color);
    color: var(--default-color);
  }

  .todo-item:hover & {
    opacity: 1;
  }
}

// -----------------------------------------------------------------------------
// Quick Add
// -----------------------------------------------------------------------------

.todo-quick-add {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
}

.todo-quick-add-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--bs-border-radius);
  border: 1px dashed var(--border-color);
  background: none;
  color: var(--muted-color);
  font-size: 0.875rem;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color), transparent 95%);
  }
}

.todo-quick-add-form {
  .form-control {
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
  }
}

.todo-quick-add-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

// -----------------------------------------------------------------------------
// Color Picker (Project Modal)
// -----------------------------------------------------------------------------

.todo-color-picker {
  display: flex;
  gap: 0.5rem;
}

.todo-color-option {
  cursor: pointer;

  input {
    display: none;

    &:checked + span {
      transform: scale(1.1);
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color), transparent 70%);
    }
  }

  span {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: all 0.2s;

    &:hover {
      transform: scale(1.1);
    }
  }
}

// -----------------------------------------------------------------------------
// View Task Modal
// -----------------------------------------------------------------------------

.todo-view-task {
  padding: 0.5rem 0;
}

.todo-view-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.todo-view-check {
  padding-top: 0.25rem;
}

.todo-view-title-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.todo-view-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--heading-color);
  margin: 0;
  line-height: 1.4;
}

.todo-view-star {
  background: none;
  border: none;
  padding: 0.25rem;
  color: var(--muted-color);
  cursor: pointer;
  font-size: 1.25rem;
  transition: color 0.2s;

  &:hover {
    color: var(--warning-color);
  }

  &.starred {
    color: var(--warning-color);
  }
}

.todo-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  background: var(--background-color);
  border-radius: var(--bs-border-radius);
  margin-bottom: 1.5rem;
}

.todo-view-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--default-color);

  i {
    color: var(--muted-color);
  }
}

.todo-view-project {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--project-color, var(--accent-color)), transparent 85%);
  color: var(--project-color, var(--accent-color));
  font-weight: 500;
}

.todo-view-section {
  margin-bottom: 1.5rem;

  h6 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
  }

  p {
    font-size: 0.9375rem;
    color: var(--default-color);
    line-height: 1.6;
    margin: 0;
  }
}

.todo-view-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

// -----------------------------------------------------------------------------
// Subtasks
// -----------------------------------------------------------------------------

.todo-subtasks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.todo-subtask {
  display: flex;
  align-items: center;
  gap: 0.75rem;

  label {
    font-size: 0.9375rem;
    color: var(--default-color);
    cursor: pointer;
  }

  input:checked + label {
    text-decoration: line-through;
    color: var(--muted-color);
  }
}

.todo-subtask-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

// -----------------------------------------------------------------------------
// Activity
// -----------------------------------------------------------------------------

.todo-activity {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.todo-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;

  img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
  }
}

.todo-activity-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.todo-activity-text {
  font-size: 0.875rem;
  color: var(--default-color);

  strong {
    font-weight: 600;
  }
}

.todo-activity-time {
  font-size: 0.75rem;
  color: var(--muted-color);
}

// -----------------------------------------------------------------------------
// Edit Task Modal - Subtasks
// -----------------------------------------------------------------------------

.todo-edit-subtasks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.todo-edit-subtask {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  .form-control {
    flex: 1;
  }
}

.todo-edit-subtask-remove {
  width: 32px;
  height: 32px;
  border-radius: var(--bs-border-radius);
  border: none;
  background: none;
  color: var(--muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background: var(--danger-color-light);
    color: var(--danger-color);
  }
}

// -----------------------------------------------------------------------------
// Board View
// -----------------------------------------------------------------------------

.todo-list.board-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem 1.25rem;

  .todo-section {
    display: contents;
  }

  .todo-section-header {
    display: none;
  }

  .todo-section-content {
    display: contents;
    padding: 0;
  }

  .todo-item {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--bs-border-radius-lg);
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;

    &:hover {
      background: var(--surface-color);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      transform: translateY(-2px);
    }

    &.selected {
      border-color: var(--accent-color);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color), transparent 70%);
    }

    &[data-priority="high"] {
      border-left-color: var(--danger-color);
    }

    &[data-priority="medium"] {
      border-left-color: var(--warning-color);
    }

    &[data-priority="low"] {
      border-left-color: var(--success-color);
    }
  }

  .todo-item-check {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding-top: 0;
  }

  .todo-item-content {
    order: 1;
    padding-right: 2rem;
  }

  .todo-item-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    line-height: 1.4;
  }

  .todo-item-meta {
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
  }

  .todo-item-actions {
    order: 2;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    justify-content: space-between;

    .todo-item-star,
    .todo-item-more {
      opacity: 1;
    }
  }

  .todo-item-priority {
    margin-left: 0;
  }

  .todo-item {
    position: relative;
  }
}

// -----------------------------------------------------------------------------
// Sidebar Toggle Button (hidden by default, shown under 1280px)
// -----------------------------------------------------------------------------

.todo-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--background-color);
  border: none;
  border-radius: 50%;
  color: var(--muted-color);
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;

  &:hover {
    background: var(--border-color);
    color: var(--default-color);
  }
}

// -----------------------------------------------------------------------------
// Sidebar Close Button (hidden by default)
// -----------------------------------------------------------------------------

.todo-sidebar-close {
  display: none;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 44px;
  height: 44px;
  padding: 0;
  background: color-mix(in srgb, var(--default-color), transparent 95%);
  border: none;
  border-radius: var(--bs-border-radius);
  color: var(--muted-color);
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;

  &:hover {
    background: color-mix(in srgb, var(--danger-color), transparent 85%);
    color: var(--danger-color);
  }
}

// -----------------------------------------------------------------------------
// Sidebar Overlay (hidden by default)
// -----------------------------------------------------------------------------

.todo-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--default-color), transparent 50%);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;

  &.show {
    opacity: 1;
  }

  [data-theme="dark"] & {
    background: color-mix(in srgb, var(--default-color), transparent 30%);
  }
}

// -----------------------------------------------------------------------------
// Responsive - Under 1280px: Show toggle button, slide-in sidebar
// -----------------------------------------------------------------------------

@media (max-width: 1279.98px) {
  // Show the toggle button in header
  .todo-sidebar-toggle {
    display: flex;
  }

  // Show the overlay when sidebar is open
  .todo-sidebar-overlay {
    display: block;
    pointer-events: none;

    &.show {
      pointer-events: auto;
    }
  }

  // Show the close button inside sidebar
  .todo-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  // Sidebar becomes slide-in panel
  .todo-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh; // Dynamic viewport height for mobile browsers
    background: var(--surface-color);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow-y: auto; // Allow sidebar itself to scroll
    padding-top: 3.5rem; // Space for close button
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease;

    &.show {
      transform: translateX(0);
    }
  }

  // Prevent body scroll when sidebar is open
  body.todo-sidebar-open {
    overflow: hidden;
  }
}

// -----------------------------------------------------------------------------
// Responsive
// -----------------------------------------------------------------------------

@media (max-width: 991.98px) {
  .todo-search {
    width: 150px;
  }
}

@media (max-width: 767.98px) {
  .todo-container {
    min-height: calc(100vh - 180px);
  }

  .todo-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
  }

  .todo-header-title {
    flex: 1;

    h5 {
      font-size: 1rem;
    }
  }

  .todo-header-actions {
    width: 100%;
    gap: 0.5rem;
  }

  .todo-search {
    flex: 1;
    width: auto;
    min-width: 100px;

    .form-control {
      min-height: 44px;
    }
  }

  .todo-filter-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem;

    span {
      display: none;
    }
  }

  .todo-view-toggle {
    flex-shrink: 0;
  }

  .todo-view-btn {
    width: 44px;
    height: 44px;
  }

  .todo-list {
    flex: 1;
    min-height: 300px;
  }

  .todo-section-header {
    padding: 0.5rem 1rem;

    h6 {
      font-size: 0.75rem;
    }
  }

  .todo-section-toggle {
    width: 36px;
    height: 36px;
  }

  .todo-item {
    padding: 0.875rem 1rem;
    gap: 0.625rem;
  }

  .todo-item-check {
    .todo-checkbox + label {
      width: 24px;
      height: 24px;
    }
  }

  .todo-item-title {
    font-size: 0.875rem;
  }

  .todo-item-meta {
    gap: 0.375rem;
  }

  .todo-item-actions {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .todo-item-priority {
    display: none;
  }

  .todo-item-star {
    opacity: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .todo-item-more {
    opacity: 1;
    width: 44px;
    height: 44px;
  }

  .todo-quick-add {
    padding: 0.875rem 1rem;
  }

  .todo-quick-add-btn {
    min-height: 44px;
    padding: 0.875rem 1rem;
  }

  // Board view adjustments
  .todo-list.board-view {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem 1rem;

    .todo-item {
      padding: 0.875rem;
    }

    .todo-item-check {
      top: 0.875rem;
      right: 0.875rem;
    }

    .todo-item-content {
      padding-right: 2.5rem;
    }
  }
}

// -----------------------------------------------------------------------------
// Responsive - Small Phone (320px-575px)
// -----------------------------------------------------------------------------

@media (max-width: 575.98px) {
  .todo-container {
    min-height: calc(100vh - 160px);
    border-radius: var(--bs-border-radius);
  }

  .todo-header {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .todo-header-title {
    h5 {
      font-size: 0.9375rem;
    }
  }

  .todo-header-count {
    font-size: 0.75rem;
  }

  .todo-header-actions {
    gap: 0.375rem;
  }

  .todo-search {
    min-width: 0;
    flex: 1;

    .form-control {
      font-size: 0.8125rem;
      padding-left: 2rem;
    }
  }

  .todo-search-icon {
    left: 0.625rem;
    font-size: 0.8125rem;
  }

  .todo-filter-btn {
    min-width: 44px;
    padding: 0.5rem;

    i {
      font-size: 1rem;
    }

    span {
      display: none;
    }
  }

  .todo-view-btn {
    width: 40px;
    height: 40px;
  }

  .todo-list {
    padding: 0.5rem 0;
    min-height: 250px;
    max-height: calc(100vh - 340px);
  }

  .todo-section {
    margin-bottom: 0.75rem;
  }

  .todo-section-header {
    padding: 0.375rem 0.75rem;

    h6 {
      font-size: 0.6875rem;
    }
  }

  .todo-section-toggle {
    width: 32px;
    height: 32px;
  }

  .todo-section-count {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
  }

  .todo-item {
    padding: 0.75rem;
    gap: 0.5rem;
    border-left-width: 2px;
  }

  .todo-item-check {
    padding-top: 0;

    .todo-checkbox + label {
      width: 28px;
      height: 28px;

      &::after {
        width: 12px;
        height: 12px;
      }
    }

    .todo-checkbox:checked + label::after {
      width: 6px;
      height: 10px;
    }
  }

  .todo-item-title {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
  }

  .todo-item-meta {
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .todo-item-project {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
  }

  .todo-item-due {
    font-size: 0.6875rem;

    i {
      font-size: 0.625rem;
    }
  }

  .todo-item-tag {
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
  }

  .todo-item-actions {
    gap: 0.25rem;
    margin-top: 0.25rem;
  }

  .todo-item-star {
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
  }

  .todo-item-more {
    width: 40px;
    height: 40px;
  }

  .todo-quick-add {
    padding: 0.75rem;
  }

  .todo-quick-add-btn {
    padding: 0.75rem;
    font-size: 0.8125rem;
    min-height: 44px;
  }

  .todo-quick-add-form {
    .form-control {
      font-size: 0.875rem;
      min-height: 44px;
    }
  }

  .todo-quick-add-actions {
    gap: 0.375rem;

    .btn {
      min-height: 44px;
      padding: 0.5rem 1rem;
      font-size: 0.8125rem;
    }
  }

  // Board view on small screens - single column
  .todo-list.board-view {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;

    .todo-item {
      padding: 0.75rem;
      border-left-width: 3px;
    }

    .todo-item-check {
      top: 0.75rem;
      right: 0.75rem;

      .todo-checkbox + label {
        width: 24px;
        height: 24px;
      }
    }

    .todo-item-content {
      padding-right: 2rem;
    }

    .todo-item-title {
      font-size: 0.8125rem;
      margin-bottom: 0.5rem;
    }

    .todo-item-meta {
      margin-bottom: 0.5rem;
    }

    .todo-item-actions {
      padding-top: 0.5rem;
      gap: 0.375rem;

      .todo-item-star,
      .todo-item-more {
        width: 36px;
        height: 36px;
      }
    }
  }

  // View Task Modal
  .todo-view-task {
    padding: 0.25rem 0;
  }

  .todo-view-header {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .todo-view-title {
    font-size: 1.0625rem;
  }

  .todo-view-star {
    padding: 0.5rem;
    font-size: 1.125rem;
  }

  .todo-view-meta {
    gap: 0.625rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .todo-view-meta-item {
    font-size: 0.8125rem;
  }

  .todo-view-section {
    margin-bottom: 1rem;

    h6 {
      font-size: 0.6875rem;
      margin-bottom: 0.5rem;
    }

    p {
      font-size: 0.875rem;
    }
  }

  // Color picker touch targets
  .todo-color-option {
    span {
      width: 36px;
      height: 36px;
    }
  }

  // Subtasks
  .todo-subtask-check {
    width: 24px;
    height: 24px;
  }

  .todo-subtask label {
    font-size: 0.875rem;
  }

  .todo-edit-subtask-remove {
    width: 44px;
    height: 44px;
  }

  // Activity
  .todo-activity-item {
    gap: 0.5rem;

    img {
      width: 28px;
      height: 28px;
    }
  }

  .todo-activity-text {
    font-size: 0.8125rem;
  }

  .todo-activity-time {
    font-size: 0.6875rem;
  }
}
