@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;

    /* Z-index scale - Talio Design System */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 400;
    --z-popover: 500;
    --z-toast: 600;
    --z-skip-link: 700;
    --z-tour: 9000;
  }

  body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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 */
  /* FE-01: Usar color talio-progress para consistencia de diseño */
  .btn-primary {
    @apply bg-talio-progress text-gray-800 font-semibold px-4 py-2 rounded-lg
           hover:bg-talio-progress/80 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;
  }

  /* Boton LinkedIn Sign In (siguiendo guias de branding de LinkedIn) */
  .btn-linkedin {
    @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-[#0A66C2] focus:ring-offset-2;
  }

  .btn-linkedin:disabled,
  .btn-linkedin.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: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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; }

  /* Badges de estado de candidatura */
  .badge-draft { @apply bg-gray-100 text-gray-700; }
  .badge-ready { @apply bg-amber-100 text-amber-800; }
  .badge-applied { @apply bg-teal-100 text-teal-700; }
  .badge-in-review { @apply bg-emerald-100 text-emerald-800; }
  .badge-interview { @apply bg-blue-100 text-blue-800; }
  .badge-offer { @apply bg-green-100 text-green-800; }

  /* Badges de tipo de documento */
  .badge-cv-base { @apply bg-blue-100 text-blue-800; }
  .badge-cv-adapted { @apply bg-emerald-100 text-emerald-800; }
  .badge-cover-letter { @apply bg-green-100 text-green-800; }

  /* 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;
  }
}

/* Z-index utility classes - Talio Design System */
@layer utilities {
  .z-dropdown { z-index: var(--z-dropdown); }
  .z-sticky { z-index: var(--z-sticky); }
  .z-modal { z-index: var(--z-modal); }
  .z-popover { z-index: var(--z-popover); }
  .z-toast { z-index: var(--z-toast); }
  .z-skip-link { z-index: var(--z-skip-link); }
  .z-tour { z-index: var(--z-tour); }
  .z-tour-backdrop { z-index: calc(var(--z-tour) - 1); }
}

/* 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: var(--z-tour);
  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 px-3 py-2 text-sm text-white bg-gray-800 rounded-lg shadow-lg;
  z-index: var(--z-popover);
  @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;
}

/* Animación suave para paso recién completado */
@keyframes step-complete {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-step-complete {
  animation: step-complete 0.5s ease-out;
}

/* =================================================
   Extension OAuth Callback - Standalone popup page
   ================================================= */

.ext-callback-body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #F7F9FB 0%, #EEF2F6 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ext-callback-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(31, 58, 95, 0.1);
  padding: 40px;
  max-width: 400px;
  text-align: center;
}

