@import "tailwindcss";
@plugin "@tailwindcss/typography";

@theme {
  --font-sans: 'Montserrat', sans-serif;
  --color-yes: #4ade80;
  --color-no: #f87171;
  --color-accent: #3b82f6;
  --color-surface: #1e293b;
  --color-surface-light: #334155;
  --color-surface-border: #475569;

  /* Superficies multicapa (sistema visual landing) */
  --color-bg-base:     #0b1224;
  --color-bg-top:      #0f172a;
  --color-surface-1:   #1e293b;
  --color-surface-2:   #273549;
  --color-line-soft:   rgba(51, 65, 85, 0.5);
  --color-line-hard:   #334155;

  /* Sombras */
  --shadow-card:  0 1px 3px rgba(0,0,0,.4), 0 20px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(51,65,85,.5);
  --shadow-modal: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(51,65,85,.5);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* Fondo global multicapa — linear dark + 2 radiales azules sutiles */
body {
  background-color: var(--color-bg-base);
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(59, 130, 246, 0.10), transparent 60%),
    radial-gradient(700px 400px at 95% 10%,  rgba(37, 99, 235, 0.08), transparent 65%),
    linear-gradient(180deg, #0f172a 0%, #0b1224 50%, #0a0f1e 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.field_with_errors {
  display: contents;
}

@layer components {
  .btn-primary {
    @apply inline-flex items-center justify-center px-5 py-2.5 rounded-lg bg-accent text-white font-semibold
           hover:bg-blue-600 transition-[color,background-color,border-color,transform] duration-150
           active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed;
  }

  .btn-secondary {
    @apply inline-flex items-center justify-center px-5 py-2.5 rounded-lg bg-surface-light text-slate-100 font-semibold
           border border-surface-border hover:bg-slate-600 transition-[color,background-color,border-color,transform] duration-150
           active:scale-[0.97];
  }

  .btn-yes {
    @apply flex flex-col items-center justify-center text-center px-4 py-3 rounded-lg bg-yes/20 text-yes font-semibold
           border border-yes/30 hover:bg-yes/30 transition-[color,background-color,border-color,transform] duration-150
           active:scale-[0.97];
  }

  .btn-no {
    @apply flex flex-col items-center justify-center text-center px-4 py-3 rounded-lg bg-no/20 text-no font-semibold
           border border-no/30 hover:bg-no/30 transition-[color,background-color,border-color,transform] duration-150
           active:scale-[0.97];
  }

  .btn-danger {
    @apply inline-flex items-center justify-center px-5 py-2.5 rounded-lg bg-red-500 text-white font-semibold
           hover:bg-red-600 transition-[color,background-color,border-color,transform] duration-150
           active:scale-[0.97];
  }

  .card {
    @apply rounded-2xl border p-5;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(39, 53, 73, 0.92) 100%);
    border-color: var(--color-line-hard);
    box-shadow: var(--shadow-card);
  }

  .panel {
    @apply rounded-[20px] border;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(30, 41, 59, 0.88) 100%);
    border-color: var(--color-line-hard);
    box-shadow: var(--shadow-card);
  }

  .modal-panel {
    @apply rounded-2xl border;
    background: linear-gradient(180deg, #1e293b 0%, #273549 100%);
    border-color: var(--color-line-hard);
    box-shadow: var(--shadow-modal);
  }

  .surface-elevated {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid var(--color-line-hard);
    border-radius: 8px;
  }

  .input-field {
    @apply w-full px-3.5 py-2.5 rounded-lg bg-slate-800 border border-surface-border text-slate-100
           placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500/15 focus:border-transparent
           transition-colors duration-150;
  }

  .label-field {
    @apply block text-sm font-semibold text-slate-300 mb-1.5;
  }

  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold uppercase tracking-wider;
  }

  .link {
    @apply text-accent hover:text-blue-400 transition-colors duration-150;
  }
}

/* ── Motion utilities ── */

@utility overlay-enter {
  opacity: 1;
  transition: opacity 220ms var(--ease-out);
}

@utility overlay-hidden {
  opacity: 0;
  pointer-events: none;
}

@utility panel-enter {
  opacity: 1;
  transform: scale(1);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}

@utility panel-hidden {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

@utility card-hover {
  transition: border-color 200ms ease, transform 200ms ease;
  @media (hover: hover) and (pointer: fine) {
    &:hover {
      border-color: rgba(59, 130, 246, 0.5);
      transform: translateY(-2px);
    }
  }
}

@utility stagger-item {
  opacity: 0;
  transform: translateY(8px);
  animation: stagger-fade 300ms var(--ease-out) forwards;
}

@keyframes stagger-fade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@utility shake {
  animation: shake 400ms ease-out;
}

/* ── Turbo progress bar ── */
.turbo-progress-bar {
  background: var(--color-accent);
  height: 2px;
}

/* ── Probability bar ── */
@utility prob-bar {
  transition: width 500ms var(--ease-in-out);
}

/* ── Skeleton shimmer ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@utility skeleton {
  background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 0.375rem;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
