/**
 * facturatica-codeblocks — estilos extra (paleta brand FACTURATica)
 *
 * Brand palette:
 *   Verde primario:    #34D399
 *   Verde oscuro:      #14501a
 *   Verde mas oscuro:  #173326
 *   Sea green:         #2E8B57
 *   Naranja primario:  #f88c00
 *   Naranja hover:     #da6e00
 *   Grises:            #f8f9fa, #ededed, #D1D5DB, #aaaaaa, #2d2d2d
 *
 * Sin rojo en ningun lado.
 */
/* 2.4.9 */

/* ──────────────────────────────────────────────────────────────────────
   Code blocks Prism + boton Copiar
   ────────────────────────────────────────────────────────────────────── */

.facturatica_codeblocks_wrap {
    position: relative;
    margin: 1.2em 0;
}

.facturatica_codeblocks_wrap pre[class*="language-"] {
    margin: 0;
    border-radius: 6px;
    font-size: 0.85em;
    line-height: 1.5;
    max-height: 600px;
    overflow: auto;
}

.facturatica_codeblocks_copy_btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.15);
    color: #f8f8f2;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    z-index: 2;
}

.facturatica_codeblocks_copy_btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.facturatica_codeblocks_copy_btn_ok {
    background: #14501a !important;
    color: #fff !important;
    border-color: #14501a !important;
}

/* ──────────────────────────────────────────────────────────────────────
   <details> generales (acordeones)
   ────────────────────────────────────────────────────────────────────── */

details.facturatica_codeblocks_details {
    margin: 1em 0;
    border: 1px solid #e5e8e6;
    border-radius: 8px;
    background: #fbfbfb;
    transition: box-shadow 0.18s ease;
}

details.facturatica_codeblocks_details[open] {
    box-shadow: 0 2px 8px rgba(20, 80, 26, 0.06);
}

details.facturatica_codeblocks_details > summary {
    padding: 13px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #2d2d2d;
    list-style: none;
    user-select: none;
    border-radius: 8px;
    transition: background 120ms ease;
}

details.facturatica_codeblocks_details > summary::-webkit-details-marker {
    display: none;
}

details.facturatica_codeblocks_details > summary::before {
    content: "›";
    display: inline-block;
    margin-right: 10px;
    color: #2E8B57;
    font-size: 1.3em;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.18s ease;
}

details.facturatica_codeblocks_details[open] > summary::before {
    transform: rotate(90deg);
}

details.facturatica_codeblocks_details > summary:hover {
    background: #f3f7f4;
}

details.facturatica_codeblocks_details[open] > summary {
    border-bottom: 1px solid #e5e8e6;
    border-radius: 8px 8px 0 0;
    background: #f6f9f7;
}

details.facturatica_codeblocks_details > .facturatica_codeblocks_details_body {
    padding: 18px 20px;
}

/* ──────────────────────────────────────────────────────────────────────
   Endpoint cards (variante destacada de <details>)
   ────────────────────────────────────────────────────────────────────── */

