/* ADHD-Friendly Accessibility & UX Improvements */

/* Reduced motion support for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .pulse, .animate-pulse, .animate-bounce {
    animation: none !important;
  }
}

/* Focus visible outlines for keyboard navigation */
.focus-visible-ring {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.focus-visible-ring-inset {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Button loading states */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: button-spin 0.6s linear infinite;
}

@keyframes button-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Text loading placeholders */
.loading-text {
  background: linear-gradient(90deg, var(--surface-dim) 25%, var(--surface) 50%, var(--surface-dim) 75%);
  background-size: 200% 100%;
  animation: loading-pulse 1.5s infinite;
  border-radius: 4px;
  min-height: 1em;
}

@keyframes loading-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 300px;
  max-width: 400px;
  animation: toast-slide-in 0.3s ease-out;
}

.toast-success {
  background-color: #7a9e7e;
}

.toast-error {
  background-color: #c46a6a;
}

.toast-warning {
  background-color: #d4a574;
}

.toast-info {
  background-color: #6a8fc4;
}

.toast-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* High contrast focus indicators */
.high-contrast-focus:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}

/* ADHD-friendly spacing and visual hierarchy */
.adhd-friendly-spacing {
  line-height: 1.6;
  word-spacing: 0.5px;
}

.adhd-friendly-spacing h1, 
.adhd-friendly-spacing h2, 
.adhd-friendly-spacing h3 {
  margin-bottom: 0.8em;
}

.adhd-friendly-spacing p {
  margin-bottom: 1.2em;
}

/* Visual break indicators for long content */
.visual-break {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 2rem 0;
}

/* Clear visual feedback for interactive elements */
.interactive-element {
  transition: all 0.2s ease;
}

.interactive-element:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.interactive-element:active {
  transform: translateY(0);
}

/* Consistent disabled states */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Visual indicators for required fields */
.required::after {
  content: " *";
  color: #c46a6a;
}

/* Clear visual hierarchy for form elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--surface);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.2);
}

/* Error states for form elements */
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #c46a6a;
  background-color: rgba(196, 106, 106, 0.05);
}

.form-error {
  color: #c46a6a;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

/* Consistent card styling */
.card {
  background-color: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Consistent list styling */
.list-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

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

/* Visual indicators for draggable elements */
.draggable {
  cursor: grab;
}

.draggable:active {
  cursor: grabbing;
}

.drag-handle {
  cursor: grab;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.drag-handle:hover {
  opacity: 1;
}

/* Consistent modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background-color: var(--surface);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Consistent badge styling */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

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

.badge-secondary {
  background-color: var(--surface-dim);
  color: var(--text);
}

/* Consistent divider styling */
.divider {
  border: none;
  height: 1px;
  background-color: var(--border);
  margin: 1rem 0;
}

/* Consistent empty state styling */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  margin-bottom: 1.5rem;
}

/* Consistent section header styling */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* Consistent icon button styling */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background-color: var(--surface-dim);
  color: var(--text);
}

.icon-btn:active {
  background-color: var(--surface-active);
}

/* Consistent toggle switch styling */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-dim);
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Consistent progress bar styling */
.progress-bar {
  height: 8px;
  background-color: var(--surface-dim);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Consistent avatar styling */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--surface-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  color: var(--text);
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

/* Consistent tag styling */
.tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--surface-dim);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1;
}

.tag-clickable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tag-clickable:hover {
  background-color: var(--surface-active);
}

/* Consistent tooltip styling */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--surface-dim);
  color: var(--text);
  text-align: center;
  border-radius: 6px;
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--surface-dim) transparent transparent transparent;
}
