/* Due Date Styles */

/* Due date indicator badges */
.due-date-indicator {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  margin-left: 8px;
  white-space: nowrap;
}

.due-date-indicator i {
  margin-right: 4px;
  font-size: 0.9em;
}

/* Status-based colors */
.due-date-overdue {
  background-color: #dc3545;
  color: white;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.due-date-today {
  background-color: #fd7e14;
  color: white;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(253, 126, 20, 0.25);
}

.due-date-tomorrow {
  background-color: #ffc107;
  color: #212529;
  font-weight: 500;
}

.due-date-soon {
  background-color: #0dcaf0;
  color: white;
}

.due-date-later {
  background-color: #6c757d;
  color: white;
}

/* Block styling with persistent due date indicators */
.task-item[data-due-date] {
  position: relative;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

/* Overdue items - strong red visual */
.block-overdue,
.task-item.due-overdue {
  border-left: 4px solid #dc3545 !important;
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.08) 0%, transparent 20%);
}

.block-overdue .accordion-button,
.task-item.due-overdue .accordion-button {
  background-color: rgba(220, 53, 69, 0.05);
}

.block-overdue::before,
.task-item.due-overdue::before {
  content: '!';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background-color: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  z-index: 1;
}

/* Due today, tomorrow, soon - removed border styling, using icon indicators instead */
/* The due date icon and filters are sufficient visual indicators */

/* Animation for overdue items */
@keyframes pulse-overdue {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Due date input section in modals */
.due-date-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #dee2e6;
}

.due-date-input {
  width: 100%;
}

.due-date-quick-select {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.due-date-quick-select button {
  font-size: 0.875rem;
  padding: 4px 8px;
}

/* Due date settings */
.due-date-settings {
  margin-top: 10px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.due-date-settings .form-check {
  margin-bottom: 8px;
}

.reminder-timing-select {
  width: auto;
  display: inline-block;
  margin-left: 10px;
}

/* Due date indicator in task lists */
.task-element .due-date-indicator-container {
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: 10px;
}

/* Due date in card view */
.card .due-date-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Snooze dropdown */
.due-date-snooze-menu {
  min-width: 120px;
}

.due-date-snooze-menu .dropdown-item {
  padding: 8px 16px;
  font-size: 0.875rem;
}

/* Priority boost indicator */
.priority-high.block-overdue {
  border-left-width: 5px;
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.1) 0%, transparent 100%);
}

/* Due date filter buttons */
.due-date-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.due-date-filter-btn {
  padding: 6px 12px;
  border: 1px solid #dee2e6;
  background-color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.due-date-filter-btn:hover {
  background-color: #f8f9fa;
}

.due-date-filter-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.due-date-filter-btn .badge {
  margin-left: 5px;
  font-size: 0.75rem;
}

/* Style for dropdown button when filter is active */
#dueDateFilterDropdown.btn-primary {
  background-color: #0056b3;
  border-color: #0056b3;
  font-weight: 500;
}

#dueDateFilterDropdown.btn-primary:hover {
  background-color: #004085;
  border-color: #004085;
}

#dueDateFilterDropdown .badge {
  margin-left: 5px;
  font-size: 0.75rem;
  vertical-align: middle;
}

/* Active filter indicator in dropdown menu */
.dropdown-item.due-date-filter.active {
  background-color: #007bff;
  color: white;
}

.dropdown-item.due-date-filter.active:hover {
  background-color: #0056b3;
}

/* Calendar view styles */
.due-date-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: #dee2e6;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
}

.calendar-day {
  background-color: white;
  min-height: 80px;
  padding: 5px;
  position: relative;
}

.calendar-day-header {
  font-weight: bold;
  font-size: 0.875rem;
  margin-bottom: 5px;
}

.calendar-day-tasks {
  font-size: 0.75rem;
}

.calendar-task-item {
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.calendar-task-item.overdue {
  background-color: #dc3545;
  color: white;
}

.calendar-task-item.due-today {
  background-color: #fd7e14;
  color: white;
}

.calendar-task-item.due-soon {
  background-color: #0dcaf0;
  color: white;
}

/* Minimal due date indicators for collapsed blocks */
.due-date-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  margin-left: 8px;
  opacity: 0.9;
  white-space: nowrap;
  vertical-align: middle;
}

.due-date-mini i {
  font-size: 0.7rem;
  margin-right: 3px;
}

.due-date-mini-text {
  font-weight: 500;
}

