/* =========================================================
   HERRAMIENTAS EDUCATIC - QR Y CODIGOS DE BARRAS
   Capa visual ligera compartida para tools.*
========================================================= */
.tools-page {
    --tool-blue: #0d6efd;
    --tool-blue-dark: #0958c9;
    --tool-text: #172033;
    --tool-muted: #6f7b8c;
    --tool-border: #e2e9f2;
    --tool-soft: #f5f8fd;
}

.tools-page main.container {
    max-width: 1320px;
}

.tools-page main > section:first-of-type {
    padding: 10px 0 38px !important;
    background: transparent !important;
}

.tools-page main > section:first-of-type > .container {
    max-width: none;
    padding-inline: 0;
}

.tools-page main > section:first-of-type > .container > h1 {
    position: relative;
    margin: 0 auto 10px !important;
    color: var(--tool-text);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 950 !important;
    letter-spacing: -.035em;
    line-height: 1.08;
}

.tools-page main > section:first-of-type > .container > h1::before {
    content: "Herramienta gratuita · Centro Educatic";
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 auto 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eaf2ff;
    color: var(--tool-blue);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .02em;
}

.tools-page main > section:first-of-type > .container > p {
    max-width: 760px;
    margin: 0 auto 20px !important;
    color: var(--tool-muted) !important;
    font-size: .9rem;
    line-height: 1.65;
}

.tool-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 24px;
}

.tool-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #d7e1ee;
    border-radius: 11px;
    background: #fff;
    color: #526076;
    font-size: .75rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
}

.tool-switcher a:hover {
    transform: translateY(-1px);
    border-color: #9dc2ff;
    color: var(--tool-blue);
    box-shadow: 0 7px 18px rgba(15, 23, 42, .06);
}

.tool-switcher a.active {
    border-color: var(--tool-blue);
    background: linear-gradient(135deg, #1477ff, #075ed7);
    color: #fff;
    box-shadow: 0 8px 22px rgba(13, 110, 253, .2);
}

.tool-privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: 720px;
    margin: -10px auto 24px;
    color: #68758a;
    font-size: .7rem;
    text-align: center;
}

.tools-page main > section:first-of-type .row.g-4 > [class*="col-md-"] {
    padding: 24px !important;
    border: 1px solid var(--tool-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 32px rgba(15, 23, 42, .055);
}

/* Tabs convertidos en chips horizontales */
.tools-page #qrTabs,
.tools-page #barcodeTabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    margin-bottom: 22px !important;
    padding: 2px 1px 7px;
    overflow-x: auto;
    border: 0;
    scrollbar-width: thin;
    scrollbar-color: #c7d5e7 transparent;
}

.tools-page #qrTabs .nav-item,
.tools-page #barcodeTabs .nav-item {
    flex: 0 0 auto;
}

.tools-page #qrTabs .nav-link,
.tools-page #barcodeTabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 39px;
    padding: 7px 11px;
    border: 1px solid #dce4ee;
    border-radius: 999px;
    background: #fff;
    color: #5b687c;
    font-size: .73rem;
    font-weight: 800;
    white-space: nowrap;
}

.tools-page #qrTabs .nav-link:hover,
.tools-page #barcodeTabs .nav-link:hover {
    border-color: #a7c8ff;
    color: var(--tool-blue);
}

.tools-page #qrTabs .nav-link.active,
.tools-page #barcodeTabs .nav-link.active {
    border-color: var(--tool-blue);
    background: #eaf2ff;
    color: var(--tool-blue);
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, .04);
}

.tools-page #qrFormContent,
.tools-page #barcodeFormContent {
    min-height: 86px;
    padding: 18px;
    border: 1px solid #e6ebf2;
    border-radius: 14px;
    background: #f9fbfe;
}

.tools-page #qrFormContent label,
.tools-page #barcodeFormContent label,
.tools-page #qrAccordion label,
.tools-page #barcodeAccordion label {
    color: #344055;
    font-size: .75rem;
    font-weight: 800 !important;
}

.tools-page .form-control,
.tools-page .form-select {
    min-height: 44px;
    border-color: #d9e2ed;
    border-radius: 10px;
    font-size: .8rem;
    box-shadow: none;
}

.tools-page textarea.form-control {
    min-height: 92px;
}

.tools-page .form-control:focus,
.tools-page .form-select:focus {
    border-color: #8ab8ff;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .08);
}

.tools-page .form-control-color {
    width: 100%;
    min-height: 45px;
    padding: 5px;
}

.tools-page main > section:first-of-type hr {
    margin: 24px 0 !important;
    border-color: #e8edf3;
    opacity: 1;
}

.tools-page main > section:first-of-type h5.fw-bold {
    color: var(--tool-text);
    font-size: .95rem;
    font-weight: 900 !important;
}

.tools-page #qrAccordion,
.tools-page #barcodeAccordion,
.tools-page #faqAccordion,
.tools-page #faqBarcode {
    --bs-accordion-border-color: #e1e8f1;
    --bs-accordion-btn-focus-box-shadow: none;
    --bs-accordion-active-bg: #eef5ff;
    --bs-accordion-active-color: #0b5ed7;
}

.tools-page .accordion-item {
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid #e1e8f1 !important;
    border-radius: 12px !important;
    background: #fff;
}

.tools-page .accordion-button {
    min-height: 46px;
    padding: 12px 14px;
    font-size: .77rem;
    font-weight: 800;
}

