/* SUGERENCIAS DE BUSQUEDA */
.search-bar-container {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto 2rem;
  display: block;
  z-index: 10000;
}
.search-bar-container input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  font-size: 1.1rem;
  padding: 1rem 3rem 1rem 3rem;
  border-radius: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  color: #fff;
  transition: all 0.3s;
}

.search-bar-container input[type="search"]::placeholder {
  color: rgba(255,255,255,0.7);
}

.search-bar-container input[type="search"]:focus {
  outline: none;
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.search-bar-container .search-reset {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  display: none;
  z-index: 25;
  transition: all 0.2s;
}

.search-bar-container .search-reset:hover {
  background: rgba(255,255,255,0.3);
}

/* ============================================================
   HOME HERO SECTION
   ============================================================ */
.home-hero {
  position: relative;
  padding: 4rem 2rem;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2rem;
  overflow: hidden;
  min-height: 450px;
  contain: layout style paint;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  margin: 0 0 1.5rem;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hero-gradient {
  background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle-line {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  color: rgba(255,255,255,0.95);
}

.hero-description {
  margin: 0 0 2.5rem;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255,255,255,0.9);
  line-height: 1.6;
}

.hero-description strong {
  color: #fff;
  font-weight: 700;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.2);
  min-width: 140px;
  transition: all 0.3s;
}

.stat-box:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-4px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.5rem;
  font-weight: 600;
}

.categories-heading {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 3rem 0 1.5rem;
  background: linear-gradient(90deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 768px) {
  .home-hero {
    padding: 3rem 1.5rem;
    border-radius: 1.5rem;
  }
  
  .hero-stats {
    gap: 1rem;
  }
  
  .stat-box {
    padding: 1rem 1.5rem;
    min-width: 100px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
}

.search-bar-container #search-suggestions {
  background: var(--bg-elevated, #181a20);
  border: 1px solid var(--accent-color, #4f46e5);
  border-radius: 0.7rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 0.7rem;
  margin-top: 4px;
  color: var(--text-color, #e5e7eb);
  font-size: 1rem;
  width: 100%;
  left: 0;
  right: 0;
  position: absolute;
  top: 100%; /* sit directly below the input */
  box-sizing: border-box;
  z-index: 9999;
  max-height: 400px;
  overflow-y: auto;
}

.search-suggestion-item {
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  margin-bottom: 0.3rem;
  transition: background 0.15s;
}
.search-suggestion-item a {
  color: var(--text-color, #e5e7eb);
  text-decoration: none;
  display: block;
}
.search-suggestion-item:hover, .search-suggestion-item a:hover {
  background: var(--accent-soft, #4f46e51a);
}
.search-suggestion-item strong {
  color: var(--accent-color, #4f46e5);
  font-weight: 700;
  font-size: 1.08em;
}
.search-suggestion-item span {
  display: inline-block;
  margin-top: 3px;
}
/* ============================================================
   RESET BÁSICO
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
}

/* ============================================================
   VARIABLES Y TEMAS
   ============================================================ */

:root {
  --bg-color: #050608;
  --bg-elevated: #0d1017;
  --header-bg: #050608ee;
  --footer-bg: #050608;
  --accent-color: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.15);
  --border-color: #202436;
  --text-color: #e5e7eb;
  --text-muted: #9ca3af;
}

/* Tema por defecto */
body.theme-default {
  --accent-color: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.15);
}

/* Tema matemáticas */
body.theme-math {
  --accent-color: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.15);
}

/* Tema imágenes / PDF */
body.theme-image {
  --accent-color: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.15);
}

/* Tema texto / SEO */
body.theme-text {
  --accent-color: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.15);
}

/* Tema dev */
body.theme-dev {
  --accent-color: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.15);
}

/* Tema código */
body.theme-code {
  --accent-color: #06b6d4;
  --accent-soft: rgba(6, 182, 212, 0.15);
}

/* Tema productividad */
body.theme-productivity {
  --accent-color: #a855f7;
  --accent-soft: rgba(168, 85, 247, 0.15);
}

/* ============================================================
   LAYOUT GENERAL
   ============================================================ */

.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HEADER + NAVBAR
   ============================================================ */

.layout-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: linear-gradient(
    to bottom,
    var(--header-bg),
    rgba(5, 6, 8, 0.6),
    transparent
  );
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Marca */

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--accent-color);
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
}

