/* ==============================================================
 * JSK Micro-Interactions & Polished Details Design System
 * Fast, purposeful, and restrained transitions (150-250ms cubic-bezier)
 * ============================================================== */

/* 1. Global Button & Tap Micro-Interactions */
button,
.btn,
a.btn,
input[type="submit"],
button[type="submit"],
[role="button"],
.btn-interactive,
.btn-action {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease,
              border-color 0.2s ease,
              color 0.2s ease !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

button:hover:not(:disabled),
.btn:hover,
a.btn:hover,
input[type="submit"]:hover:not(:disabled),
button[type="submit"]:hover:not(:disabled),
[role="button"]:hover,
.btn-interactive:hover {
  transform: translateY(-2px);
}

button:active:not(:disabled),
.btn:active,
a.btn:active,
input[type="submit"]:active:not(:disabled),
button[type="submit"]:active:not(:disabled),
[role="button"]:active,
.btn-interactive:active {
  transform: translateY(1px) scale(0.97) !important;
  filter: brightness(0.96);
}

button:disabled,
input[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none !important;
}

/* Subtle Click Ripple Feedback */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.4);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.btn-ripple:focus:not(:active)::after {
  animation: jsk-ripple 0.6s ease-out;
}

@keyframes jsk-ripple {
  0% { transform: scale(0, 0) translate(-50%, -50%); opacity: 0.5; }
  100% { transform: scale(40, 40) translate(-50%, -50%); opacity: 0; }
}


/* 2. Navigation Indicator Animations */
.nav-link-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0;
  transition: color 0.2s ease;
}

.nav-link-indicator::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #00a3e8, #38bdf8);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link-indicator:hover::after,
.nav-link-indicator.active::after,
.current-menu-item > .nav-link-indicator::after {
  transform: scaleX(1);
}

/* Smooth Navigation Dropdown Menu Reveal */
.nav-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
}

.group:hover .nav-dropdown,
.group:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}


/* 3. Skeleton Loading Shimmer States (Zero Cumulative Layout Shift - CLS) */
@keyframes jsk-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.jsk-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: jsk-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

.dark .jsk-skeleton,
.bg-slate-900 .jsk-skeleton,
.bg-slate-950 .jsk-skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

/* Content Loading Placeholder utilities */
.jsk-placeholder-img {
  background-color: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.jsk-placeholder-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: jsk-shimmer 2s infinite;
}

.jsk-placeholder-img.loaded::before {
  display: none;
}


/* 4. Form Validation & Real-Time Feedback Details */
input,
textarea,
select {
  transition: border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.2s ease !important;
}

/* Valid Input Micro-State */
.jsk-input-valid {
  border-color: #10b981 !important;
  background-color: #f0fdf4 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Invalid Input Micro-State */
.jsk-input-invalid {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
  animation: jsk-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes jsk-shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* Inline Form Feedback Message Slide-Down */
.form-feedback-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.35rem;
  animation: jsk-slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.form-feedback-hint.is-error {
  color: #e11d48;
}

.form-feedback-hint.is-success {
  color: #059669;
}

@keyframes jsk-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* 5. Floating Toast Notification (Matching User Reference Image) */
#jsk-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.jsk-toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
  animation: jsk-toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.jsk-toast.is-hiding {
  animation: jsk-toast-out 0.25s ease forwards;
}

@keyframes jsk-toast-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes jsk-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

.jsk-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.jsk-toast-body {
  flex: 1;
}

.jsk-toast-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 2px;
}

.jsk-toast-msg {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.jsk-toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.jsk-toast-close:hover {
  color: #334155;
  transform: none !important;
}

/* Toast Progress Bar at bottom */
.jsk-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #10b981;
  width: 100%;
  animation: jsk-toast-shrink 4s linear forwards;
}

@keyframes jsk-toast-shrink {
  from { width: 100%; }
  to { width: 0%; }
}


/* 6. Top Reading Scroll Progress Bar */
#jsk-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #00a3e8, #38bdf8, #10b981);
  z-index: 999999;
  transition: width 0.08s ease-out;
  pointer-events: none;
}


/* 7. Scroll Reveal & Elevation Micro-Interactions */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Card Elevation Hover Effect */
.card-elevation {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease;
}

.card-elevation:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.12);
}


/* 8. Modal Backdrop & Dialog Animations */
.jsk-modal-backdrop {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

.jsk-modal-dialog {
  animation: jsk-modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes jsk-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}


/* 9. Accessible Reduced Motion Preference Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
}
