@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

@layer base {
  :root {
    --surface-base: #fbfbfd;
    --surface-subtle: #f5f5f7;
    --surface-elevated: #ffffff;
    --surface-border: #e5e5e7;
    --surface-border-strong: #d2d2d7;
    --surface-shadow-rgb: 0 0 0;
    --surface-hover-overlay: 0.04;
    --surface-active-overlay: 0.08;
  }

  * {
    border-color: rgba(0, 0, 0, 0.08);
  }

  html {
    @apply scroll-smooth antialiased;
  }

  body {
    @apply font-sans text-ink-900;
    background:
      radial-gradient(120% 100% at 10% 0%, rgba(59, 130, 246, 0.06), transparent 70%),
      radial-gradient(120% 140% at 90% 10%, rgba(59, 130, 246, 0.04), transparent 75%),
      radial-gradient(100% 100% at 50% 100%, rgba(37, 99, 235, 0.03), transparent 60%),
      linear-gradient(180deg, #ffffff, var(--surface-base) 30%, #ffffff 70%);
    min-height: 100vh;
  }

  h1, h2, h3, h4, h5, h6 {
    @apply font-semibold text-ink-900;
  }
}

@layer components {
  .card-hover {
    @apply transition-all duration-300 ease-out hover:shadow-soft hover:-translate-y-0.5;
    background-image: linear-gradient(
      180deg,
      transparent 0%,
      rgb(var(--surface-shadow-rgb) / var(--surface-hover-overlay)) 100%
    );
    background-size: 100% 200%;
    background-position: top;
  }

  .bug-card {
    @apply relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06),
      0 1px 3px rgba(0, 0, 0, 0.04),
      0 0 0 0.5px rgba(0, 0, 0, 0.06);
    transition:
      transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
      box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
      opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
      border-color 0.3s ease-out;
  }

  .bug-card--new {
    @apply relative overflow-hidden;
    animation: gentleAppear 0.5s ease-out;
  }

  .bug-card--new::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
    z-index: 2;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    transform: scaleY(1);
    transform-origin: center;
  }

  .bug-card--new::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      90deg,
      rgba(59, 130, 246, 0.04) 0%,
      rgba(59, 130, 246, 0.02) 30%,
      transparent 100%
    );
    opacity: 1;
    z-index: 1;
    transition: opacity 0.4s ease-out;
    pointer-events: none;
  }

  .bug-card--reading {
    transform: none;
  }

  .bug-card--reading::before {
    opacity: 0.3;
    transform: scaleY(0.8);
  }

  .bug-card--reading::after {
    opacity: 0;
  }

  .bug-card:hover {
    transform: translateY(-2px) scale(1.008);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12),
      0 4px 12px rgba(0, 0, 0, 0.08),
      0 0 0 0.5px rgba(0, 0, 0, 0.1);
    background-position: bottom;
    border-color: rgba(0, 0, 0, 0.12);
  }

  .stagger-animation {
    animation: staggerFadeIn 0.5s ease-out both;
  }
}

@keyframes gentleAppear {
  0% {
    opacity: 0;
    transform: translateX(-8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes staggerFadeIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

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

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.button-glow:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.bug-card:focus-within {
  @apply outline-none ring-2 ring-primary-500/30 ring-offset-2 ring-offset-white;
  transition: all 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.button-ripple {
  position: relative;
  overflow: hidden;
}

.button-ripple::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
}

.button-ripple:active::after {
  animation: ripple 0.6s ease-out;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23676d96' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  padding-right: 2.5rem;
}

select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%233b82f6' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

select option {
  background: white;
  color: #353a60;
  padding: 0.625rem 1rem;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .bug-card,
  .bug-card::before,
  .bug-card::after {
    transition: none !important;
    animation: none !important;
  }
}
