/* Component Styles */

/* Due Date Badges */
.due-date-badge {
  display: inline-flex;
  align-items: center;
  background-color: #f0f0f0;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 5px;
}

.due-today {
  background-color: var(--due-today-color);
  color: white;
}

.due-tomorrow {
  background-color: var(--due-tomorrow-color);
  color: white;
}

.due-week {
  background-color: var(--due-week-color);
}

.due-later {
  background-color: var(--due-later-color);
  color: white;
}

.importance-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--important-color);
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 5px;
}

.badge-close-button {
  margin-left: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  user-select: none;
}

.badge-close-button:hover {
  opacity: 1;
}

/* Inline Calendar Styles */
.inline-calendar-container {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-calendar {
  font-family: var(--font-family);
  width: 170px;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
}

.inline-calendar:focus {
  border-color: var(--accent-color);
}

.calendar-select-button {
  font-family: var(--font-family);
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.calendar-select-button:hover {
  background-color: var(--accent-hover-color, #0366d6);
}

/* Progress Indicator Styles */
.progress-indicator {
  width: 24px;
  height: 24px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #000;
  position: relative;
  cursor: pointer;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: rgba(0, 0, 0, 0.6) 2.5px 2.5px 1px 0px;
  background-color: #fff;
  display: none;
}

.progress-filter > .progress-indicator {
  width: 12px;
  height: 12px;
}

.progress-indicator::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  border-radius: 50%;
  border: 1px solid #000;
  display: none;
}

.progress-indicator.not-started {
  display: block;
}

.progress-indicator.in-progress {
  display: block;
}

.progress-indicator.in-progress::before {
  background-color: var(--in-progress-color);
  display: inline-block;
}

.progress-indicator.done {
  background-color: var(--completed-color);
  display: block;
}

/* Progress Menu */
.progress-menu {
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  overflow: hidden;
}

.progress-option {
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-option:hover {
  background-color: #f5f5f5;
}

/* Autocomplete Container */
.autocomplete-container {
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  font-size: 12px;
}

.autocomplete-item {
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.autocomplete-item:hover {
  background-color: #f5f5f5;
}

.autocomplete-item.selected {
  background-color: var(--accent-color);
  color: white;
}

.autocomplete-info {
  padding: 4px 8px;
  font-style: italic;
  color: #888;
  font-size: 10px;
  border-bottom: 1px solid #eee;
}

/* Buttons and Action Components */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: auto;
}

.btn-primary {
  background-color: var(--accent-color);
  color: white;
}

.btn-secondary {
  background-color: #eee;
  color: var(--text-color);
}

.btn.btn-danger {
  background-color: var(--error-color);
  color: white;
}

.btn-icon {
  padding: 10px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon.btn-danger {
  border: 1px solid var(--error-color);
  color: var(--text-color);
}

.btn-icon.btn-danger:hover {
  background-color: rgba(240, 14, 55, 0.3);
  color: var(--error-color);
}

.btn-icon:disabled {
  opacity: 0.5;
  cursor: auto;
}

/* Tag Styles */
.tag {
  color: var(--accent-color);
  font-weight: 500;
}

/* Status Message */
.status-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
}

.status-message.show {
  opacity: 1;
}

.status-message.success {
  background-color: var(--done-color);
}

.status-message.error {
  background-color: var(--due-today-color);
}

/* Hide date picker controls in editor, now that we're using inline calendar */
.due-date-selector,
.due-date-controls {
  display: none;
}

/* Dialog Box Styles */
.dialog-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dialog-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: all 0.3s ease;
}

.dialog-backdrop.visible {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-box {
  background-color: var(--bg-color);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  padding: 24px;
  min-width: 320px;
  max-width: 90%;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1;
}

.dialog-box.visible {
  transform: scale(1);
  opacity: 1;
}

.dialog-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-color);
}

.dialog-message {
  font-size: 14px;
  margin-bottom: 24px;
  color: var(--text-secondary-color);
  line-height: 1.5;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-button {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.dialog-button:hover {
  transform: translateY(-2px);
}

.dialog-button.primary {
  background-color: var(--accent-color);
  color: white;
}

.dialog-button.secondary {
  background-color: #eee;
  color: var(--text-color);
}

/* Sync Bubble */
.sync-bubble {
  position: fixed;
  bottom: 16px;
  right: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  z-index: 1000;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-bubble.idle {
  background-color: #cccccc;
  opacity: 0.5;
}

.sync-bubble.syncing {
  background-color: transparent; /* Remove background when showing logo */
  opacity: 1;
  bottom: 8px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: none; /* Remove shadow during sync */
}

.sync-bubble.success {
  background-color: var(--accent-color);
  opacity: 1;
}

.sync-bubble.error {
  background-color: var(--due-today-color);
  opacity: 1;
}

.sync-bubble:hover {
  transform: scale(1.2);
  opacity: 1;
}

/* Logo element inside the bubble */
.sync-bubble-logo {
  width: 70%;
  height: 70%;
  opacity: 0;
  transition: all 0.3s ease;
  color: var(--accent-color); /* Use accent color for the logo */
  display: flex;
}

.sync-bubble-logo.visible {
  width: 100%;
  height: 100%;
  opacity: 1;
}

.sync-bubble-logo svg {
  width: 100%;
  height: 100%;
}

.sync-bubble-tooltip {
  position: absolute;
  bottom: 48px;
  right: 0;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  visibility: hidden;
  /* Prevent tooltip from inheriting parent's transformations */
  transform-origin: bottom right;
  will-change: transform;
}

/* Take the tooltip out of the animation flow */
.sync-bubble.animate-syncing .sync-bubble-tooltip {
  animation: none;
  transform: translateY(0);
}

.sync-bubble.animate-success .sync-bubble-tooltip {
  animation: none;
}

.sync-bubble.animate-error .sync-bubble-tooltip {
  animation: none;
}

.sync-bubble-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* Sync animations */
.sync-bubble.animate-syncing {
  animation: rotateBubble 2s infinite linear;
}

.sync-bubble.animate-success {
  animation: success-pulse 1s ease;
}

.sync-bubble.animate-error {
  animation: error-shake 0.5s;
}

@keyframes rotateBubble {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

@keyframes success-pulse {
  0% {
    transform: scale(1);
    background-color: var(--accent-color);
  }
  15% {
    transform: scale(0.7);
    background-color: var(--accent-color);
  }
  50% {
    transform: scale(1.5);
    background-color: var(--accent-color);
  }
  100% {
    transform: scale(1);
    background-color: #cccccc;
  }
}

@keyframes error-shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
  100% {
    transform: translateX(0);
  }
}