.ext-callback-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.ext-callback-icon--success circle { fill: #D4F0DC; stroke: #6FAF9E; }
.ext-callback-icon--success path { stroke: #1F3A5F; }
.ext-callback-icon--error circle { fill: #F5D0D0; stroke: #DC6B6B; }
.ext-callback-icon--error path { stroke: #1F3A5F; }

.ext-callback-card h1 {
  font-size: 24px;
  font-weight: 600;
  color: #1F3A5F;
  margin-bottom: 12px;
}

.ext-callback-card p {
  font-size: 15px;
  color: #4B5563;
  line-height: 1.5;
}

.ext-callback-status {
  margin-top: 20px;
  padding: 12px 16px;
  background: #F7F9FB;
  border-radius: 8px;
  font-size: 13px;
  color: #6B7280;
}

.ext-callback-hint {
  margin-top: 20px;
  font-size: 13px;
  color: #9CA3AF;
}

/* =================================================
   Extension Onboarding - Estados por data-attribute
   ================================================= */

/* Visibilidad de estados controlada por data-extension-onboarding-state */
[data-extension-onboarding-state="idle"] .extension-state-idle { display: block; }
[data-extension-onboarding-state="idle"] .extension-state-polling { display: none; }
[data-extension-onboarding-state="idle"] .extension-state-detected { display: none; }
[data-extension-onboarding-state="idle"] .extension-state-timeout { display: none; }

[data-extension-onboarding-state="polling"] .extension-state-idle { display: none; }
[data-extension-onboarding-state="polling"] .extension-state-polling { display: block; }
[data-extension-onboarding-state="polling"] .extension-state-detected { display: none; }
[data-extension-onboarding-state="polling"] .extension-state-timeout { display: none; }

[data-extension-onboarding-state="detected"] .extension-state-idle { display: none; }
[data-extension-onboarding-state="detected"] .extension-state-polling { display: none; }
[data-extension-onboarding-state="detected"] .extension-state-detected { display: block; }
[data-extension-onboarding-state="detected"] .extension-state-timeout { display: none; }

[data-extension-onboarding-state="timeout"] .extension-state-idle { display: none; }
[data-extension-onboarding-state="timeout"] .extension-state-polling { display: none; }
[data-extension-onboarding-state="timeout"] .extension-state-detected { display: none; }
[data-extension-onboarding-state="timeout"] .extension-state-timeout { display: block; }

/* =================================================
   Extension Onboarding - Animaciones de estados
   ================================================= */

/* Spinner para estado "verificando" extension */
@keyframes extension-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-extension-spin {
  animation: extension-spin 1s linear infinite;
}

/* Animacion de pulso para estado detectado */
@keyframes extension-detected {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.animate-extension-detected {
  animation: extension-detected 0.5s ease-out forwards;
}

/* Animacion de checkmark SVG */
@keyframes checkmark-draw {
  0% { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 0; }
}

.animate-checkmark {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: checkmark-draw 0.4s ease-out 0.2s forwards;
}

/* Animacion de pulso suave para el circulo de exito */
@keyframes success-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111, 175, 158, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(111, 175, 158, 0); }
}

.animate-success-pulse {
  animation: success-pulse 2s ease-in-out;
}

/* Accesibilidad: respetar preferencia de animación reducida */
@media (prefers-reduced-motion: reduce) {
  /* Desactivar animaciones de confetti */
  .confetti-piece {
    animation: none;
    display: none;
  }

  /* Desactivar animación de paso completado */
  .animate-step-complete {
    animation: none;
  }

  /* Desactivar animaciones de slide */
  .animate-slide-in,
  .animate-slide-out {
    animation: none;
  }

  /* Desactivar animaciones de extension onboarding */
  .animate-extension-spin,
  .animate-extension-detected,
  .animate-checkmark,
  .animate-success-pulse {
    animation: none;
  }
  .animate-extension-detected {
    opacity: 1;
    transform: scale(1);
  }
  .animate-checkmark {
    stroke-dashoffset: 0;
  }

  /* Reducir transiciones a instantáneas manteniendo feedback visual mínimo */
  * {
    transition-duration: 0.01ms !important;
  }
}

/* =================================================
   Mini-Tour Extension Onboarding
   ================================================= */

/* Dots del tour - estado inicial */
.mini-tour .tour-dot {
  @apply bg-gray-300 cursor-pointer;
}

.mini-tour .tour-dot:hover {
  @apply bg-gray-400;
}

/* Tour steps - estados controlados por JS pero con fallback CSS */
.mini-tour .tour-step {
  @apply opacity-0 pointer-events-none;
}

/* Paso visible por defecto (paso 0) cuando step=0 */
[data-extension-onboarding-tour-step="0"] .tour-step-0 {
  @apply opacity-100 pointer-events-auto translate-x-0;
}
[data-extension-onboarding-tour-step="0"] .tour-step-1,
[data-extension-onboarding-tour-step="0"] .tour-step-2 {
  @apply opacity-0 pointer-events-none translate-x-4;
}

[data-extension-onboarding-tour-step="1"] .tour-step-1 {
  @apply opacity-100 pointer-events-auto translate-x-0;
}
[data-extension-onboarding-tour-step="1"] .tour-step-0 {
  @apply opacity-0 pointer-events-none -translate-x-4;
}
[data-extension-onboarding-tour-step="1"] .tour-step-2 {
  @apply opacity-0 pointer-events-none translate-x-4;
}

[data-extension-onboarding-tour-step="2"] .tour-step-2 {
  @apply opacity-100 pointer-events-auto translate-x-0;
}
[data-extension-onboarding-tour-step="2"] .tour-step-0,
[data-extension-onboarding-tour-step="2"] .tour-step-1 {
  @apply opacity-0 pointer-events-none -translate-x-4;
}

/* Botones de navegacion - visibilidad segun paso */
[data-extension-onboarding-tour-step="0"] .tour-btn-prev {
  @apply invisible;
}
[data-extension-onboarding-tour-step="0"] .tour-btn-next {
  @apply block;
}
[data-extension-onboarding-tour-step="0"] .tour-btn-finish {
  @apply hidden;
}

[data-extension-onboarding-tour-step="1"] .tour-btn-prev {
  @apply visible;
}
[data-extension-onboarding-tour-step="1"] .tour-btn-next {
  @apply block;
}
[data-extension-onboarding-tour-step="1"] .tour-btn-finish {
  @apply hidden;
}

[data-extension-onboarding-tour-step="2"] .tour-btn-prev {
  @apply visible;
}
[data-extension-onboarding-tour-step="2"] .tour-btn-next {
  @apply hidden;
}
[data-extension-onboarding-tour-step="2"] .tour-btn-finish {
  @apply block;
}

/* Dots activos segun paso - CSS fallback */
[data-extension-onboarding-tour-step="0"] .tour-dot[data-tour-dot="0"] {
  @apply bg-talio-hope w-3;
}
[data-extension-onboarding-tour-step="1"] .tour-dot[data-tour-dot="1"] {
  @apply bg-talio-hope w-3;
}
[data-extension-onboarding-tour-step="2"] .tour-dot[data-tour-dot="2"] {
  @apply bg-talio-hope w-3;
}

/* Transiciones suaves para el tour */
.mini-tour .tour-step {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Accesibilidad: respeta reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .mini-tour .tour-step {
    transition: none;
  }
}

/* =================================================
   Tour educativo - componentes visuales
   ================================================= */

/* Tour overlay con spotlight usando clip-path */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-tour) - 1);
  transition: clip-path 0.3s ease-out;
  /* clip-path se calcula dinamicamente en JS */
}

