/* ============================================================
   ImageResize — style.css
   ============================================================ */

/* ---------- Reset & Tokens --------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Paleta */
  --clr-bg:        #0d0d1a;
  --clr-surface:   #13132a;
  --clr-surface-2: #1a1a38;
  --clr-border:    rgba(108, 99, 255, 0.20);
  --clr-border-2:  rgba(108, 99, 255, 0.40);

  --clr-primary:   #6C63FF;
  --clr-secondary: #FF6B9D;
  --clr-accent:    #38D9F5;

  --clr-text:      #e8e8ff;
  --clr-text-muted:#8888aa;

  /* Gradientes */
  --grad-primary: linear-gradient(135deg, #6C63FF 0%, #FF6B9D 100%);
  --grad-glow:    radial-gradient(ellipse at center, rgba(108,99,255,0.25) 0%, transparent 70%);

  /* Tipografía */
  --font: 'Outfit', system-ui, sans-serif;

  /* Misc */
  --radius:    16px;
  --radius-sm: 8px;
  --shadow:    0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(108,99,255,0.25);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Base ------------------------------------------- */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Screen-reader only */
.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;
}

/* ---------- Fondo orbs ------------------------------------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orb-float 12s ease-in-out infinite alternate;
}

.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6C63FF, transparent 70%);
  top: -150px; left: -150px;
  animation-delay: 0s;
}

.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #FF6B9D, transparent 70%);
  bottom: -120px; right: -120px;
  animation-delay: -4s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #38D9F5, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
  opacity: 0.15;
}

@keyframes orb-float {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -20px) scale(1.05); }
  100% { transform: translate(-20px, 30px) scale(0.95); }
}

/* ---------- App Container ---------------------------------- */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ---------- Header ----------------------------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  filter: drop-shadow(0 0 12px rgba(108,99,255,0.6));
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.header-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(108,99,255,0.12);
  border: 1px solid var(--clr-border-2);
  color: var(--clr-primary);
  backdrop-filter: blur(8px);
}

/* ---------- Workspace -------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: start;
}

/* ---------- Panels ----------------------------------------- */
.panel {
  background: rgba(19, 19, 42, 0.75);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 32px 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color var(--transition);
}

.panel:hover {
  border-color: var(--clr-border-2);
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
  margin-top: -8px;
}

/* ---------- Drop Zone -------------------------------------- */
.drop-zone {
  position: relative;
  border: 2px dashed var(--clr-border-2);
  border-radius: var(--radius);
  min-height: 280px;
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  overflow: hidden;
  outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--clr-primary);
  background: rgba(108,99,255,0.05);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.drop-zone.drag-over {
  border-color: var(--clr-primary);
  background: rgba(108,99,255,0.1);
  box-shadow: 0 0 60px rgba(108,99,255,0.35);
  transform: scale(1.01);
  animation: pulse-border 0.8s ease infinite alternate;
}

@keyframes pulse-border {
  from { box-shadow: 0 0 30px rgba(108,99,255,0.25); }
  to   { box-shadow: 0 0 60px rgba(108,99,255,0.55); }
}

.drop-zone.is-loading {
  cursor: wait;
  pointer-events: none;
}

.drop-zone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  min-height: 280px;
  text-align: center;
  transition: opacity var(--transition);
}

.drop-zone.is-loading .drop-zone__inner {
  opacity: 0;
}

.drop-icon {
  width: 72px; height: 72px;
  transition: transform var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
  transform: translateY(-6px) scale(1.1);
}

.drop-zone__text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text);
}

.drop-zone__subtext {
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  margin-top: -4px;
}

/* Loading overlay */
.drop-zone__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.drop-zone.is-loading .drop-zone__loading {
  opacity: 1;
}

/* Spinner */
.spinner {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(108,99,255,0.2);
  border-top-color: var(--clr-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Format tags ------------------------------------ */
.formats-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.format-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(108,99,255,0.08);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
}

/* ---------- Divider ---------------------------------------- */
.divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 100px;
}

.divider__line {
  width: 2px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--clr-border-2), transparent);
}

.divider__arrow {
  width: 32px; height: 32px;
  transform: rotate(90deg);
}

/* ---------- Result Box ------------------------------------- */
.result-box {
  position: relative;
  border-radius: var(--radius);
  background: rgba(10,10,20,0.5);
  border: 1px solid var(--clr-border);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color var(--transition);
}

.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  color: var(--clr-text-muted);
  font-size: 0.85rem;
}