details.ft-endpoint {
    margin: 14px 0;
    border: 1px solid #d8e0db;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

details.ft-endpoint:hover {
    border-color: #c4d2cb;
}

details.ft-endpoint[open] {
    box-shadow: 0 4px 14px rgba(20, 80, 26, 0.08);
    border-color: #b8cdc0;
}

details.ft-endpoint > summary {
    padding: 16px 22px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #fcfcfc 0%, #f6f8f6 100%);
    transition: background 120ms ease;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

details.ft-endpoint > summary::-webkit-details-marker { display: none; }

details.ft-endpoint > summary::before {
    content: "›";
    display: inline-block;
    color: #2E8B57;
    font-size: 1.4em;
    font-weight: 700;
    line-height: 1;
    margin-right: 6px;
    transition: transform 0.18s ease;
}

details.ft-endpoint[open] > summary::before {
    transform: rotate(90deg);
}

details.ft-endpoint > summary:hover {
    background: linear-gradient(180deg, #f6f8f6 0%, #eef3ef 100%);
}

details.ft-endpoint[open] > summary {
    border-bottom: 1px solid #d8e0db;
    border-radius: 10px 10px 0 0;
}

details.ft-endpoint .ft-endpoint-method {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: #14501a;
    color: #fff;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.04em;
}

details.ft-endpoint .ft-endpoint-action {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: #173326;
    color: #34D399;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.02em;
}

details.ft-endpoint .ft-endpoint-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #173326;
    margin-left: 4px;
}

details.ft-endpoint > .ft-endpoint-body {
    padding: 22px 24px 18px 24px;
    background: #fff;
    border-radius: 0 0 10px 10px;
}

/* ──────────────────────────────────────────────────────────────────────
   TOC legacy (ya no se usa pero por compat retro)
   ────────────────────────────────────────────────────────────────────── */

.facturatica_codeblocks_toc { display: none !important; }

@media (max-width: 720px) {
    details.facturatica_codeblocks_details > summary { padding: 11px 16px; }
    details.ft-endpoint > summary { padding: 14px 18px; }
    details.ft-endpoint > .ft-endpoint-body { padding: 16px 18px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Collapsible preview con blur (reusable: TOC, tablas, etc.)
   HTML: <div class="ft-preview" data-preview-height="180">...</div>
   ────────────────────────────────────────────────────────────────────── */

.ft-preview {
    position: relative;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.ft-preview:not(.ft-preview-fits)::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 100px;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.92) 55%,
        rgba(255, 255, 255, 1) 100%);
    pointer-events: none;
    transition: opacity 200ms ease;
}

.ft-preview.ft-preview-open::after { opacity: 0; }

.ft-preview-toggle {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    padding: 9px 24px;
    background: #f88c00;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 0.92em;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(248, 140, 0, 0.28);
    z-index: 3;
    transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.ft-preview-toggle:hover {
    background: #da6e00;
    transform: translateX(-50%) translateY(-1px);
    box-shadow: 0 6px 16px rgba(218, 110, 0, 0.36);
}

.ft-preview.ft-preview-open .ft-preview-toggle {
    position: static;
    transform: none;
    display: block;
    margin: 18px auto 6px auto;
}

.ft-preview.ft-preview-fits .ft-preview-toggle { display: none; }

/* Variante para tablas — fondo del fade igual al fondo del wrapper */
.ft-preview-table {
    margin: 1.2em 0;
    padding-bottom: 16px;
}

/* ──────────────────────────────────────────────────────────────────────
   Bulk expand / collapse
   ────────────────────────────────────────────────────────────────────── */

.ft-bulk-toggle {
    display: flex;
    gap: 10px;
    margin: 18px 0 14px 0;
    flex-wrap: wrap;
}

.ft-bulk-btn {
    padding: 9px 20px;
    background: #fff;
    color: #173326;
    border: 1.5px solid #c4d2cb;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 120ms ease;
    font-family: inherit;
}

.ft-bulk-btn:hover {
    background: #f3f7f4;
    border-color: #14501a;
    color: #14501a;
}

.ft-bulk-btn-secondary {
    background: transparent;
}

/* ──────────────────────────────────────────────────────────────────────
   Service callout (servicio premium $500)
   Verde oscuro + acento naranja + grises
   ────────────────────────────────────────────────────────────────────── */

.ft-service-callout {
    background: linear-gradient(135deg, #14501a 0%, #173326 100%);
    color: #f8f9fa;
    padding: 32px 36px;
    border-radius: 14px;
    margin: 32px 0;
    box-shadow: 0 4px 18px rgba(20, 80, 26, 0.18);
    position: relative;
    overflow: hidden;
}

.ft-service-callout::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.18) 0%, transparent 70%);
    pointer-events: none;
}

.ft-service-callout::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #34D399 0%, #f88c00 100%);
}

.ft-service-callout h3 {
    margin: 0 0 8px 0 !important;
    color: #fff !important;
    font-size: 1.5em;
    font-weight: 700;
    border: none !important;
    padding: 0 !important;
}

.ft-service-callout .ft-service-eyebrow {
    display: inline-block;
    margin: 0 0 10px 0;
    padding: 4px 12px;
    background: rgba(52, 211, 153, 0.18);
    color: #34D399;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ft-service-callout .ft-service-subtitle {
    color: rgba(255, 255, 255, 0.88);
    margin: 0 0 18px 0;
    font-size: 1.02em;
    line-height: 1.55;
    max-width: 700px;
}

.ft-service-callout .ft-service-price {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 22px 0;
    padding: 10px 20px;
    background: #f88c00;
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(248, 140, 0, 0.32);
}

