/* ============================
   VARIABLES GLOBALES
============================ */
:root {
    --max-width: 760px;

    /* Espaciado */
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 18px;
    --space-lg: 26px;
    --space-xl: 40px;

    /* Tipografía */
    --font-base: 15px;
    --font-sm: 14px;
    --font-lg: 28px;
    --font-title: 32px;

    /* Colores */
    --color-bg: #ffffff;
    --color-bg-alt: #f7f7f7;
    --color-border: #e2e2e2;
    --color-text: #333333;
    --color-text-muted: #666666;
    --color-text-strong: #111111;
    --color-primary: #3b82f6;
    --color-primary-strong: #2563eb;

    /* Bordes y sombras */
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-soft: 0 4px 14px rgba(0,0,0,0.06);

    /* Transiciones */
    --transition: 0.18s ease-in-out;
}

body.dark-mode {
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-border: #334155;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-strong: #f8fafc;
    --color-primary: #4f7fc7;
    --color-primary-strong: #426dae;
    --shadow-soft: 0 4px 14px rgba(0,0,0,0.45);
}

/* ============================
   GRID DE TARJETAS (HOME)
============================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* Tarjetas individuales */
.tool-card {
    width: 100%;
    max-width: 280px;
    padding: var(--space-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    text-align: center;
    transition: var(--transition);

    /* 🔥 SOLUCIÓN DEFINITIVA: evita cards aplastadas */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

/* ============================
   ANUNCIOS (HOME + APPS)
============================ */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.ad-inner {
    width: 100%;
    max-width: var(--max-width);
    display: flex;
    justify-content: center;
}

.ad-debug {
    background: var(--color-bg-alt);
    border: 1px dashed var(--color-border);
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    border-radius: 8px;
    width: 100%;
    min-height: 90px;
    height: auto;
    box-sizing: border-box;
    color: var(--color-text);
}

.ad-top .ad-debug {
    max-width: 728px;
    min-height: 90px;
    height: 90px;
}

.ad-bottom .ad-debug,
.ad-in-content .ad-debug {
    max-width: 336px;
    min-height: 280px;
    height: 280px;
}

.ad-in-content {
    margin: var(--space-lg) 0;
}

/* Temporary global switch: keep ad blocks in templates but hide them site-wide. */
body.ads-disabled .ad-container {
    display: none !important;
}

@media (max-width: 768px) {
    .ad-inner {
        max-width: 100%;
    }

    .ad-top .ad-debug {
        max-width: 320px;
        min-height: 100px;
        height: 100px;
        font-size: 13px;
    }

    .ad-bottom .ad-debug,
    .ad-in-content .ad-debug {
        max-width: 300px;
        min-height: 250px;
        height: 250px;
    }
}

/* ============================
   UTILIDADES GLOBALES
============================ */
img,
svg {
    max-width: 100%;
    height: auto;
}

* {
    box-sizing: border-box;
}

/* ============================================================
   ESTILO BASE UNIVERSAL PARA TODAS LAS HERRAMIENTAS
=============================================================== */
.tool-container {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: var(--space-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.tool-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.tool-title {
    font-size: var(--font-title);
    font-weight: 700;
    color: var(--color-text-strong);
    margin: 0;
    text-align: center;
}

.tool-description {
    margin-top: 0;
    margin-bottom: var(--space-md);
    color: var(--color-text);
    font-size: var(--font-base);
    line-height: 1.55;
    text-align: center;
}

.tool-field-group {
    margin-bottom: var(--space-md);
    text-align: center;
}

.tool-field-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 600;
    color: var(--color-text-strong);
}

.tool-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: var(--font-base);
    color: var(--color-text);
}

.tool-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.tool-btn {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.tool-btn:hover {
    background: var(--color-primary-strong);
}

.tool-btn.small {
    padding: 8px 14px;
    font-size: var(--font-sm);
}

.result-box {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.related-tools {
    margin-top: var(--space-xl);
    text-align: center; /* Centra el bloque */
}

.related-tools h3 {
    font-size: var(--font-lg);
    margin-bottom: var(--space-sm);
    text-align: center; /* TÍTULO CENTRADO */
}

.related-tools ul {
    padding-left: 0;
    list-style: none;
    margin: 0 auto;          /* Centra la lista */
    width: fit-content;      /* Ajusta el ancho al contenido */
    text-align: left;        /* ENLACES A LA IZQUIERDA */
}

.related-tools li {
    margin-bottom: var(--space-xs);
    min-height: 32px;        /* MISMA ALTURA PARA TODOS */
    display: flex;
    align-items: center;     /* Alineación vertical perfecta */
}

.related-tools a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
}

.related-tools a:hover {
    text-decoration: none;
}



/* ============================
   HOME: HERO, ABOUT, TITULOS
============================ */
.hero-content,
.about-section,
.ad-container,
.tools-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.hero-content,
.about-section,
.ad-container {
    text-align: center;
}

.tools-section {
    text-align: left; /* NO romper grid */
}

.hero-title,
.about-section h2 {
    font-size: 42px;
    font-weight: 800;
    color: var(--color-text-strong);
    margin-bottom: var(--space-sm);
    text-align: center;
    line-height: 1.15;
}

.hero-subtitle,
.about-text {
    font-size: 18px;
    color: var(--color-text);
    text-align: center;
    line-height: 1.55;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-strong);
    text-align: center;
    margin-bottom: var(--space-md);
}

/* ============================
   RESPONSIVE EXTRA
============================ */
@media (max-width: 480px) {
    .tool-container {
        padding: var(--space-md);
    }

    .tool-title {
        font-size: 26px;
    }

    .tool-buttons {
        flex-direction: column;
    }
}