.result-empty svg {
  width: 64px; height: 64px;
  opacity: 0.4;
}

.result-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: calc(var(--radius) - 2px);
  animation: img-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes img-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.result-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 2px 12px rgba(108,99,255,0.5);
  animation: badge-in 0.4s 0.2s both;
}

@keyframes badge-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Info Panel ------------------------------------- */
.info-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
  animation: fade-up 0.3s ease forwards;
}

.info-item {
  background: rgba(108,99,255,0.07);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
}

.info-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-text);
}

/* ---------- Format Options --------------------------------- */
.format-options {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fade-up 0.3s ease forwards;
}

.format-label {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.format-buttons {
  display: flex;
  gap: 6px;
}

.format-btn {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--clr-border-2);
  color: var(--clr-text-muted);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.format-btn:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  transform: translateY(-1px);
}

.format-btn.active {
  background: var(--grad-primary);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 16px rgba(108,99,255,0.4);
}

/* ---------- Buttons ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    opacity var(--transition);
  width: 100%;
}

.btn:active { transform: scale(0.97); }

.btn-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

/* Primary */
.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 24px rgba(108,99,255,0.4);
  animation: fade-up 0.35s 0.1s both;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108,99,255,0.6);
}

/* Outline */
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--clr-border-2);
  color: var(--clr-text-muted);
  margin-top: 4px;
}

.btn-outline:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(108,99,255,0.2);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px;
  width: 100%;
  border: none;
  animation: fade-up 0.35s 0.2s both;
}

.btn-ghost:hover {
  color: var(--clr-text);
  transform: translateY(-1px);
}

/* Hidden utility */
.hidden { display: none !important; }

/* ---------- Animations ------------------------------------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Toast ------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.toast {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 12px;
  background: rgba(20, 20, 45, 0.95);
  border: 1px solid var(--clr-border-2);
  color: var(--clr-text);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-error {
  border-color: rgba(255, 80, 80, 0.5);
  color: #ff8080;
}

.toast.toast-success {
  border-color: rgba(56, 217, 245, 0.5);
  color: var(--clr-accent);
}

/* ---------- Responsive ------------------------------------- */
@media (max-width: 760px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .divider {
    flex-direction: row;
    padding-top: 0;
  }

  .divider__line {
    width: 60px; height: 2px;
    background: linear-gradient(to right, transparent, var(--clr-border-2), transparent);
  }

  .divider__arrow {
    transform: rotate(0deg);
  }

  .info-panel {
    grid-template-columns: 1fr;
  }
}

/* ---------- Batch Panel ------------------------------------ */
.batch-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fade-up 0.3s ease forwards;
}

.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.batch-count {
  font-size: 1rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.batch-size {
  font-size: 0.78rem;
  color: var(--clr-text-muted);
  font-weight: 500;
}

/* Progress bar */
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(108,99,255,0.12);
  border: 1px solid var(--clr-border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(108,99,255,0.5);
  position: relative;
}

/* Shimmer on progress bar */
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}

/* Current file label */
.batch-current {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  min-height: 1.4em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.batch-current em {
  font-style: normal;
  color: var(--clr-text);
  font-weight: 500;
}

/* Animated pulsing dot */
.processing-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--clr-primary);
  flex-shrink: 0;
  animation: dot-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes dot-pulse {
  from { opacity: 0.3; transform: scale(0.7); }
  to   { opacity: 1;   transform: scale(1.3); }
}

/* File list */
.batch-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border-2) transparent;
}

.batch-list::-webkit-scrollbar        { width: 4px; }
.batch-list::-webkit-scrollbar-track  { background: transparent; }
.batch-list::-webkit-scrollbar-thumb  {
  background: var(--clr-border-2);
  border-radius: 999px;
}

/* Individual file item */
.batch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  animation: fade-up 0.2s ease both;
}

.batch-item--ok {
  background: rgba(56, 217, 245, 0.06);
  border: 1px solid rgba(56, 217, 245, 0.18);
}

.batch-item--err {
  background: rgba(255, 80, 80, 0.06);
  border: 1px solid rgba(255, 80, 80, 0.2);
}

.batch-item__icon {
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.batch-item--ok  .batch-item__icon { color: var(--clr-accent); }
.batch-item--err .batch-item__icon { color: #ff6060; }

.batch-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--clr-text);
  font-weight: 500;
}

.batch-item__size {
  font-size: 0.7rem;
  color: var(--clr-text-muted);
  flex-shrink: 0;
}