.tools-page .accordion-body {
    color: #657287;
    font-size: .78rem;
    line-height: 1.6;
}

/* Preview: una sola tarjeta, sin doble borde visual */
.tools-page main > section:first-of-type .row.g-4 > .col-md-4 > .p-4,
.tools-page main > section:first-of-type .row.g-4 > .col-md-5 > .p-4 {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.tools-page #qrPreview {
    min-height: 330px !important;
    margin-bottom: 18px !important;
    overflow: hidden;
    border: 1px dashed #d5dfeb;
    border-radius: 16px;
    background: linear-gradient(145deg, #fbfdff, #f3f7fc);
}

.tools-page #qrPreview canvas,
.tools-page #qrPreview svg {
    max-width: calc(100% - 20px) !important;
    height: auto !important;
}

.tools-page #barcodeContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 18px;
    overflow: auto;
    border: 1px dashed #d5dfeb;
    border-radius: 16px;
    background: linear-gradient(145deg, #fbfdff, #f3f7fc);
}

.tools-page #barcodePreview,
.tools-page #barcodePlaceholder {
    max-width: 100%;
    height: auto;
}

.tools-page #qrDownload,
.tools-page #downloadPng,
.tools-page #downloadSvg {
    min-height: 45px;
    border-radius: 11px;
    font-size: .78rem;
    font-weight: 850;
}

.tools-page #qrDownload,
.tools-page #downloadPng {
    border: 0;
    background: linear-gradient(135deg, #1477ff, #075ed7);
    box-shadow: 0 8px 22px rgba(13, 110, 253, .2);
}

.tools-page #qrDownload:not(:disabled):hover,
.tools-page #downloadPng:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 11px 27px rgba(13, 110, 253, .28);
}

.tools-page #qrDownload:disabled,
.tools-page #downloadPng:disabled,
.tools-page #downloadSvg:disabled {
    cursor: not-allowed;
    opacity: .48;
    box-shadow: none;
}

.tools-page #barcodeDetails {
    min-height: 42px;
    margin-bottom: 0;
    line-height: 1.55;
}

/* Bloques informativos inferiores */
.tools-page main > section:not(:first-of-type) {
    padding: 34px 0 !important;
    background: transparent !important;
}

.tools-page main > section:not(:first-of-type) > .container {
    max-width: 1120px;
    padding: 28px;
    border: 1px solid var(--tool-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}

.tools-page main > section:not(:first-of-type) h2 {
    color: var(--tool-text);
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    font-weight: 900 !important;
    letter-spacing: -.02em;
}

.tools-page main > section:not(:first-of-type) h3 {
    color: #29364a;
    font-size: 1.05rem;
}

.tools-page main > section:not(:first-of-type) p,
.tools-page main > section:not(:first-of-type) li {
    color: #667389;
    font-size: .83rem;
    line-height: 1.7;
}

.tools-page main > section:not(:first-of-type) .lead {
    font-size: .92rem;
}

.tools-page main > section:not(:first-of-type) .card {
    border: 1px solid #e5ebf2 !important;
    border-radius: 15px;
    box-shadow: none !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.tools-page main > section:not(:first-of-type) .card:hover {
    transform: translateY(-2px);
    border-color: #cbdaf0 !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06) !important;
}

.tools-page main > section:not(:first-of-type) .card-body i.fa-2x {
    font-size: 1.35rem !important;
}

.tools-page main > section:not(:first-of-type) .card-body h5 {
    font-size: .9rem;
}

.tools-page main > section:not(:first-of-type) .card-body p {
    margin-bottom: 0;
    font-size: .76rem;
}

body.dark-mode.tools-page main > section:first-of-type .row.g-4 > [class*="col-md-"],
body.dark-mode.tools-page main > section:not(:first-of-type) > .container,
body.dark-mode.tools-page #qrFormContent,
body.dark-mode.tools-page #barcodeFormContent,
body.dark-mode.tools-page .accordion-item,
body.dark-mode.tools-page .tool-switcher a {
    border-color: #333;
    background: #1f1f1f;
}

body.dark-mode.tools-page main > section:first-of-type > .container > h1,
body.dark-mode.tools-page main > section:first-of-type h5.fw-bold,
body.dark-mode.tools-page main > section:not(:first-of-type) h2,
body.dark-mode.tools-page main > section:not(:first-of-type) h3 {
    color: #f1f3f5;
}

@media (min-width: 768px) {
    .tools-page main > section:first-of-type .row.g-4 > .col-md-4,
    .tools-page main > section:first-of-type .row.g-4 > .col-md-5 {
        position: sticky;
        top: 96px;
        align-self: flex-start;
    }
}

@media (max-width: 767.98px) {
    .tools-page main.container {
        margin-top: 18px !important;
    }

    .tools-page main > section:first-of-type {
        padding-top: 0 !important;
    }

    .tools-page main > section:first-of-type > .container > h1 {
        font-size: 1.75rem;
    }

    .tool-switcher {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .tool-switcher a {
        min-width: 0;
    }

    .tools-page main > section:first-of-type .row.g-4 > [class*="col-md-"] {
        padding: 18px !important;
        border-radius: 17px;
    }

    .tools-page #qrPreview {
        min-height: 260px !important;
    }

    .tools-page main > section:not(:first-of-type) > .container {
        padding: 20px 17px;
        border-radius: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tool-switcher a,
    .tools-page main > section:not(:first-of-type) .card,
    .tools-page #qrDownload,
    .tools-page #downloadPng {
        transition: none;
    }
}
