/* ============================================================
   UTILITY HUB - Sistema de Diseño Premium
   Basado en: Psicología del Color, Glassmorphism, Mesh Gradients
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* --- Variables del Sistema (Light Mode por defecto, sobrescrito por Dark) --- */
:root {
    /* Paleta Principal - Azul Profundo + Violeta (Tecnología + Creatividad) */
    --primary-hue: 240;
    --accent-hue: 280;
    --primary: hsl(var(--primary-hue), 80%, 60%);
    --primary-dark: hsl(var(--primary-hue), 80%, 45%);
    --accent: hsl(var(--accent-hue), 70%, 65%);
    --accent-glow: hsl(var(--accent-hue), 80%, 70%, 0.5);

    /* Superficies */
    --bg: #06060f;
    --surface-1: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.08);
    --surface-border: rgba(255, 255, 255, 0.12);
    --surface-hover: rgba(255, 255, 255, 0.13);

    /* Texto */
    --text-primary: #f0f0ff;
    --text-secondary: rgba(240, 240, 255, 0.6);
    --text-muted: rgba(240, 240, 255, 0.35);

    /* Efectos */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 999px;
    --shadow-card: 0 8px 32px rgba(0, 0, 10, 0.4);
    --shadow-glow: 0 0 30px rgba(130, 80, 255, 0.2);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Fuentes */
    --font: 'Outfit', system-ui, -apple-system, sans-serif;
}

/* --- Dark Mode (detecta preferencia del sistema) --- */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f0f0ff;
        --surface-1: rgba(80, 60, 180, 0.07);
        --surface-2: rgba(80, 60, 180, 0.12);
        --surface-border: rgba(80, 60, 180, 0.2);
        --surface-hover: rgba(80, 60, 180, 0.18);
        --text-primary: #0d0d1f;
        --text-secondary: rgba(13, 13, 31, 0.65);
        --text-muted: rgba(13, 13, 31, 0.4);
        --shadow-card: 0 8px 32px rgba(80, 60, 180, 0.15);
    }
}

/* --- Reset y Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Mesh Gradient Background (Fondo Vivo) --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 0% 0%, hsl(260, 60%, 18%) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 0%, hsl(220, 80%, 15%) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 100%, hsl(290, 50%, 12%) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, hsl(240, 30%, 8%) 0%, transparent 80%);
}

/* (Mesh para Light Mode) */
@media (prefers-color-scheme: light) {
    body::before {
        background:
            radial-gradient(ellipse at 0% 0%, hsl(260, 80%, 90%) 0%, transparent 55%),
            radial-gradient(ellipse at 100% 0%, hsl(220, 90%, 88%) 0%, transparent 55%),
            radial-gradient(ellipse at 50% 100%, hsl(290, 70%, 92%) 0%, transparent 60%),
            var(--bg);
    }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* ============================================================
   COMPONENTES REUTILIZABLES
   ============================================================ */

/* Glassmorphism Card */
.glass-card {
    background: var(--surface-1);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.glass-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    transform: translateY(-4px);
}

/* --- Layout de Herramienta Global --- */
.tool-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 40px clamp(16px, 5vw, 40px) 80px;
}

.tool-intro {
    text-align: center;
    margin-bottom: clamp(40px, 8vw, 64px);
}

.tool-intro h1 {
    font-size: clamp(2rem, 6vw, 3.2rem);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.tool-intro p {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Botón Primario */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(130, 80, 255, 0.35);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: var(--transition);
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:active {
    transform: scale(0.97);
}

/* Botón Secundario (Ghost) */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-1);
}

/* Badge de Categoría */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================================
   LAYOUT: HEADER / NAV
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 clamp(16px, 5vw, 80px);
    background: rgba(6, 6, 15, 0.6);
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    border-bottom: 1px solid var(--surface-border);
}

@media (prefers-color-scheme: light) {
    .site-header {
        background: rgba(240, 240, 255, 0.7);
    }
}

.nav-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.logo span {
    color: var(--accent);
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 4px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 7px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--surface-2);
}