/* Tooltip flotante */
.tour-tooltip {
  position: fixed;
  z-index: var(--z-tour);
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  max-width: 320px;
  width: max-content;
  padding: 1rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.tour-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Flecha del tooltip */
.tour-tooltip-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  transform: rotate(45deg);
}

/* Posiciones de la flecha */
.tour-tooltip[data-position="top"] .tour-tooltip-arrow {
  bottom: -6px;
  left: 50%;
  margin-left: -6px;
}

.tour-tooltip[data-position="bottom"] .tour-tooltip-arrow {
  top: -6px;
  left: 50%;
  margin-left: -6px;
}

.tour-tooltip[data-position="left"] .tour-tooltip-arrow {
  right: -6px;
  top: 50%;
  margin-top: -6px;
}

.tour-tooltip[data-position="right"] .tour-tooltip-arrow {
  left: -6px;
  top: 50%;
  margin-top: -6px;
}

/* Step counter */
.tour-step-counter {
  font-size: 0.75rem;
  color: #6B7280;
  margin-bottom: 0.5rem;
}

/* Contenido del tooltip */
.tour-tooltip-title {
  font-weight: 600;
  color: #1F3A5F;
  margin-bottom: 0.25rem;
}

.tour-tooltip-description {
  color: #374151;
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* Botones de navegacion del tour */
.tour-tooltip-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tour-btn-primary-overlay {
  background: #B7E4C7;
  color: #1F3A5F;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.tour-btn-primary-overlay:hover {
  background: #9AD9AE;
}

.tour-btn-secondary-overlay {
  background: transparent;
  color: #374151;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #E5E7EB;
  transition: background 0.2s;
}

.tour-btn-secondary-overlay:hover {
  background: #F3F4F6;
}

.tour-btn-skip {
  color: #6B7280;
  font-size: 0.75rem;
  margin-left: auto;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tour-btn-skip:hover {
  color: #374151;
}

/* Focus visible para accesibilidad */
.tour-btn-primary-overlay:focus-visible,
.tour-btn-secondary-overlay:focus-visible,
.tour-btn-skip:focus-visible {
  outline: 2px solid #6FAF9E;
  outline-offset: 2px;
}

/* Responsive: tooltip centrado en movil */
@media (max-width: 640px) {
  .tour-tooltip {
    left: 1rem !important;
    right: 1rem !important;
    bottom: 1rem !important;
    top: auto !important;
    max-width: none;
    width: auto;
  }

  .tour-tooltip-arrow {
    display: none;
  }
}

/* Accesibilidad: reducir animaciones para tour overlay */
@media (prefers-reduced-motion: reduce) {
  .tour-overlay {
    transition: none;
  }

  .tour-tooltip {
    transition: none;
    transform: none;
  }
}

/* =================================================
   Landing Page - Animaciones custom Talio
   ================================================= */

/* Animaciones personalizadas que complementan AOS */
@layer utilities {
  /* Fade up con rebote suave */
  .animate-fade-up {
    animation: fade-up 0.8s ease-out;
  }

  /* Pulse suave para elementos destacados */
  .animate-pulse-soft {
    animation: pulse-soft 2s ease-in-out infinite;
  }

  /* Gradient shimmer para badges */
  .animate-shimmer {
    animation: shimmer 2s linear infinite;
    background-size: 200% 100%;
  }

  /* Float para elementos hero */
  .animate-float {
    animation: float 3s ease-in-out infinite;
  }

  /* Scale in para iconos */
  .animate-scale-in {
    animation: scale-in 0.5s ease-out;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

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

/* Estilos para Lottie player */
dotlottie-player {
  width: 100%;
  height: auto;
}

/* Badge animado "Gratis" / "Sin tarjeta" */
.badge-animated {
  @apply inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-sm font-medium;
  background: linear-gradient(90deg, #B7E4C7 0%, #6FAF9E 50%, #B7E4C7 100%);
  background-size: 200% 100%;
}

.badge-animated.animate-shimmer {
  animation: shimmer 3s linear infinite;
}

/* Heading section mejorado para landing */
.heading-section {
  @apply text-2xl md:text-3xl font-semibold text-talio-primary;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Accesibilidad: desactivar animaciones custom */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-up,
  .animate-pulse-soft,
  .animate-shimmer,
  .animate-float,
  .animate-scale-in {
    animation: none;
  }

  .badge-animated {
    background-size: 100% 100%;
  }

  /* AOS override para reduced motion */
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* =================================================
   Card Swipe - Animaciones
   ================================================= */

/* Animacion de entrada de card */
@keyframes swipe-in-left {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

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

.swipe-card {
  /* Animacion solo para navegacion, no para updates */
}

.swipe-card.animate-in {
  animation: swipe-in-left 0.3s ease-out;
}

.swipe-out-left {
  animation: swipe-out-left 0.2s ease-in forwards;
}

.swipe-out-right {
  animation: swipe-out-right 0.2s ease-in forwards;
}

/* Skeleton loading para card swipe */
.swipe-card-skeleton {
  @apply bg-white rounded-xl shadow-sm border border-gray-100 p-5 space-y-4;
}

.swipe-card-skeleton .skeleton-line {
  @apply h-4 bg-gray-200 rounded animate-pulse;
}

.swipe-card-skeleton .skeleton-circle {
  @apply w-12 h-12 bg-gray-200 rounded-full animate-pulse;
}

/* Animacion fade-in para modales */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in {
  animation: fade-in 0.2s ease-out;
}

/* Animacion briefing items */
@keyframes briefingFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Estilos para teclas de teclado */
.kbd {
  @apply px-1.5 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs font-mono text-gray-700;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.kbd.kbd-dark {
  @apply bg-gray-700 border-gray-600 text-gray-200;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Accesibilidad: reducir animaciones */
@media (prefers-reduced-motion: reduce) {
  .swipe-card,
  .swipe-out-left,
  .swipe-out-right,
  .animate-fade-in {
    animation: none;
  }
}

/* =================================================
   Email Scanning Loading Screen
   ================================================= */

/* Gradiente animado para barra superior */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-gradient {
  animation: gradient-shift 2s ease infinite;
}

/* Barra de progreso indeterminada */
@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
    width: 40%;
  }
  50% {
    width: 60%;
  }
  100% {
    transform: translateX(300%);
    width: 40%;
  }
}

.animate-indeterminate {
  animation: indeterminate 1.5s ease-in-out infinite;
}

/* Accesibilidad: reducir animaciones */
@media (prefers-reduced-motion: reduce) {
  .animate-gradient,
  .animate-indeterminate {
    animation: none;
  }
}

/* =================================================
   Calendario - FullCalendar custom styles
   ================================================= */

@layer components {
  /* Contenedor principal */
  .fc {
    --fc-border-color: var(--color-talio-surface);
    --fc-button-bg-color: var(--color-talio-progress);
    --fc-button-text-color: var(--color-talio-primary);
    --fc-today-bg-color: rgba(183, 228, 199, 0.2);
  }

  /* Eventos con texto blanco */
  .fc-event {
    @apply text-white text-sm;
    border-radius: 4px;
  }

  /* Header del calendario */
  .fc .fc-toolbar-title {
    @apply text-talio-primary font-semibold text-lg;
  }

  /* Dias del mes */
  .fc .fc-daygrid-day-number {
    @apply text-talio-text;
  }

  /* Dia actual */
  .fc .fc-day-today {
    background-color: var(--fc-today-bg-color) !important;
  }

  /* Altura compacta para celdas de mes */
  .fc .fc-daygrid-body-natural .fc-daygrid-day-events {
    margin-bottom: 0;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 80px;
  }

  /* Eventos mas compactos */
  .fc .fc-daygrid-event {
    padding: 2px 4px;
    font-size: 0.75rem;
  }

  /* Indicador "+X mas" compacto */
  .fc .fc-daygrid-more-link {
    font-size: 0.75rem;
    padding: 2px;
  }

  /* =================================================
     Vistas Dia y Semana (timeGrid) - estilo Google Calendar
     ================================================= */

  /* Altura de slots de tiempo mas compacta */
  .fc .fc-timegrid-slot {
    height: 1.5em;
  }

  /* Labels de hora mas compactos */
  .fc .fc-timegrid-slot-label {
    font-size: 0.7rem;
    color: #6B7280;
  }

  /* Eventos en timeGrid mas compactos */
  .fc .fc-timegrid-event {
    border-radius: 4px;
    font-size: 0.75rem;
  }

  .fc .fc-timegrid-event .fc-event-main {
    padding: 2px 4px;
  }

  .fc .fc-timegrid-event .fc-event-time {
    font-size: 0.7rem;
    font-weight: 500;
  }

  .fc .fc-timegrid-event .fc-event-title {
    font-size: 0.75rem;
  }

  /* Header de dias en vista semana mas compacto */
  .fc .fc-col-header-cell {
    padding: 6px 4px;
  }

  .fc .fc-col-header-cell-cushion {
    font-size: 0.8rem;
    font-weight: 500;
  }

  /* Linea de hora actual */
  .fc .fc-timegrid-now-indicator-line {
    border-color: #DC6B6B;
    border-width: 2px;
  }

  .fc .fc-timegrid-now-indicator-arrow {
    border-color: #DC6B6B;
  }

  /* Contenedor del timegrid con altura maxima */
  .fc .fc-timegrid {
    max-height: 600px;
    overflow-y: auto;
  }

  /* Scrollbar estilizado para el timegrid */
  .fc .fc-timegrid::-webkit-scrollbar {
    width: 6px;
  }

  .fc .fc-timegrid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
  }

  .fc .fc-timegrid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }

  .fc .fc-timegrid::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
  }
}