/* Overdue - subtle red */
.due-date-mini-overdue {
  background-color: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

/* Today - subtle orange */
.due-date-mini-today {
  background-color: rgba(253, 126, 20, 0.15);
  color: #fd7e14;
  border: 1px solid rgba(253, 126, 20, 0.3);
}

/* Tomorrow - subtle yellow */
.due-date-mini-tomorrow {
  background-color: rgba(255, 193, 7, 0.15);
  color: #f39c12;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Soon (within 7 days) - subtle blue */
.due-date-mini-soon {
  background-color: rgba(13, 202, 240, 0.1);
  color: #0dcaf0;
  border: 1px solid rgba(13, 202, 240, 0.2);
}

/* Future - very subtle gray */
.due-date-mini-future {
  background-color: rgba(108, 117, 125, 0.08);
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.15);
}

/* Hover effect for minimal indicators */
.due-date-mini:hover {
  opacity: 1;
  transform: scale(1.05);
  transition: all 0.2s ease;
}

/* Clickable due date indicators */
.due-date-clickable {
  cursor: pointer;
  user-select: none;
}

.due-date-clickable:hover {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
  transition: all 0.2s ease;
}

/* Add due date button style */
.due-date-add-btn {
  background-color: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.2);
  cursor: pointer;
}

.due-date-add-btn:hover {
  background-color: rgba(40, 167, 69, 0.2);
  border-color: rgba(40, 167, 69, 0.4);
  transform: scale(1.08);
}

/* Inline date picker styles */
.inline-date-picker {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 280px;
  max-width: 350px;
  animation: fadeInDown 0.2s ease;
  color: var(--bs-body-color, #212529);
  width: max-content;
}

/* Mobile optimization - center and limit width */
@media (max-width: 576px) {
  .inline-date-picker {
    min-width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    left: 20px !important;
    right: 20px !important;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inline-date-picker .date-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bs-border-color, #e9ecef);
}

.inline-date-picker .date-picker-header strong {
  color: var(--bs-body-color, #212529);
  font-weight: 600;
}

.inline-date-picker .btn-close {
  width: 20px;
  height: 20px;
  padding: 0;
  background-size: 10px;
  opacity: 0.5;
}

.inline-date-picker .btn-close:hover {
  opacity: 1;
}

.inline-date-picker .form-control {
  font-size: 0.9rem;
  padding: 6px 10px;
  background-color: var(--bs-body-bg, #fff);
  border-color: var(--bs-border-color, #ced4da);
  color: var(--bs-body-color, #212529);
}

.inline-date-picker .form-control:focus {
  background-color: var(--bs-body-bg, #fff);
  border-color: var(--bs-primary, #0d6efd);
  color: var(--bs-body-color, #212529);
}

/* Fix datetime-local input calendar icon visibility */
.inline-date-picker input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: var(--bs-body-color) == #fff ? invert(1) : invert(0);
  opacity: 0.8;
  cursor: pointer;
}

.inline-date-picker input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.inline-date-picker .quick-select-buttons {
  margin-top: 10px;
}

.inline-date-picker .btn-group {
  display: flex;
}

.inline-date-picker .btn-group .btn {
  flex: 1;
  font-size: 0.8rem;
  padding: 5px 8px;
}

.inline-date-picker [data-action="save"] {
  margin-top: 10px;
  font-size: 0.9rem;
  padding: 6px 12px;
}

/* Ensure date picker appears above other elements */
.inline-date-picker {
  z-index: 1050;
}

/* Bootstrap dark theme support */
[data-bs-theme="dark"] .inline-date-picker {
  background-color: var(--bs-body-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .inline-date-picker .date-picker-header {
  border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .inline-date-picker .date-picker-header strong {
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .inline-date-picker .form-control {
  background-color: var(--bs-body-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .inline-date-picker input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Fallback for prefers-color-scheme (if data-bs-theme not set) */
@media (prefers-color-scheme: dark) {
  body:not([data-bs-theme="light"]) .inline-date-picker {
    background-color: #212529;
    border-color: #495057;
    color: #dee2e6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }

  body:not([data-bs-theme="light"]) .inline-date-picker .date-picker-header {
    border-bottom-color: #495057;
  }

  body:not([data-bs-theme="light"]) .inline-date-picker .date-picker-header strong {
    color: #dee2e6;
  }

  body:not([data-bs-theme="light"]) .inline-date-picker .form-control {
    background-color: #212529;
    border-color: #495057;
    color: #dee2e6;
  }

  body:not([data-bs-theme="light"]) .inline-date-picker input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
  }
}

/* Ensure indicators don't break layout */
.task-title-section {
  position: relative;
}

.child-title-section {
  position: relative;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .due-date-indicator {
    font-size: 0.75rem;
    padding: 1px 6px;
  }
  
  .due-date-indicator i {
    display: none;
  }
  
  .due-date-quick-select {
    flex-direction: column;
  }
  
  .due-date-quick-select button {
    width: 100%;
  }
  
  .due-date-calendar {
    grid-template-columns: repeat(1, 1fr);
  }
}