html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  height: 100%;
  margin: 0;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Task item styles */
.task-item {
  cursor: pointer;
  transition: all 0.2s;
}

.task-item:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.task-completed {
  opacity: 0.6;
}

/* Calendar event styles */
.fc-event.event-completed {
  opacity: 0.6;
  text-decoration: line-through;
}

/* Full height calendar */
#calendar {
  height: 100%;
}

/* Make all-day section sticky - works with stickyHeaderDates: true */
.fc .fc-col-header,
.fc .fc-timegrid-axis,
.fc .fc-timegrid-slot-label-frame {
  background: white;
}

/* Category typeahead dropdown */
.category-typeahead-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  z-index: 1050;
  display: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-typeahead-dropdown.show {
  display: block;
}

.category-typeahead-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

.category-typeahead-item:last-child {
  border-bottom: none;
}

.category-typeahead-item:hover,
.category-typeahead-item.active {
  background-color: #e9ecef;
}

.category-typeahead-item.no-results {
  color: #6c757d;
  cursor: default;
  text-align: center;
}

.category-typeahead-item.no-results:hover {
  background-color: white;
}

/* Mobile tab layout */
@media (max-width: 767.98px) {
  /* Hide the pane that's not active */
  .mobile-tab-pane {
    display: none !important;
  }

  .mobile-tab-pane.active {
    display: block !important;
    width: 100%;
  }

  /* Make sure tabs are at the top and don't scroll */
  #mobileTabs {
    position: sticky;
    top: 0;
    z-index: 1040;
    border-bottom: 1px solid #dee2e6;
  }

  /* Ensure tab buttons are clearly clickable - 48px minimum height */
  #mobileTabs .nav-link {
    cursor: pointer;
    min-height: 48px;
    padding: 0.875rem 1rem;
    font-size: 1.05rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #mobileTabs .nav-link.active {
    color: #0d6efd;
    border-bottom: 3px solid #0d6efd;
    font-weight: 600;
  }

  #mobileTabs .nav-link:hover {
    color: #0d6efd;
  }

  /* Add spacing between task list sections */
  .category-tasks {
    margin-bottom: 0.75rem;
  }

  /* Better spacing for category headers */
  .category-tasks + div {
    margin-top: 1rem;
  }

  /* Adjust container height to account for tabs */
  .container-fluid.h-100 {
    height: calc(100vh - 170px) !important;
  }

  /* Make task items larger for easier tapping - 56px minimum (above 44px standard) */
  .task-item {
    min-height: 56px;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem !important;
  }

  .task-item .card-body {
    padding: 1rem !important;
    min-height: 56px;
    display: flex;
    align-items: center;
  }

  /* Mobile calendar optimizations */
  .fc .fc-timegrid-slot {
    height: 3.5em !important; /* Larger time slots for easier tapping */
  }

  .fc .fc-timegrid-event {
    font-size: 0.95rem;
    padding: 0.25rem 0.5rem;
    min-height: 44px;
  }

  .fc .fc-toolbar-title {
    font-size: 1.2rem;
  }

  .fc .fc-button {
    min-height: 44px;
    min-width: 44px;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
  }

  .fc .fc-event {
    cursor: pointer;
  }

  /* Make ALL buttons larger on mobile - 44px minimum */
  .btn, .btn-sm {
    min-height: 44px;
    padding: 0.625rem 1rem;
    font-size: 1rem;
  }

  /* Larger touch targets for primary action buttons */
  #newTaskBtn, #newCategoryBtn {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 1.05rem;
  }

  /* Filter buttons */
  .btn-group label.btn {
    min-height: 44px;
    padding: 0.625rem 1rem;
    font-size: 1rem;
  }

  /* Form inputs */
  .form-control, .form-select {
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
  }

  textarea.form-control {
    min-height: 88px; /* 2x standard for multi-line */
  }

  /* Checkboxes and radio buttons */
  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.25rem;
  }

  .form-check-label {
    font-size: 1rem;
    padding-left: 0.5rem;
  }

  /* Modal action buttons */
  .modal-footer .btn {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 1.05rem;
  }

  /* Close button */
  .btn-close {
    width: 44px;
    height: 44px;
    padding: 0.75rem;
  }

  /* Category edit buttons */
  .category-tasks button,
  button[onclick*="openCategoryModal"] {
    min-height: 40px;
    padding: 0.5rem 0.875rem;
  }

  /* Spacing between interactive elements */
  .mb-3 {
    margin-bottom: 1rem !important;
  }

  /* Quick assign buttons */
  .btn-group .btn {
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    font-size: 0.95rem;
    flex: 1;
  }

  /* Bottom sheet modals on mobile */
  .modal-dialog {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    max-width: 100%;
    transform: translateY(0);
    transition: transform 0.2s ease-out;
  }

  .modal.fade .modal-dialog {
    transform: translateY(100%);
  }

  .modal.show .modal-dialog {
    transform: translateY(0);
  }

  .modal-content {
    border: 0;
    border-radius: 1rem 1rem 0 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    border-radius: 1rem 1rem 0 0;
    padding: 1rem 1rem 0.5rem;
    border-bottom: none;
    position: relative;
  }

  /* Add a handle/pill at the top of bottom sheet */
  .modal-header::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background-color: #dee2e6;
    border-radius: 2px;
  }

  .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem 1rem;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
  }

  /* Backdrop on mobile */
  .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
  }
}

/* Desktop: both columns visible */
@media (min-width: 768px) {
  .mobile-tab-pane {
    display: block !important;
  }
}