@import "tailwindcss";

@source "../../../templates/**/*.html";
@source "../../../src/**/*.rs";

@theme {
  --font-inter: "Inter", sans-serif;

  /* Okabe-Ito Color Palette (Color-blind friendly) */
  --color-oi-blue: #0072b2;
  --color-oi-sky-blue: #56b4e9;
  --color-oi-green: #009e73;
  --color-oi-yellow: #f0e442;
  --color-oi-orange: #e69f00;
  --color-oi-vermilion: #d55e00;
  --color-oi-red-purple: #cc79a7;

  /* Semantic mappings to Okabe-Ito */
  --color-accent-primary: var(--color-oi-sky-blue);
  --color-accent-secondary: var(--color-oi-blue);

  /* Dark Glass Theme Variables */
  --color-glass-border: rgba(86, 180, 233, 0.2); /* Sky Blue tint */
  --color-glass-surface: rgba(12, 16, 24, 0.92);
  --color-glass-highlight: rgba(86, 180, 233, 0.15); /* Sky Blue tint */
  --color-surface-strong: rgba(9, 12, 20, 0.96);
  --color-surface-muted: rgba(15, 19, 30, 0.85);

  --animate-float: float 6s ease-in-out infinite;
  --animate-pulse-glow: pulse-glow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;

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

  @keyframes pulse-glow {
    0%,
    100% {
      opacity: 1;
      box-shadow: 0 0 20px rgba(86, 180, 233, 0.4);
    }
    50% {
      opacity: 0.7;
      box-shadow: 0 0 10px rgba(86, 180, 233, 0.2);
    }
  }
}

/* Custom scrollbar utilities */
@utility scrollbar-custom {
  &::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background-color: rgba(86, 180, 233, 0.15);
    border-radius: 9999px;
  }

  &::-webkit-scrollbar-thumb:hover {
    background-color: rgba(86, 180, 233, 0.3);
  }
}

@utility glass-panel {
  background-color: var(--color-glass-surface);
  background-image: linear-gradient(
    135deg,
    rgba(20, 28, 40, 0.9),
    rgba(12, 16, 28, 0.95)
  );
  backdrop-filter: blur(16px);
  --tw-backdrop-blur: blur(16px);
  border: 1px solid var(--color-glass-border);
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 var(--color-glass-highlight);
}

@utility glass-input {
  background-color: rgba(14, 18, 30, 0.8);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(8px);
  --tw-backdrop-blur: blur(8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #e2e8f0;

  &:focus {
    border-color: var(--color-oi-sky-blue);
    background-color: rgba(12, 16, 28, 0.95);
    box-shadow: 0 0 0 2px rgba(86, 180, 233, 0.2);
    outline: none;
  }

  &::placeholder {
    color: rgba(226, 232, 240, 0.4);
  }
}

/* Accessible badge system - WCAG 2.1 AA Compliant */
@utility badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 9999px;
  border-width: 1px;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 0.75rem;
  line-height: 1;
}

@utility badge-strong {
  border-left-width: 4px;
}

/* Success: Bluish Green (#009e73) */
@utility badge-success {
  color: #ffffff; /* White for max contrast */
  background-color: rgba(0, 158, 115, 0.4);
  border-color: var(--color-oi-green);
}

/* Fail: Vermilion (#d55e00) */
@utility badge-fail {
  color: #ffdacc; /* Light tint for text */
  background-color: rgba(213, 94, 0, 0.2);
  border-color: var(--color-oi-vermilion);
}

/* Warn: Orange (#e69f00) - avoiding Yellow for text visibility */
@utility badge-warn {
  color: #ffecd1; /* Light tint for text */
  background-color: rgba(230, 159, 0, 0.2);
  border-color: var(--color-oi-orange);
}

/* Info: Sky Blue (#56b4e9) */
@utility badge-info {
  color: #d1eeff; /* Light tint for text */
  background-color: rgba(86, 180, 233, 0.2);
  border-color: var(--color-oi-sky-blue);
}

/* Critical: Reddish Purple (#cc79a7) */
@utility badge-critical {
  color: #fce1f0; /* Light tint for text */
  background-color: rgba(204, 121, 167, 0.2);
  border-color: var(--color-oi-red-purple);
}

/* Neutral: Gray (using Blue saturated gray for harmony) */
@utility badge-neutral {
  color: #f1f5f9;
  background-color: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.4);
}

/* Table surface */
@utility table-head {
  background: linear-gradient(
    90deg,
    rgba(20, 28, 40, 0.95),
    rgba(12, 16, 28, 0.95)
  );
  border-bottom: 1px solid var(--color-glass-border);
  box-shadow: inset 0 -1px 0 var(--color-glass-highlight);
}

@utility table-head-cell {
  color: var(--color-oi-sky-blue);
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

@utility table-body {
  background: linear-gradient(
    180deg,
    rgba(9, 12, 20, 0.6),
    rgba(7, 10, 16, 0.8)
  );

  & tr:nth-child(even) {
    background-color: rgba(86, 180, 233, 0.03); /* Very subtle sky blue tint */
  }
}

@utility table-row {
  background-color: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

@utility table-row-hover {
  transition: all 0.2s ease;

  &:hover {
    background-color: rgba(86, 180, 233, 0.1);
  }
}

/* Statistics cards */
@utility stat-card {
  background: linear-gradient(
    135deg,
    rgba(20, 28, 40, 0.9),
    rgba(12, 16, 28, 0.95)
  );
  border: 1px solid var(--color-glass-border);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.2s ease;

  &:hover {
    border-color: var(--color-oi-sky-blue);
    box-shadow: 0 4px 20px rgba(86, 180, 233, 0.15);
  }
}

@utility stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  line-height: 1;
}

@utility stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.8);
}

@utility stat-bar {
  height: 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

@utility stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
