/* danbako UI Enhancements */

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse-gentle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes bounce-gentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* Animation utility classes */
.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 0.4s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.animate-pulse-gentle {
  animation: pulse-gentle 2s ease-in-out infinite;
}

.animate-bounce-gentle {
  animation: bounce-gentle 1s ease-in-out infinite;
}

/* Stagger children animation */
.stagger-children > * {
  animation: fadeInUp 0.4s ease-out backwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(229, 231, 235, 1) 0%,
    rgba(243, 244, 246, 1) 50%,
    rgba(229, 231, 235, 1) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(55, 65, 81, 1) 0%,
    rgba(75, 85, 99, 1) 50%,
    rgba(55, 65, 81, 1) 100%
  );
  background-size: 200% 100%;
}

.skeleton-text {
  height: 1rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.skeleton-text-sm {
  height: 0.75rem;
  width: 60%;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
}

.skeleton-card {
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .skeleton-card {
  background: rgb(31, 41, 55);
}

/* ===== Card Hover Effects ===== */
.note-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dark .note-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

.note-card:hover .note-card-title {
  color: rgb(34, 197, 94);
}

.dark .note-card:hover .note-card-title {
  color: rgb(74, 222, 128);
}

/* Pin indicator pulse */
.pin-indicator {
  animation: pulse-gentle 2s ease-in-out infinite;
}

/* ===== Interactive Elements ===== */
.btn-hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hover-lift:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Focus ring improvements */
.focus-ring {
  outline: none;
}

.focus-ring:focus-visible {
  outline: 2px solid rgb(34, 197, 94);
  outline-offset: 2px;
}

/* ===== Form Enhancements ===== */
.input-glow:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.dark .input-glow:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

/* ===== Tag Pills ===== */
.tag-pill {
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.tag-pill:hover {
  transform: scale(1.05);
}

/* ===== Progress Bar ===== */
.progress-bar {
  height: 3px;
  background: linear-gradient(90deg, rgb(34, 197, 94), rgb(16, 185, 129));
  transform-origin: left;
  transition: transform 0.3s ease;
}

/* ===== Empty State ===== */
.empty-state-icon {
  animation: bounce-gentle 2s ease-in-out infinite;
}

.empty-state-tip {
  animation: fadeInUp 0.5s ease-out backwards;
}

.empty-state-tip:nth-child(1) { animation-delay: 0.2s; }
.empty-state-tip:nth-child(2) { animation-delay: 0.3s; }
.empty-state-tip:nth-child(3) { animation-delay: 0.4s; }

/* ===== Navigation highlight ===== */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: rgb(34, 197, 94);
  transition: all 0.2s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ===== Dropdown Animations ===== */
details[open] > summary ~ * {
  animation: fadeInDown 0.2s ease-out;
}

/* ===== Scrollbar Styling ===== */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.7);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.5);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.7);
}

/* ===== Backdrop Blur for Modals ===== */
.modal-backdrop {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ===== Quick Actions Fab ===== */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgb(34, 197, 94), rgb(16, 185, 129));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

/* ===== Tooltip ===== */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 0.5rem 0.75rem;
  background: rgb(31, 41, 55);
  color: white;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 50;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

.dark .tooltip::after {
  background: rgb(75, 85, 99);
}

/* ===== Keyboard Shortcut Badge ===== */
.kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  font-family: ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  color: inherit;
  opacity: 0.7;
}

.dark .kbd-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
