/* Bank statement dropzone — apply modal */

.statement-field {
  margin: 0;
}

.statement-field > span {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.statement-upload {
  --su-accent: var(--accent-strong, #c45c3e);
  --su-glow: color-mix(in srgb, var(--su-accent) 35%, transparent);
}

.statement-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.statement-upload__zone {
  position: relative;
  border-radius: 1.25rem;
  padding: 1.75rem 1.25rem;
  min-height: 11.5rem;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--su-accent) 6%, var(--surface)),
    var(--surface)
  );
  border: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
  cursor: pointer;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease,
    background 0.25s ease;
  overflow: hidden;
  outline: none;
}

.statement-upload__zone:focus-visible {
  border-color: var(--su-accent);
  box-shadow: 0 0 0 3px var(--su-glow);
}

.statement-upload[data-state="drag"] .statement-upload__zone,
.statement-upload__zone:hover {
  border-color: color-mix(in srgb, var(--su-accent) 55%, transparent);
  box-shadow: 0 12px 32px var(--su-glow);
  transform: translateY(-2px);
}

.statement-upload[data-state="drag"] .statement-upload__zone {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--su-accent) 14%, var(--surface)),
    var(--surface)
  );
}

.statement-upload[data-state="ready"] .statement-upload__zone {
  border-style: solid;
  border-color: color-mix(in srgb, var(--su-accent) 40%, transparent);
  cursor: default;
}

.statement-upload[data-state="uploading"] .statement-upload__zone,
.statement-upload[data-state="analyzing"] .statement-upload__zone,
.statement-upload[data-state="success"] .statement-upload__zone {
  pointer-events: none;
  border-style: solid;
  border-color: color-mix(in srgb, var(--su-accent) 50%, transparent);
}

.statement-upload[data-state="error"] .statement-upload__zone {
  border-color: #c0392b;
}

/* Idle */
.statement-upload__idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.statement-upload[data-state="ready"] .statement-upload__idle,
.statement-upload[data-state="uploading"] .statement-upload__idle,
.statement-upload[data-state="analyzing"] .statement-upload__idle,
.statement-upload[data-state="success"] .statement-upload__idle {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.statement-upload__icon-wrap {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--su-accent) 12%, var(--bg));
  color: var(--su-accent);
  margin-bottom: 0.35rem;
  animation: su-float 3s ease-in-out infinite;
}

.statement-upload__icon-wrap svg {
  width: 1.65rem;
  height: 1.65rem;
}

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

.statement-upload__headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.statement-upload__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 16rem;
  line-height: 1.45;
}

.statement-upload__browse {
  font: inherit;
  font-weight: 700;
  color: var(--su-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.statement-upload__browse:hover {
  color: var(--text);
}

/* File preview */
.statement-upload__file {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  animation: su-file-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.statement-upload[data-state="ready"] .statement-upload__file,
.statement-upload[data-state="uploading"] .statement-upload__file,
.statement-upload[data-state="analyzing"] .statement-upload__file {
  display: flex;
}

.statement-upload[data-state="uploading"] .statement-upload__file,
.statement-upload[data-state="analyzing"] .statement-upload__file {
  opacity: 0.35;
  filter: blur(0.5px);
}

@keyframes su-file-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.statement-upload__pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, #e74c3c 12%, var(--surface));
  color: #c0392b;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.statement-upload__pdf-badge svg {
  width: 1rem;
  height: 1rem;
}

.statement-upload__name {
  margin: 0.25rem 0 0;
  font-weight: 700;
  font-size: 0.9375rem;
  word-break: break-all;
  max-width: 100%;
}

.statement-upload__meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.statement-upload__clear {
  margin-top: 0.5rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.statement-upload__clear:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

/* AI scan overlay */
.statement-upload__scan {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  backdrop-filter: blur(6px);
  z-index: 2;
}

.statement-upload__scan:not(.hidden) {
  display: flex;
}

.statement-upload__scan-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--su-accent) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--su-accent) 8%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.5;
  animation: su-grid-pulse 2s ease-in-out infinite;
}

@keyframes su-grid-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.65; }
}

