/**
 * EN: Global Styles with Tailwind CSS 4
 * VI: Styles toàn cục với Tailwind CSS 4
 *
 * Import theme variables first, then Tailwind CSS 4
 * Import các biến theme trước, sau đó là Tailwind CSS 4
 */
@import "../styles/theme.css";
@import "tailwindcss";

/**
 * EN: Base Styles
 * VI: Styles cơ bản
 */
@layer base {
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: var(--font-light);
    line-height: var(--leading-relaxed);
    transition: background-color var(--duration-normal) var(--ease-in-out),
      color var(--duration-normal) var(--ease-in-out);
  }

  /**
   * EN: Smooth transitions for theme switching
   * VI: Chuyển đổi mượt mà cho việc chuyển theme
   */
  *,
  *::before,
  *::after {
    transition: background-color var(--duration-normal) var(--ease-in-out),
      color var(--duration-normal) var(--ease-in-out),
      border-color var(--duration-normal) var(--ease-in-out);
  }

  /**
   * EN: Focus indicators for keyboard navigation (WCAG 2.1 AA)
   * VI: Chỉ báo focus cho điều hướng bàn phím (WCAG 2.1 AA)
   */
  *:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
  }

  /**
   * EN: Skip link styles (screen reader only until focused)
   * VI: Styles cho skip link (chỉ screen reader cho đến khi focus)
   */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }

  .sr-only:focus,
  .sr-only:focus-visible {
    position: fixed;
    width: auto;
    height: auto;
    padding: inherit;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  /**
   * EN: Ensure minimum font size for accessibility (16px) - WCAG 2.1 AA
   * VI: Đảm bảo kích thước font tối thiểu cho accessibility (16px) - WCAG 2.1 AA
   */
  body {
    font-size: 16px;
  }
}

/**
 * EN: Message bubble fade-in animation
 * VI: Animation fade-in cho message bubble
 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/**
 * EN: Floating Animation
 * VI: Animation lơ lửng
 */
@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-15px);
  }

  100% {
    transform: translateY(0px);
  }
}

/**
 * EN: Mesh Gradient Animation
 * VI: Animation Mesh Gradient
 */
@keyframes mesh-move {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }

  33% {
    transform: translate(10%, 15%) scale(1.2) rotate(120deg);
  }

  66% {
    transform: translate(-10%, 10%) scale(0.8) rotate(240deg);
  }

  100% {
    transform: translate(0, 0) scale(1) rotate(360deg);
  }
}

/**
 * EN: Shimmer animation
 * VI: Animation shimmer
 */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/**
 * EN: Utilities Layer
 * VI: Layer Utilities
 */
@layer utilities {
  .animate-fadeIn {
    animation: fadeIn 1s var(--ease-spring) forwards;
  }

  .animate-float {
    animation: float 6s var(--ease-in-out) infinite;
  }

  .mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -20;
    background: var(--bg-primary);
    overflow: hidden;
    transition: background-color var(--duration-slow) var(--ease-in-out);
  }

  .mesh-spot {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    mix-blend-mode: soft-light;
    animation: mesh-move 30s infinite linear;
    will-change: transform;
  }

  .text-glow {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  }

  .text-brand-glow {
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.6);
  }

  .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    transition: all var(--duration-normal) var(--ease-in-out);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  }

  .glass-card:hover {
    background: var(--glass-bg-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-brand-lg);
  }

  .animate-shimmer {
    animation: shimmer 2s infinite;
  }

  .container-responsive {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  @media (min-width: 640px) {
    .container-responsive {
      max-width: 640px;
    }
  }

  @media (min-width: 768px) {
    .container-responsive {
      max-width: 768px;
      padding-left: 1.5rem;
      padding-right: 1.5rem;
    }
  }

  @media (min-width: 1024px) {
    .container-responsive {
      max-width: 1024px;
      padding-left: 2rem;
      padding-right: 2rem;
    }
  }

  @media (min-width: 1280px) {
    .container-responsive {
      max-width: 1280px;
    }
  }

  .text-responsive-hero {
    font-size: 2.5rem;
    line-height: 1.1;
  }

  @media (min-width: 768px) {
    .text-responsive-hero {
      font-size: 3.75rem;
    }
  }

  .btn-touch {
    min-height: 44px;
    min-width: 44px;
  }
}