.ft-service-callout .ft-service-price-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.92;
}

.ft-service-callout .ft-service-price-amount {
    font-size: 1.4em;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ft-service-callout .ft-service-price-note {
    font-size: 0.78em;
    opacity: 0.9;
    font-weight: 500;
}

.ft-service-callout ul {
    margin: 0 0 26px 0 !important;
    padding-left: 0 !important;
    color: rgba(255, 255, 255, 0.94);
    list-style: none !important;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 720px) {
    .ft-service-callout ul {
        grid-template-columns: 1fr 1fr;
        column-gap: 22px;
    }
}

.ft-service-callout ul li {
    list-style: none !important;
    margin: 0 !important;
    padding-left: 28px !important;
    position: relative;
    line-height: 1.5;
}

.ft-service-callout ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #34D399;
    color: #14501a;
    font-weight: 900;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ft-service-callout .ft-service-cta {
    display: inline-block;
    padding: 13px 28px;
    background: #f88c00;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1em;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(248, 140, 0, 0.36);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.ft-service-callout .ft-service-cta:hover {
    background: #da6e00;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(218, 110, 0, 0.45);
    text-decoration: none;
    color: #fff;
}

@media (max-width: 720px) {
    .ft-service-callout { padding: 24px 22px; }
    .ft-service-callout h3 { font-size: 1.25em; }
    .ft-service-callout::before { width: 140px; height: 140px; top: -30px; right: -30px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Manual banner — limpio, minimo, acento verde
   ────────────────────────────────────────────────────────────────────── */

.ft-manual-banner {
    text-align: center;
    margin: 40px 0 28px 0;
    padding: 26px 24px 24px 24px;
    border-top: 1px solid #e1e6e2;
    border-bottom: 1px solid #e1e6e2;
    background: #fbfbfb;
    position: relative;
}

.ft-manual-banner::before {
    content: "";
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #34D399 0%, #2E8B57 100%);
    margin: 0 auto 18px auto;
    border-radius: 2px;
}

.ft-manual-banner h2 {
    margin: 0 !important;
    color: #173326 !important;
    font-size: 1.85em;
    font-weight: 700;
    border: none !important;
    padding: 0 !important;
    line-height: 1.2;
}

.ft-manual-banner .ft-manual-subtitle {
    margin: 12px auto 0 auto;
    color: #555;
    font-size: 1em;
    font-weight: 400;
    max-width: 640px;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .ft-manual-banner { padding: 22px 16px 20px 16px; }
    .ft-manual-banner h2 { font-size: 1.4em; }
}

/* ──────────────────────────────────────────────────────────────────────
   Quick Start — step cards y path breadcrumb
   ────────────────────────────────────────────────────────────────────── */

.ft-step {
    display: flex;
    gap: 22px;
    margin: 22px 0;
    padding: 22px 26px;
    background: #fbfbfb;
    border: 1px solid #e5e8e6;
    border-left: 4px solid #34D399;
    border-radius: 12px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.ft-step:hover {
    box-shadow: 0 4px 14px rgba(20, 80, 26, 0.06);
    border-left-color: #14501a;
}

.ft-step-number {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #14501a 0%, #2E8B57 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(20, 80, 26, 0.25);
    line-height: 1;
}

.ft-step-content {
    flex: 1;
    min-width: 0;
}

.ft-step-content > h3:first-child,
.ft-step-content > h4:first-child {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    color: #173326;
    font-size: 1.15em;
    font-weight: 700;
}

.ft-step-content > p:last-child,
.ft-step-content > div:last-child,
.ft-step-content > .facturatica_codeblocks_wrap:last-child {
    margin-bottom: 0 !important;
}

@media (max-width: 720px) {
    .ft-step { padding: 18px 18px; gap: 14px; }
    .ft-step-number { width: 38px; height: 38px; font-size: 1.1em; }
}

/* Path breadcrumb */
.ft-path {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 14px 0;
    padding: 10px 14px;
    background: #f3f7f4;
    border: 1px solid #d8e0db;
    border-radius: 8px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.ft-path-item {
    padding: 3px 10px;
    background: #fff;
    border: 1px solid #d8e0db;
    border-radius: 5px;
    color: #173326;
    font-weight: 600;
    transition: all 0.15s ease;
}

.ft-path-item.ft-path-final {
    background: #14501a;
    border-color: #14501a;
    color: #fff;
}

.ft-path-arrow {
    color: #2E8B57;
    font-size: 1.1em;
    font-weight: 700;
    user-select: none;
}

@media (max-width: 720px) {
    .ft-path { padding: 8px 10px; font-size: 0.85em; }
    .ft-path-item { padding: 2px 8px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Galeria de ejemplos PHP — summary con numero + badge tipo + descripcion
   ────────────────────────────────────────────────────────────────────── */

details.ft-galeria-item > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    flex-wrap: wrap;
}

details.ft-galeria-item > summary::before {
    content: "›";
    color: #2E8B57;
    font-size: 1.25em;
    font-weight: 700;
    margin-right: 0;
    line-height: 1;
    transition: transform 0.18s ease;
}

details.ft-galeria-item[open] > summary::before {
    transform: rotate(90deg);
}

.ft-galeria-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: linear-gradient(135deg, #14501a 0%, #2E8B57 100%);
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.92em;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 6px rgba(20, 80, 26, 0.25);
}

.ft-galeria-type {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
}

/* Colores por tipo */
.ft-galeria-type-fe   { background: #14501a; color: #fff; }
.ft-galeria-type-te   { background: #2E8B57; color: #fff; }
.ft-galeria-type-nc   { background: #f88c00; color: #fff; }
.ft-galeria-type-nd   { background: #da6e00; color: #fff; }
.ft-galeria-type-fec  { background: #173326; color: #34D399; }
.ft-galeria-type-fee  { background: #34D399; color: #173326; }
.ft-galeria-type-anular  { background: #8a1a1a; color: #fff; }
.ft-galeria-type-estado  { background: #555; color: #fff; }
.ft-galeria-type-nombre  { background: #6b7280; color: #fff; }

.ft-galeria-desc {
    flex: 1;
    min-width: 200px;
    color: #2d2d2d;
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 720px) {
    details.ft-galeria-item > summary {
        gap: 8px;
        padding: 10px 14px;
    }
    .ft-galeria-num {
        min-width: 32px;
        height: 32px;
        font-size: 0.85em;
    }
    .ft-galeria-desc {
        min-width: 100%;
        font-size: 0.95em;
    }
}

/* ──────────────────────────────────────────────────────────────────────
   Buenas Practicas — grid de cards
   ────────────────────────────────────────────────────────────────────── */

.ft-best-practices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 24px 0;
}

@media (min-width: 720px) {
    .ft-best-practices {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }
}

@media (min-width: 1100px) {
    .ft-best-practices {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.ft-bp-card {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    background: #fbfbfb;
    border: 1px solid #e5e8e6;
    border-left: 4px solid #34D399;
    border-radius: 12px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ft-bp-card:hover {
    box-shadow: 0 4px 14px rgba(20, 80, 26, 0.08);
    border-left-color: #14501a;
    transform: translateY(-2px);
}

.ft-bp-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, #f3f7f4 0%, #e8f0eb 100%);
    border-radius: 10px;
    line-height: 1;
}

.ft-bp-content {
    flex: 1;
    min-width: 0;
}

.ft-bp-category {
    display: inline-block;
    margin: 0 0 6px 0;
    padding: 3px 10px;
    background: #34D399;
    color: #14501a;
    border-radius: 999px;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ft-bp-title {
    margin: 4px 0 8px 0 !important;
    color: #173326 !important;
    font-size: 1.08em !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 0 !important;
    line-height: 1.3;
}

.ft-bp-body {
    margin: 0 !important;
    color: #2d2d2d;
    font-size: 0.95em;
    line-height: 1.55;
}

.ft-bp-body code {
    background: rgba(20, 80, 26, 0.08);
    color: #14501a;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

@media (max-width: 720px) {
    .ft-bp-card { padding: 16px 18px; gap: 12px; }
    .ft-bp-icon { width: 40px; height: 40px; font-size: 20px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Note callout (informativo dentro del manual)
   ────────────────────────────────────────────────────────────────────── */

.ft-note {
    margin: 18px 0;
    padding: 16px 20px;
    background: #fff8eb;
    border-left: 4px solid #f88c00;
    border-radius: 8px;
    color: #4a3a1c;
    line-height: 1.55;
}

.ft-note strong {
    color: #b06600;
}