.statement-upload__scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--su-accent),
    color-mix(in srgb, #fff 80%, var(--su-accent)),
    var(--su-accent),
    transparent
  );
  box-shadow: 0 0 20px var(--su-glow), 0 0 40px var(--su-glow);
  animation: su-scan-beam 2.2s ease-in-out infinite;
  z-index: 1;
}

@keyframes su-scan-beam {
  0% { top: 8%; opacity: 0.6; }
  50% { top: 88%; opacity: 1; }
  100% { top: 8%; opacity: 0.6; }
}

.statement-upload__scan-orbs {
  position: relative;
  width: 5rem;
  height: 5rem;
  z-index: 2;
}

.statement-upload__scan-orbs span {
  position: absolute;
  border-radius: 50%;
  background: var(--su-accent);
  opacity: 0.35;
  animation: su-orb 2.4s ease-in-out infinite;
}

.statement-upload__scan-orbs span:nth-child(1) {
  width: 2.5rem;
  height: 2.5rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 0s;
}

.statement-upload__scan-orbs span:nth-child(2) {
  width: 1rem;
  height: 1rem;
  top: 10%;
  right: 15%;
  animation-delay: 0.4s;
}

.statement-upload__scan-orbs span:nth-child(3) {
  width: 0.65rem;
  height: 0.65rem;
  bottom: 18%;
  left: 12%;
  animation-delay: 0.8s;
}

@keyframes su-orb {
  0%, 100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.15); opacity: 0.55; }
}

.statement-upload__scan-icon {
  position: relative;
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--su-accent), color-mix(in srgb, var(--su-accent) 60%, #8b5cf6));
  color: #fff;
  box-shadow: 0 8px 24px var(--su-glow);
  animation: su-icon-pulse 1.5s ease-in-out infinite;
}

.statement-upload__scan-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

@keyframes su-icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 24px var(--su-glow); }
  50% { transform: scale(1.06); box-shadow: 0 12px 32px var(--su-glow); }
}

.statement-upload[data-state="success"] .statement-upload__scan-icon {
  animation: su-success-pop 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

@keyframes su-success-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.statement-upload__scan-label {
  position: relative;
  z-index: 3;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  max-width: 14rem;
  line-height: 1.35;
}

.statement-upload__scan-pulse {
  position: absolute;
  inset: 12%;
  border-radius: 1rem;
  border: 2px solid color-mix(in srgb, var(--su-accent) 25%, transparent);
  animation: su-ring 2s ease-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes su-ring {
  0% { transform: scale(0.92); opacity: 0.8; }
  100% { transform: scale(1.08); opacity: 0; }
}

.statement-upload__status {
  margin-top: 0.65rem;
  min-height: 1.35rem;
  font-size: 0.8125rem;
  transition: color 0.2s ease;
}

.statement-upload[data-state="analyzing"] .statement-upload__status,
.statement-upload[data-state="uploading"] .statement-upload__status {
  color: var(--su-accent);
  font-weight: 600;
}

.statement-upload[data-state="success"] .statement-upload__status {
  color: #27ae60;
  font-weight: 600;
}

.statement-upload[data-state="error"] .statement-upload__status {
  color: #c0392b;
}

.modal__panel--apply {
  max-width: 26rem;
}

#apply-form-body.hidden {
  display: none;
}

.apply-afford {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
  animation: su-file-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.apply-afford.hidden {
  display: none;
}

.apply-afford__badge {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, #e67e22 14%, var(--surface));
  color: #d35400;
}

.apply-afford__badge svg {
  width: 1.4rem;
  height: 1.4rem;
}

.apply-afford__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.apply-afford__lead {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
}

.apply-afford__stats {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius, 12px);
  background: var(--bg);
  display: grid;
  gap: 0.65rem;
  text-align: left;
}

.apply-afford__stats li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.apply-afford__stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.apply-afford__stat-value {
  font-weight: 700;
  font-size: 0.9375rem;
}

.apply-afford__notes {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: left;
}

.apply-afford__hint {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.apply-afford-result-shown .modal__actions {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .statement-upload__icon-wrap,
  .statement-upload__scan-beam,
  .statement-upload__scan-orbs span,
  .statement-upload__scan-icon,
  .statement-upload__scan-pulse,
  .statement-upload__scan-grid {
    animation: none;
  }

  .statement-upload__zone:hover {
    transform: none;
  }
}
