@tailwind base;
@tailwind components;
@tailwind utilities;

/* Talio Brand Book - Custom CSS */
@layer base {
  :root {
    /* Colores principales del brandbook */
    --color-talio-primary: #1F3A5F;
    --color-talio-hope: #6FAF9E;
    --color-talio-progress: #B7E4C7;
    --color-talio-surface: #F7F9FB;
    --color-talio-text: #374151;

    /* Variantes */
    --color-talio-primary-light: #2D4A73;
    --color-talio-primary-dark: #152840;
    --color-talio-hope-light: #8FC4B5;
    --color-talio-hope-dark: #5A9A89;
    --color-talio-progress-light: #D4F0DC;
    --color-talio-progress-dark: #9AD9AE;

    /* Colores semánticos */
    --color-talio-error: #DC6B6B;
    --color-talio-warning: #E5A853;
    --color-talio-info: #6B9DC6;

    /* Variantes dark para WCAG AA (uso en texto sobre fondos claros) */
    --color-talio-warning-dark: #92400E;
    --color-talio-info-dark: #1E40AF;
  }

  body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    @apply text-gray-600 bg-gray-50 antialiased;
    font-size: 14px;
    line-height: 1.5;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
    @apply text-gray-800;
  }

  h1 { font-size: 28px; font-weight: 600; line-height: 34px; }
  h2 { font-size: 20px; font-weight: 600; line-height: 26px; }
  h3 { font-size: 16px; font-weight: 600; line-height: 22px; }
  small, .text-small { font-size: 12px; line-height: 18px; }
}

@layer components {
  /* Botón primario */
  .btn-primary {
    @apply bg-emerald-200 text-gray-800 font-semibold px-4 py-2 rounded-lg
           hover:bg-emerald-300 transition-colors duration-200
           focus:outline-none focus:ring-2 focus:ring-teal-400 focus:ring-offset-2;
  }

  /* Botón secundario */
  .btn-secondary {
    @apply bg-white border-2 border-gray-700 text-gray-700 font-semibold px-4 py-2 rounded-lg
           hover:bg-gray-50 transition-colors duration-200
           focus:outline-none focus:ring-2 focus:ring-gray-700 focus:ring-offset-2;
  }

  /* Botón peligro/destructivo */
  .btn-danger {
    @apply bg-red-600 text-white font-semibold px-4 py-2 rounded-lg
           hover:bg-red-700 transition-colors duration-200
           focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2;
  }

  /* Boton Google Sign In (siguiendo guias de branding de Google) */
  .btn-google {
    @apply flex items-center justify-center gap-3
           w-full py-3 px-4
           bg-white border border-gray-300 rounded-lg
           text-gray-700 font-medium
           hover:bg-gray-50 hover:shadow-sm
           transition-all duration-200
           focus:outline-none focus:ring-2 focus:ring-gray-300 focus:ring-offset-2;
  }

  .btn-google:disabled,
  .btn-google.loading {
    @apply opacity-60 pointer-events-none;
  }

  /* Tarjeta glass */
  .card-glass {
    @apply backdrop-blur-sm rounded-xl shadow-sm;
    background-color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  /* Tarjeta sólida */
  .card-solid {
    @apply bg-white rounded-xl shadow-sm border border-gray-100;
  }

  /* Input estilo Talio */
  .input-talio {
    @apply w-full px-4 py-3 border border-gray-200 rounded-lg text-gray-600
           placeholder-gray-400 bg-white
           focus:outline-none focus:ring-2 focus:ring-teal-400 focus:border-teal-400
           transition-colors duration-200;
  }

  /* Input valido */
  .input-talio-valid {
    @apply border-teal-400 focus:ring-teal-400;
  }

  /* Input invalido */
  .input-talio-invalid {
    @apply border-red-400 focus:ring-red-400;
  }

  /* Mensaje de error inline */
  .field-error {
    @apply text-sm text-red-500 mt-1;
  }

  /* Label estilo Talio */
  .label-talio {
    @apply block text-sm font-medium text-gray-600 mb-1;
  }

  /* Títulos */
  .heading-display {
    font-family: 'DM Sans', 'Inter', system-ui, sans-serif;
    @apply font-semibold text-gray-800;
  }

  /* Badges */
  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
  }

  .badge-pending { @apply bg-gray-100 text-gray-700; }
  .badge-active { @apply bg-teal-100 text-teal-700; }
  .badge-success { @apply bg-emerald-100 text-emerald-700; }
  .badge-error { @apply bg-red-100 text-red-700; }

  /* Animaciones para notificaciones toast */
  .animate-slide-in {
    animation: slide-in 0.3s ease-out;
  }

  .animate-slide-out {
    animation: slide-out 0.3s ease-in forwards;
  }
}

@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Utilidades para colores Talio (usando clases estándar de Tailwind) */
/*
  Mapeo de colores:
  talio-primary -> gray-700/gray-800
  talio-hope -> teal-500/teal-600
  talio-progress -> emerald-200/emerald-300
  talio-surface -> gray-50
  talio-text -> gray-600
  talio-error -> red-500
  talio-warning -> amber-500
  talio-info -> blue-500
*/

/* Animacion de confetti para celebracion de onboarding */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Tooltip styles */
.tooltip-content {
  @apply absolute z-50 px-3 py-2 text-sm text-white bg-gray-800 rounded-lg shadow-lg;
  @apply max-w-xs whitespace-normal;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
}

.tooltip-content::after {
  content: '';
  @apply absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}
