/* Advanced animations and UI/UX enhancements for KSCB */

/* Keyframe animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

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

/* Loading skeletons */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius);
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Smooth entrance animations */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.fade-in-delay {
  animation: fadeIn 0.6s ease-out 0.2s both;
}

[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].animate {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced hover effects */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

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

/* Button enhancements */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Focus visible improvements */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Smooth scroll indicator */
.scroll-indicator {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s;
  z-index: 100;
}

/* Tooltip styles */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--ink);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  pointer-events: none;
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Micro-interactions */
.interactive {
  transition: transform 0.2s ease;
}

.interactive:active {
  transform: scale(0.98);
}

/* Form field animations */
.form input,
.form textarea {
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form input:focus,
.form textarea:focus {
  box-shadow: 0 0 0 3px rgba(17, 134, 58, 0.1);
}

.form input.error,
.form textarea.error {
  border-color: #ef4444;
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Success animation */
.success-check {
  width: 60px;
  height: 60px;
  margin: 20px auto;
}

.success-check svg {
  width: 100%;
  height: 100%;
}

.success-check .circle {
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: circle 0.6s ease-in-out forwards;
}

.success-check .check {
  stroke: var(--brand);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: check 0.3s 0.6s ease-in-out forwards;
}

@keyframes circle {
  to { stroke-dashoffset: 0; }
}

@keyframes check {
  to { stroke-dashoffset: 0; }
}

/* Notification animations */
.notification {
  animation: slideIn 0.3s ease-out;
}

.notification.removing {
  animation: slideOut 0.3s ease-out;
}

@keyframes slideOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* Page transition */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--brand);
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 10000;
}

.page-transition.active {
  transform: translateY(0);
}

/* Improved accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}