.brand-name {
  font-weight: 700;
  color: #f9fafb;
  letter-spacing: 0.03em;
  font-size: 1.05rem;
}

/* NAVBAR con dropdown */

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
}

/* link principal de categoría */
.nav-trigger {
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: 0.15s ease-in-out;
}

.nav-trigger::after {
  content: "▾";
  font-size: 0.65rem;
  opacity: 0.8;
}

.nav-trigger:hover {
  color: #f9fafb;
  border-color: rgba(148, 163, 184, 0.4);
  background-color: rgba(15, 23, 42, 0.9);
}

@media (max-width: 640px) {
  .nav-trigger::after {
    transition: transform 0.3s ease;
  }

  .nav-item.nav-open .nav-trigger::after {
    transform: rotate(180deg);
  }
}

/* Dropdown */

.nav-dropdown {
  position: absolute;
  top: 100%;              /* pegado justo debajo del trigger */
  left: 0;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 60;
}

.dropdown-inner {
  background-color: var(--bg-elevated);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  padding: 0.4rem 0.35rem;
  margin-top: 0.25rem;    /* separa visualmente pero sin hueco fuera del hover */
}

.dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dropdown-item {
  margin: 0;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: 0.55rem;
  text-decoration: none;
  font-size: 0.83rem;
  color: var(--text-muted);
  transition: 0.12s ease-in-out;
}

.dropdown-link:hover {
  background-color: rgba(15, 23, 42, 0.95);
  color: #f9fafb;
}

.dropdown-link.is-active {
  background-color: var(--accent-soft);
  color: #f9fafb;
}

/* Mostrar dropdown */
.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Versión móvil mejorada */
@media (max-width: 768px) {
  .layout-header {
    position: sticky;
    top: 0;
  }

  .header-inner {
    padding: 0.75rem 1rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .main-nav {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .main-nav::-webkit-scrollbar {
    height: 3px;
  }

  .main-nav::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 2px;
  }

  .nav-link {
    white-space: nowrap;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
  }

  .nav-item {
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .main-nav {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    max-height: none;
    overflow-y: visible;
    padding-bottom: 0;
  }

  .nav-item {
    width: 100%;
  }

  .nav-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
  }

  .nav-dropdown {
    position: static;
    transform: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0s 0.3s;
    margin-top: 0;
  }

  .nav-item.nav-open .nav-dropdown {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0s;
  }

  .dropdown-inner {
    box-shadow: none;
    border-radius: 0.5rem;
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 0.25rem;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
  }

  .dropdown-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* ============================================================
   MAIN / CONTENIDO
   ============================================================ */

.layout-main {
  flex: 1;
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

@media (max-width: 768px) {
  .page-container {
    padding: 1.25rem 1rem 2rem;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 1rem 0.75rem 1.5rem;
  }
}

/* Cabecera de cada página/herramienta */

.page-header {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 1rem;
  background: radial-gradient(circle at top left, var(--accent-soft), transparent);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.page-title {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f9fafb;
}

.page-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Contenedor del contenido principal */

.page-content {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: var(--bg-elevated);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

/* Wrapper genérico para una herramienta */

.tool-card {
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 1.25rem;
  background-color: #020617;
}

@media (max-width: 768px) {
  .tool-card {
    padding: 1rem;
    border-radius: 0.75rem;
  }
}

@media (max-width: 480px) {
  .tool-card {
    padding: 0.85rem;
    border-radius: 0.6rem;
  }
}

/* ============================================================
   FOOTER
   ============================================================ */

.layout-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  background-color: var(--footer-bg);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .footer-links {
    justify-content: center;
  }
}

.footer-copy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: 0.15s;
}

.footer-links a:hover {
  color: #e5e7eb;
  border-bottom-color: rgba(148, 163, 184, 0.6);
}

/* ============================================================
   HERO FEATURES SECTION (SEO Optimized)
   ============================================================ */

.hero-features {
  margin: 2rem 0 3rem;
  padding: 2.5rem;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), rgba(59, 130, 246, 0.05));
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.feature-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  padding: 1.75rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(22, 163, 74, 0.3);
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.15);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.feature-card:nth-child(1) .feature-icon { animation-delay: 0s; }
.feature-card:nth-child(2) .feature-icon { animation-delay: 0.2s; }
.feature-card:nth-child(3) .feature-icon { animation-delay: 0.4s; }
.feature-card:nth-child(4) .feature-icon { animation-delay: 0.6s; }

.feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.75rem;
}

