@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;700;800&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Facebook-like shimmer skeleton */
.fb-shimmer {
  position: relative;
  overflow: hidden;
}
.fb-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  /* Stronger highlight for better visibility */
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.85) 35%,
    rgba(255,255,255,0.97) 50%,
    rgba(255,255,255,0.85) 65%,
    rgba(255,255,255,0) 100%
  );
  animation: fb-shimmer 1.4s ease-in-out infinite;
}
@keyframes fb-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Custom animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* CSS-only hover tooltip for dice button */
.hover-tooltip {
  /* Don't add position: relative here as it affects absolute positioning */
}

.hover-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
  pointer-events: none; /* Prevent tooltip from interfering with hover */
}

.hover-tooltip::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: black;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
  pointer-events: none; /* Prevent tooltip from interfering with hover */
}

.hover-tooltip:hover::after,
.hover-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* CSS-only hover tooltip for MessageTile icons - positioned above the MessageTile UI */
.hover-tooltip-messagetile {
    position: relative;
}

.hover-tooltip-messagetile::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: black;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
    pointer-events: none;
}

.hover-tooltip-messagetile::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: black;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
    pointer-events: none;
}

.hover-tooltip-messagetile:hover::after,
.hover-tooltip-messagetile:hover::before {
    opacity: 1;
    visibility: visible;
}


@layer base {
  body {
    font-family: '', sans-serif;
    /**Can use Archivo**/
    letter-spacing: 0.01em;
  }
}

@layer components {
  .neo-border {
    @apply border-4 border-black rounded-xl;
    box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
  }

  .neo-button {
    @apply neo-border bg-black text-white px-4 py-2 font-bold text-base transition-all;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
    }

    &:active {
      transform: translateY(0px);
      box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
    }
  }

  .neo-button:disabled {
    @apply bg-gray-300 cursor-not-allowed;
    transform: translateY(0);
    box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
  }

  .neo-button-secondary {
    @apply neo-border bg-white text-black px-4 py-2 font-bold text-base transition-all;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 1);
    }

    &:active {
      transform: translateY(0px);
      box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1);
    }
  }

  .neo-input:disabled {
    @apply bg-gray-50 cursor-not-allowed;
  }

  .neo-input {
    @apply neo-border bg-white px-4 py-2 text-base focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2;
  }

  /* Custom select styling */
  select.neo-input {
    @apply cursor-pointer bg-none;
  }

  select.neo-input option {
    @apply py-2 px-4 min-h-[40px] flex items-center;
  }

  /* Remove default select arrow in modern browsers */
  select.neo-input::-ms-expand {
    display: none;
  }

  @supports (-webkit-appearance: none) or (-moz-appearance: none) {
    select.neo-input {
      -webkit-appearance: none;
      -moz-appearance: none;
    }
  }

  .message-bubble {
    @apply neo-border p-4 mb-4 break-words;
  }

  .message-bubble-user {
    @apply message-bubble bg-white ml-auto w-fit max-w-[95%] md:max-w-[70%];
  }

  .message-bubble-ai {
    @apply message-bubble bg-[#39FF14]/20 w-fit max-w-[95%] md:max-w-[75%];
  }
}