/* Custom application styles & UI refinements */
:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f8fafc;
  color: #0f172a;
}

@media (max-width: 767px) {
  body {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  letter-spacing: -0.02em;
}

p, li, blockquote {
  text-wrap: pretty;
}

/* Impeccable Focus States */
:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8);
  border-radius: 9999px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

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

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

.animate-fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bookmarkBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.28) rotate(-10deg); }
  65% { transform: scale(0.92) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.animate-bookmark-pop {
  animation: bookmarkBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Custom Range Input Styling for Calculators */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 9999px;
  height: 8px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4f46e5;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #4338ca;
}

input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4f46e5;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

/* Card hover transitions */
.hover-card-lift {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}
.hover-card-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

/* Line Clamp fallbacks */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Enhanced Copy Button Micro-Interactions */
@keyframes copyPop {
  0% { transform: scale(1); }
  25% { transform: scale(0.88); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes checkStroke {
  0% {
    stroke-dashoffset: 24;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes ripplePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-copy {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-copy:active {
  transform: scale(0.92);
}

.btn-copy.btn-copied {
  animation: copyPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards, ripplePulse 0.8s ease-out;
  background-color: #059669 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
}

.btn-copy.btn-copied svg {
  stroke: #ffffff;
}

.animate-check path {
  stroke-dasharray: 24;
  animation: checkStroke 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  header, footer, #saved-drawer, #branch-detail-modal-backdrop, .no-print {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
}