.feature-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ============================================================
   FAQ SECTION (SEO & Schema Optimized)
   ============================================================ */

.faq-section {
  margin: 3rem 0;
  padding: 2.5rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.faq-heading {
  font-size: 2rem;
  font-weight: 800;
  color: #f1f5f9;
  text-align: center;
  margin: 0 0 2rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.faq-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 600px;
}

.faq-item {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 0.875rem;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.faq-item[open] {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.faq-question {
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b82f6;
  transition: transform 0.3s;
}

.faq-item[open] .faq-question::after {
  transform: rotate(45deg);
}

.faq-question:hover {
  color: #3b82f6;
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-answer p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ============================================================
   POPULAR TOOLS SECTION
   ============================================================ */

.popular-tools {
  margin: 3rem 0 2rem;
  padding: 2.5rem;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(249, 115, 22, 0.05));
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.popular-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: #f1f5f9;
  text-align: center;
  margin: 0 0 2rem;
}

.categories-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, #16a34a, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  min-height: 200px;
}

.popular-tool {
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 0.875rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 120px;
  will-change: transform;
}

.popular-tool:hover {
  transform: translateY(-4px);
  border-color: rgba(236, 72, 153, 0.3);
  box-shadow: 0 12px 32px rgba(236, 72, 153, 0.15);
}

.popular-tool strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  display: block;
}

.popular-tool span {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================
   SEARCH FORM (HOME)
   ============================================================ */
.site-search-form {
  margin: 1.25rem 0 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(12px);
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 0.75rem;
}
.site-search-form:focus-within {
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
#site-search {
  flex: 1;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 0.95rem;
  padding: 0.5rem;
  outline: none;
}
#site-search::placeholder { color: #94a3b8; }
.search-reset {
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.3);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  transition: .2s;
}
.search-reset:hover { background: rgba(148,163,184,0.3); }
.search-help { display:none; }
.category-card.is-hidden { display:none !important; }
.visually-hidden { position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; white-space:nowrap !important; border:0 !important; }

/* Skip link */
.skip-link {
  position:absolute;
  top:-40px;
  left:0;
  background:#1e40af;
  color:#fff;
  padding:0.5rem 1rem;
  z-index:10000;
  border-radius:0 0 .5rem .5rem;
  font-weight:600;
  transition:top .25s;
}
.skip-link:focus { top:0; }

@media (max-width:640px) {
  .site-search-form { flex-direction: row; }
  
  .categories-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .category-card {
    padding: 1.5rem;
  }
  
  .category-title {
    font-size: 1.5rem;
  }
  
  .tool-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
  
  .tool-buttons {
    width: 100%;
    justify-content: stretch;
  }
  
  .tool-button {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .hero-features,
  .faq-section,
  .popular-tools {
    padding: 1.5rem;
    margin: 2rem 0;
  }
  
  .feature-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .faq-heading,
  .popular-heading,
  .categories-heading {
    font-size: 1.5rem;
  }
  
  .popular-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   CATEGORÍAS EN HOME — VERSIÓN MEJORADA (título con gradiente)
   ============================================================ */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  min-height: 400px;
}

/* Tarjeta base de categoría */
.category-card {
  position: relative;
  border-radius: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(30, 35, 45, 0.8) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 250px;
  will-change: transform;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--cat-accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  border-color: var(--cat-accent);
  contain: layout style paint;
}

.category-card:hover::before {
  opacity: 1;
}

/* Colores específicos de categoría */
.category-card.theme-math   { --cat-accent: #16a34a; }
.category-card.theme-image  { --cat-accent: #f97316; }
.category-card.theme-text   { --cat-accent: #ec4899; }
.category-card.theme-dev    { --cat-accent: #22c55e; }
.category-card.theme-code   { --cat-accent: #06b6d4; }
.category-card.theme-productivity { --cat-accent: #a855f7; }

/* ------------------ CABECERA ------------------ */

.category-header {
  margin-bottom: 1.5rem;
  position: relative;
}

/* Etiqueta ("MATEMÁTICAS", "IMÁGENES", etc.) */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: var(--cat-accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.category-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background-color: #fff;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.9); }
}

/* ----------- TÍTULO CON GRADIENTE MEJORADO ----------- */

.category-title {
  margin: 1rem 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--cat-accent) 0%, rgba(255,255,255,0.9) 50%, var(--cat-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-description {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ------------------ LISTA DE HERRAMIENTAS ------------------ */

.tool-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.tool-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.tool-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--cat-accent);
  transform: translateX(4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.tool-info {
  min-width: 0;
  flex: 1;
}

.tool-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.tool-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ------------------ BOTÓN ABRIR (sin gradiente) ------------------ */

.tool-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  flex-shrink: 0;
  min-width: 110px;
  max-width: 130px;
}

.tool-button {
  flex-shrink: 0;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--cat-accent);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tool-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.tool-button:hover::before {
  left: 100%;
}

.tool-button:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.tool-button:active {
  transform: translateY(0px) scale(0.98);
}

.tool-button-tutorial {
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.2));
  color: #a855f7;
  border: 2px solid rgba(168, 85, 247, 0.5);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-button-tutorial:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(168, 85, 247, 0.3));
  border-color: #a855f7;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .tool-button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    min-height: 44px; /* Touch-friendly */
  }
}

@media (max-width: 480px) {
  .tool-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .tool-buttons {
    margin-top: 0.5rem;
    width: 100%;
  }
  .tool-button,
  .tool-button-tutorial {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}


@media (max-width: 480px) {
  .tool-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-button {
    margin-top: 0.4rem;
  }
}
/* ============================================================
   CONTACTO
   ============================================================ */

.contact-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-block {
  background-color: #0f131c;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.85rem;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.contact-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e5e7eb;
}

.contact-text {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-email {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-color);
  margin: 0.25rem 0 0;
}

.contact-link {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: opacity 0.12s ease;
}

.contact-link:hover {
  opacity: 0.85;
}

/* Responsive */
@media (max-width: 480px) {
  .contact-block {
    padding: 1rem;
  }
}

/* ============================================================
   ESTILOS AVANZADOS PARA HERRAMIENTAS
   ============================================================ */

/* Form Groups Avanzados */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #f9fafb;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  background-color: rgba(15, 23, 42, 0.8);
  color: #f9fafb;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  .form-group input[type="text"],
  .form-group input[type="number"],
  .form-group input[type="email"],
  .form-group input[type="tel"],
  .form-group input[type="url"],
  .form-group textarea,
  .form-group select {
    padding: 0.85rem;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px; /* Touch-friendly */
  }
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="file"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  resize: vertical;
  font-family: 'Courier New', monospace;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f9fafb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Checkboxes y Radios */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: var(--accent-color);
}

.form-group label input[type="checkbox"],
.form-group label input[type="radio"] {
  margin-right: 0.5rem;
}

/* Sliders */
.form-group input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent-color) 0%,
    var(--accent-color) 50%,
    rgba(148, 163, 184, 0.2) 50%,
    rgba(148, 163, 184, 0.2) 100%
  );
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px var(--accent-soft);
}

.form-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

/* Loading & States */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(148, 163, 184, 0.2);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 6, 8, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* Alerts y Notificaciones */
.alert {
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.alert-success {
  background-color: rgba(22, 163, 74, 0.15);
  border-left-color: #10b981;
  color: #10b981;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.15);
  border-left-color: #ef4444;
  color: #ef4444;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.15);
  border-left-color: #f59e0b;
  color: #f59e0b;
}

.alert-info {
  background-color: var(--accent-soft);
  border-left-color: var(--accent-color);
  color: var(--accent-color);
}

/* Cards mejoradas */
.card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.6) 0%, rgba(15, 23, 42, 0.3) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 8px 32px var(--accent-soft);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f9fafb;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: #f9fafb;
}

.tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.result-item {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  word-break: break-all;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-soft));
  transition: width 0.3s ease;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  border-bottom: 1px dashed var(--accent-color);
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.9);
  color: #f9fafb;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 1000;
  animation: slideIn 0.2s ease;
}

/* Code Block */
.code-block {
  background-color: #1a1a1a;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.code-block code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: #10b981;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
  .results-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .results-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }

  .result-value {
    font-size: 1.25rem;
  }

  .card {
    padding: 0.85rem;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* Previene zoom en mobile */
  }

  .page-header {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .tool-card {
    margin-bottom: 1rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .tool-button:active {
    transform: scale(0.96);
  }

  .nav-link:active {
    opacity: 0.7;
  }

  /* Better tap targets */
  button, 
  a,
  .tool-button,
  .nav-link {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Prevent horizontal scroll */
body {
  overflow-x: hidden;
}

/* Smooth scrolling on mobile */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }

  /* Horizontal scroll for wide content */
  .code-block,
  table,
  pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
