/* Large screens (1200px and up) */
@media (min-width: 1200px) {
  .app-container {
    grid-template-columns: 280px 1fr;
  }

  .tasks-container {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  }
}

/* Medium screens (768px to 1199px) */
@media (max-width: 1199px) {
  .app-container {
    grid-template-columns: 250px 1fr;
  }

  .tasks-container {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* Tablet and small desktops (768px to 991px) */
@media (max-width: 991px) {
  .app-container {
    grid-template-columns: 220px 1fr;
  }

  .sidebar-header h1 {
    font-size: 1.2rem;
  }

  .task-item {
    padding: 1.2rem;
  }
}

/* Mobile devices (less than 768px) */
@media (max-width: 767px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    width: 85%;
    height: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
  }

  .sidebar.active {
    transform: translateX(100%);
  }

  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-overlay.active {
    display: block;
    opacity: 1;
  }

  .mobile-toggle {
    display: flex;
    position: fixed;
    left: 1rem;
    top: 1rem;
    z-index: 1001;
    padding: 0.8rem;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }

  .main-content {
    padding: 1rem;
    padding-top: 4rem;
  }

  .toolbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .search-container {
    width: 100%;
    margin: 0;
  }

  .view-controls {
    width: 100%;
    justify-content: space-between;
  }

  .tasks-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .task-item {
    margin-bottom: 1rem;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
    margin: 1rem;
  }

  .datetime-container {
    flex-direction: column;
    gap: 1rem;
  }

  .time-range {
    flex-direction: column;
  }

  .add-task-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.8rem 1.5rem;
  }
}

/* Small mobile devices (less than 480px) */
@media (max-width: 479px) {
  .task-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-actions {
    position: relative;
    opacity: 1;
    transform: none;
    margin-top: 1rem;
    justify-content: flex-end;
  }

  .modal-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }

  .modal-buttons button {
    width: 100%;
  }

  .notification {
    width: 90%;
    margin: 0 auto;
    left: 0;
    right: 0;
  }
}

/* Height-based media queries */
@media (max-height: 600px) {
  .sidebar {
    padding: 1rem;
  }

  .lists-container {
    margin: 0.5rem 0;
  }

  .list-item {
    padding: 0.6rem 0.8rem;
    margin: 0.3rem 0;
  }
}

/* Landscape orientation for mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .modal-content {
    height: 90vh;
    overflow-y: auto;
  }

  .sidebar {
    padding-bottom: 4rem;
    overflow-y: auto;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .toolbar,
  .add-task-btn,
  .task-actions {
    display: none !important;
  }

  .app-container {
    grid-template-columns: 1fr;
  }

  .task-item {
    break-inside: avoid;
    border: 1px solid #ddd;
  }
}
