@keyframes pageFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes softPop {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fuelFill {
  0% { transform: scaleX(0.06); }
  58% { transform: scaleX(0.72); }
  82% { transform: scaleX(0.9); }
  100% { transform: scaleX(1); }
}

@keyframes fuelShine {
  from { transform: translateX(-160%) skewX(-18deg); }
  to { transform: translateX(360%) skewX(-18deg); }
}

@keyframes fuelBubble {
  0% { opacity: 0; transform: translateY(8px) scale(0.65); }
  35% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-18px) scale(1); }
}

@keyframes fuelIconPulse {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 0 rgba(255, 184, 0, 0)); }
  50% { transform: translateY(-2px); filter: drop-shadow(0 5px 8px rgba(255, 184, 0, 0.32)); }
}

@keyframes loaderEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body {
  opacity: 0;
  transition: opacity 180ms ease;
}

body.app-ready {
  opacity: 1;
}

.main-content,
.main-wrapper,
.form-card,
.login-card {
  animation: pageFadeUp 420ms cubic-bezier(.2,.8,.2,1) both;
}

.card,
.metric-card,
.chart-panel,
.table-card,
.table-container,
.filter-card,
.summary-panel,
.upload-box,
.preview-container {
  animation: softPop 360ms cubic-bezier(.2,.8,.2,1) both;
}

a,
button,
.btn,
.btn-filter,
.btn-export,
.nav-item,
.nav-link,
.sidebar-menu a,
.form-control,
.upload-box {
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

button:hover,
.btn:hover,
.btn-filter:hover,
.btn-export:hover,
.upload-box:hover {
  transform: translateY(-1px);
}

.nav-item:hover,
.nav-link:hover,
.sidebar-menu a:hover {
  transform: translateX(2px);
}

.form-control:focus {
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.13);
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 8, 8, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}

html[data-theme="light"] .app-loader {
  background: rgba(248, 250, 252, 0.76);
}

.app-loader.show {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition-delay: 0s;
}

.loader-box {
  width: min(320px, calc(100vw - 48px));
  border: 1px solid color-mix(in srgb, var(--accent-yellow, #ffb800) 28%, var(--border-color, #303030));
  background: color-mix(in srgb, var(--card-bg, #181818) 96%, transparent);
  color: var(--text-main, #fff);
  border-radius: 20px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 184, 0, 0.04) inset;
  text-align: center;
  will-change: transform, opacity;
}

.app-loader.show .loader-box {
  animation: loaderEnter 280ms cubic-bezier(.2, .8, .2, 1) both;
}

.loader-fuel-scene {
  position: relative;
  width: 210px;
  max-width: 100%;
  margin: 0 auto 18px;
  color: var(--accent-yellow, #ffb800);
}

.loader-fuel-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  animation: fuelIconPulse 1400ms ease-in-out infinite;
  will-change: transform, filter;
}

.loader-fuel-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--accent-yellow, #ffb800) 45%, var(--border-color, #303030));
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: 0 0 0 4px rgba(255, 184, 0, 0.05), inset 0 2px 5px rgba(0, 0, 0, 0.22);
}

.loader-fuel-fill {
  position: absolute;
  inset: 2px;
  overflow: hidden;
  border-radius: inherit;
  transform: scaleX(0.06);
  transform-origin: left center;
  background: linear-gradient(90deg, #d89200 0%, var(--accent-yellow, #ffb800) 48%, #ffd45c 100%);
  box-shadow: 0 0 16px rgba(255, 184, 0, 0.34);
  animation: fuelFill 1750ms cubic-bezier(.2, .75, .25, 1) infinite;
  will-change: transform;
}

.loader-fuel-fill::after {
  content: "";
  position: absolute;
  inset: -5px auto -5px 0;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  animation: fuelShine 1250ms ease-in-out infinite;
  will-change: transform;
}

.loader-fuel-bubble {
  position: absolute;
  bottom: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd45c;
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.65);
  animation: fuelBubble 1350ms ease-out infinite;
  will-change: transform, opacity;
}

.loader-fuel-bubble:nth-child(3) { left: 26%; animation-delay: 100ms; }
.loader-fuel-bubble:nth-child(4) { left: 52%; width: 4px; height: 4px; animation-delay: 520ms; }
.loader-fuel-bubble:nth-child(5) { left: 76%; width: 6px; height: 6px; animation-delay: 860ms; }
.loader-title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.loader-subtitle {
  color: var(--text-muted, #94a3b8);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 650;
  margin-bottom: 15px;
}

.is-submitting {
  pointer-events: none;
  opacity: 0.78;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