.nav-links a.active {
    color: var(--primary);
}

.nav-cta {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hamburger (mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 68px;
        /* Altura de la cabecera */
        left: 0;
        width: 100vw;
        height: calc(100vh - 68px);
        background: rgba(6, 6, 15, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 40px 24px;
        gap: 24px;
        border-top: 1px solid var(--surface-border);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        text-align: center;
        overflow-y: auto;
    }

    @media (prefers-color-scheme: light) {
        .nav-links {
            background: rgba(240, 240, 255, 0.98);
        }
    }

    .nav-links.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-cta {
        display: none;
    }

    .nav-toggle {
        display: block;
    }
}

/* ============================================================
   LAYOUT: HERO SECTION
   ============================================================ */
.hero {
    text-align: center;
    padding: clamp(64px, 10vw, 120px) clamp(16px, 5vw, 80px) clamp(48px, 7vw, 80px);
    max-width: 900px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 28px;
    letter-spacing: 0.04em;
}

.hero-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

.hero h1 {
    font-size: clamp(2.4rem, 7vw, 4.8rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--primary) 30%, var(--accent) 70%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 620px;
    margin: 0 auto 36px;
}

/* Search Bar */
.search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto 20px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 18px 20px 18px 52px;
    font-family: var(--font);
    font-size: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus {
    border-color: var(--primary);
    background: var(--surface-hover);
    box-shadow: var(--shadow-card), 0 0 0 4px rgba(100, 80, 255, 0.15);
}

.search-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 10px;
    min-height: 1.2em;
}

/* Stats Row */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: clamp(20px, 5vw, 60px);
    margin-top: 40px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============================================================
   LAYOUT: TOOLS SECTION (Catálogo)
   ============================================================ */
.tools-section {
    padding: 0 clamp(16px, 5vw, 80px) 80px;
    max-width: 1320px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Filtros de Categoría */
.category-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.filter-btn {
    padding: 7px 18px;
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Grid de Herramientas */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Tool Card */
.tool-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
    border-radius: inherit;
}

.tool-card:hover::before {
    opacity: 0.06;
}

.tool-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
    flex-shrink: 0;
    position: relative;
}

.tool-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
}

.tool-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
    position: relative;
}

.tool-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    position: relative;
}

.tool-card-category {
    background: var(--surface-2);
    color: var(--text-secondary);
}

.tool-card-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    transition: var(--transition);
    color: var(--text-secondary);
}

.tool-card:hover .tool-card-arrow {
    background: var(--primary);
    color: #fff;
    transform: translateX(3px);
}

/* Estado Vacío */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================================================
   LAYOUT: FOOTER
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--surface-border);
    padding: 40px clamp(16px, 5vw, 80px);
    background: rgba(0, 0, 10, 0.2);
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-copy {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Skeleton Loader */
@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.skeleton {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
    position: relative;
    overflow: hidden;
}

/* ============================================================
   HERRAMIENTAS RELACIONADAS (Global)
   ============================================================ */
.related-section {
    max-width: 1320px;
    margin: 40px auto 0;
    padding: 0 clamp(16px, 5vw, 40px) 80px;
}

.related-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.related-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: rgba(100, 80, 255, 0.05);
}

.related-card-icon {
    font-size: 1.4rem;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.related-card-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.related-card-cat {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   CONVERTER TOOLS SPECIFIC (Binario, CSV to JSON, etc.)
   ============================================================ */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.input-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    padding: 4px;
    border-radius: 6px;
}

.btn-copy:hover {
    color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
}

.converter-textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 16px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.converter-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.char-count {
    align-self: flex-end;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-2);
    border-top: 1px solid var(--surface-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    flex-wrap: wrap;
    gap: 1rem;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}
.cookie-banner.show {
    transform: translateY(0);
}
.cookie-banner-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.cookie-banner-text a {
    color: var(--primary);
    text-decoration: underline;
}
.cookie-banner-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}
.cookie-banner-btn:hover {
    background-color: var(--primary-hover);
}
@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
    }
}

