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

@layer components {
  .link {
    /* underline text-blue-500 hover:text-blue-800 */
    @apply underline text-blue-500 hover:text-blue-800;
  }

  .tag {
    @apply inline-flex items-center px-2 text-xs font-medium py-0.5 rounded lg:rounded-full;
  }

  .btn-primary {
    @apply shadow-xl text-center inline-flex justify-center items-center gap-2 rounded-lg bg-indigo-600 p-4 text-base font-semibold text-white hover:bg-indigo-700 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 active:text-white/70 transition-colors;
  }

  /* BGG-style rating colors */
  .bgg-rating-box {
    @apply inline-block px-3 py-2 rounded text-white font-bold text-center min-w-[4rem];
  }

  .has-rating-0 {
    background-color: #666e75 !important;
  }

  .has-rating-1,
  .has-rating-2 {
    background-color: #b2151f !important;
  }

  .has-rating-3,
  .has-rating-4 {
    background-color: #d71925 !important;
  }

  .has-rating-5,
  .has-rating-6 {
    background-color: #5369a2 !important;
  }

  .has-rating-7 {
    background-color: #1978b3 !important;
  }

  .has-rating-8 {
    background-color: #1d804c !important;
  }

  .has-rating-9,
  .has-rating-10 {
    background-color: #186b40 !important;
  }

  /* BGG-style weight colors */
  .bgg-weight-box {
    @apply inline-block px-3 py-2 rounded font-bold text-center min-w-[4rem];
  }

  .gameplay-weight-light {
    background-color: #19693f !important;
    color: white !important;
  }

  .gameplay-weight-medium {
    background-color: #b33900 !important;
    color: white !important;
  }

  .gameplay-weight-heavy {
    background-color: #ac141e !important;
    color: white !important;
  }
}

/* Baukasten fuer das neue Design ("Regelheft"), nutzbar in ERB und Slim.
   Groessere Bausteine sind ViewComponents unter app/components. */
@layer components {
  .ui-container {
    @apply mx-auto w-full max-w-[1240px] px-6;
  }

  .ui-page {
    @apply mx-auto w-full max-w-[1240px] px-6 pb-20 pt-14;
  }

  .ui-card {
    @apply rounded-[18px] border-2 border-ink bg-white p-6 shadow-hard;
  }

  .ui-btn {
    @apply inline-flex min-h-[48px] cursor-pointer items-center justify-center gap-2 rounded-xl border-2 border-ink px-5 font-bold transition-colors;
  }
  .ui-btn-primary {
    @apply ui-btn bg-ink text-paper hover:bg-petrol hover:border-petrol;
  }
  .ui-btn-secondary {
    @apply ui-btn bg-white text-ink hover:bg-paper;
  }
  .ui-btn-accent {
    @apply ui-btn bg-mustard text-ink shadow-hard-sm hover:-translate-y-0.5;
  }

  .ui-label {
    @apply block text-[15px] font-bold text-ink;
  }
  .ui-hint {
    @apply mt-1 text-sm text-muted;
  }
  .ui-input {
    @apply mt-1.5 block w-full rounded-xl border-2 border-ink bg-white px-3.5 py-2.5 text-ink placeholder:text-[#9A8F80] focus:border-petrol focus:ring-2 focus:ring-petrol/30;
  }

  .ui-notice {
    @apply rounded-xl border-2 border-ink bg-white px-4 py-3 text-[15px];
  }
  .ui-notice-info {
    @apply ui-notice bg-[#FBEFD1];
  }
  .ui-notice-error {
    @apply ui-notice border-coral bg-[#FBE3DC];
  }

  .ui-segmented {
    @apply inline-flex gap-1 rounded-full border-2 border-ink bg-white p-1;
  }
  .ui-segment {
    @apply inline-flex min-h-[40px] items-center rounded-full px-4 text-[15px] font-bold text-ink hover:bg-paper;
  }
  .ui-segment-active {
    @apply ui-segment bg-ink text-paper hover:bg-ink;
  }

  .ui-table {
    @apply w-full border-collapse text-left text-[15px];
  }
  .ui-table th {
    @apply border-b-2 border-ink px-3 py-3 text-xs font-extrabold uppercase tracking-[0.1em] text-muted;
  }
  .ui-table td {
    @apply border-b border-line px-3 py-2.5 align-middle;
  }
  .ui-table tbody tr:hover td {
    @apply bg-paper;
  }
}

/* Sprungmarken (/#faq usw.) nicht unter dem klebenden Header verstecken */
@layer base {
  section[id] {
    scroll-margin-top: 7rem;
  }
}
