@import url("animations.css");
@import url("enhancements.css");
:root {
  /* Colors - Dark Theme (Default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(30, 30, 40, 0.6);
  --bg-card-hover: rgba(40, 40, 55, 0.8);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b7280;
  --border-color: rgba(255, 255, 255, 0.08);

  --primary: #8b5cf6; /* Violet */
  --primary-hover: #7c3aed;
  --secondary: #06b6d4; /* Cyan */
  --accent: #ec4899; /* Pink */

  --header-bg: rgba(10, 10, 15, 0.7); /* Slightly more transparent */

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Vibrant Gaming Palette (Neon) */
  --neon-purple: #a855f7;
  --neon-blue: #3b82f6;
  --neon-pink: #ec4899;
  --neon-cyan: #22d3d8;
  --neon-green: #10b981;
  --neon-orange: #f97316;

  /* Gradients */
  --gradient-main: linear-gradient(
    135deg,
    #0f0f1a 0%,
    #1a1a2e 50%,
    #0f172a 100%
  );
  --gradient-glow: radial-gradient(
    circle at 50% 0%,
    rgba(139, 92, 246, 0.15),
    transparent 70%
  );
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);

  /* Spacing */
  --container-width: 1200px;
  --header-height: 80px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Effects */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

html {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  background: var(--bg-primary); /* Base color in case everything fails */
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* --- Phase A & D: Immersive Backgrounds --- */

/* 1. Cyber Grid (CSS-only animation) */
.cyber-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  perspective: 500px;
  transform: perspective(500px) rotateX(20deg) scale(2); /* Pseudo-3D effect */
  opacity: 0.6;
  pointer-events: none;
  animation: grid-scroll 20s linear infinite;
}

@keyframes grid-scroll {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 50px;
  }
}

/* 2. Particle Canvas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* Behind content, above grid */
  pointer-events: all; /* Allow mouse interaction */
  opacity: 1; /* Allow gradient overlay to tint it if needed */
}

/* Overlay gradient for depth */
.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(
    circle at center,
    transparent 0%,
    var(--bg-primary) 90%
  );
  pointer-events: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

/* Layout */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: var(--glass-border);
  position: relative;
  width: 100%;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  height: 40px;
  width: auto;
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

.logo:hover img {
  transform: scale(1.05);
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 5px;
  z-index: 1001;
}

.profile-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-btn:hover {
  color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
  transform: scale(1.1);
}

nav ul {
  display: flex;
  gap: 15px;
  list-style: none;
  font-size: 0.9rem;
}

nav a {
  font-weight: 500;
  color: var(--text-secondary);
}

nav a:hover,
nav a.active {
  color: var(--text-primary);
}

/* Hero Section */
.hero {
  padding: 80px 0 20px; /* Reduced top from 160px */
  text-align: center;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(139, 92, 246, 0.15),
    transparent 70%
  );
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 10;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 24px;
  background: linear-gradient(to right, #fff, #a0a0b0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeInUp 0.8s ease-out;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Floating Icons Background */
.hero-visuals {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.float-icon {
  position: absolute;
  color: rgba(255, 255, 255, 0.05);
  font-size: 3rem; /* Fallback */
}

.float-icon svg {
  width: 64px;
  height: 64px;
}

/* Search Bar */
.search-container {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0 25px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.search-wrapper:focus-within {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
  width: 550px;
}

.search-wrapper i {
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  transition: color 0.3s;
}

.search-wrapper:focus-within i {
  color: var(--primary);
}

.search-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 1.05rem;
  outline: none;
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
}

.no-results i {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
  opacity: 0.5;
}

/* Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 30px; /* Reduced from 60px */
  padding-top: 25px; /* Reduced from 40px */
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Tool Grid */
/* Tool Grid */
.section-title {
  margin: 20px 0 20px; /* Reduced top from 40px */
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding-bottom: 60px;
}

.tool-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.6);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 0 15px rgba(139, 92, 246, 0.25);
}

.tool-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  box-shadow:
    0 20px 40px -5px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(139, 92, 246, 0.3);
}

.tool-icon {
  width: 48px;
  height: 48px;
  background: color-mix(in srgb, var(--primary), transparent 90%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.5rem;
  box-shadow: 0 0 15px color-mix(in srgb, var(--primary), transparent 85%);
  transition: all 0.3s ease;
}

.tool-card:hover .tool-icon {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 25px var(--primary);
  transform: scale(1.1);
}

.tool-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.tool-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: auto;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  width: fit-content;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Tool Page Specifics */
.tool-container {
  padding: 10px 0 60px;
  max-width: 900px;
  margin: 0 auto;
}

.tool-header {
  text-align: center;
  margin-bottom: 20px;
}

.tool-header .tag {
  display: none !important;
}

.tool-header h1 {
  font-size: 1.8rem;
  margin-bottom: 6px;
  color: #a78bfa;
}

.tool-display-area {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 40px;
}

/* Utility */
.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.d-none {
  display: none !important;
}

/* Dropdown Menus */
.nav ul .has-dropdown {
  position: relative;
}

.nav ul .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 27, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  padding: 10px 0;
  min-width: 160px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.6);
  z-index: 1000;
  flex-direction: column;
  gap: 0;
}

.nav ul .has-dropdown:hover .dropdown-menu {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.nav ul .dropdown-menu li {
  width: 100%;
}

.nav ul .dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

.nav ul .dropdown-menu a:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
  padding-left: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    padding: 0 20px;
  }

  .mobile-menu-toggle {
    display: block;
    z-index: 1002;
  }

  .nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 160px;
    height: calc(100vh - var(--header-height));
    background: #0a0a0f;
    backdrop-filter: none;
    flex-direction: column;
    padding: 30px 25px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    gap: 20px;
    align-items: flex-start;
    overflow-y: auto;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
  }

  .nav.mobile-active {
    transform: translateX(0);
  }

  .nav ul {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .nav ul li {
    width: 100%;
  }

  .nav ul li a {
    display: block;
    font-size: 1rem;
    padding: 12px 15px;
    border-radius: 8px;
    border-bottom: none;
  }

  .nav ul .dropdown-menu {
    display: none !important;
  }
    transition: background 0.2s;
  }

  .nav ul li a:hover {
    background: rgba(139, 92, 246, 0.15);
  }

  .profile-btn {
    margin-left: 0;
    margin-top: 20px;
    width: auto;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    border-bottom: none;
  }

  .hero h1 {
    font-size: 2.5rem;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
}

/* Professional Footer */
footer {
  background: var(--bg-secondary);
  border-top: var(--glass-border);
  padding: 40px 0 20px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-brand p {
  color: var(--text-secondary);
  margin-top: 15px;
  max-width: 300px;
}

.footer-col h4 {
  margin-bottom: 20px;
  color: var(--text-primary);
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 12px;
}

.footer-col a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.social-links {
  display: flex;
  gap: 15px;
}

.social-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.social-links a:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

/* --- Theme Definitions (Global) --- */
.theme-mouse {
  --primary: var(--neon-cyan);
  --primary-hover: #0891b2;
}

.theme-key {
  --primary: var(--neon-green);
  --primary-hover: #059669;
}

.theme-memory {
  --primary: var(--neon-blue);
  --primary-hover: #2563eb;
}

.theme-visual {
  --primary: var(--neon-orange);
  --primary-hover: #ea580c;
}

.theme-game {
  --primary: var(--neon-pink);
  --primary-hover: #db2777;
}

/* Theme Stats Glow */
.theme-mouse .stat-value {
  text-shadow: 0 0 10px rgba(34, 211, 216, 0.3);
}
.theme-key .stat-value {
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.theme-memory .stat-value {
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.theme-game .stat-value {
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

/* Header Profile Button */
.profile-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 20px;
  transition: all 0.2s;
}
.profile-btn:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 10px var(--primary);
}

/* --- Hero Animations (Phase 4) --- */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.type-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background-color: var(--primary);
  margin-left: 5px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

.floating-icons-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.float-icon {
  position: absolute;
  color: rgba(139, 92, 246, 0.1); /* Subtle purple tint */
  opacity: 0;
  will-change: transform;
  animation-name: floatUp;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.float-icon svg {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.2));
}

@keyframes floatUp {
  0% {
    transform: translateY(120%) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-120%) rotate(180deg) scale(1.2);
    opacity: 0;
  }
}

/* Related Tools Specific */
.related-tools-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

@media (min-width: 900px) {
  .related-tools-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

.related-tools-grid .tool-card {
  padding: 20px;
  gap: 12px;
}

.related-tools-grid .tool-icon {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
}

.related-tools-grid h3 {
  font-size: 1.1rem !important;
  margin-bottom: 4px;
}

.related-tools-grid p {
  font-size: 0.85rem !important;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
