@charset "utf-8";
/* =========================================================
   DOCUMEDIC CIE-10 CLINICAL STYLES — Design System
   Color tokens: Primary (#0B4788), Accent (#63b2e4), Text (#11182a), BG (#f7f9fc)
   ========================================================= */

:root {
    --dm-primary: #0B4788;
    --dm-primary-hover: #083668;
    --dm-accent: #63b2e4;
    --dm-accent-hover: #4aa0d8;
    --dm-text: #11182a;
    --dm-text-secondary: #475569;
    --dm-bg: #f7f9fc;
    --dm-surface: #ffffff;
    --dm-border: #e2e8f0;
    --dm-shadow: 0 4px 20px -2px rgba(11, 71, 136, 0.12);
    --header-height: 64px;
    --tabbar-height: 60px;
    --footer-height: 34px;
}

body.dark-mode {
    --dm-primary: #3b82f6;
    --dm-primary-hover: #60a5fa;
    --dm-accent: #60a5fa;
    --dm-text: #f8fafc;
    --dm-text-secondary: #94a3b8;
    --dm-bg: #0f172a;
    --dm-surface: #1e293b;
    --dm-border: #334155;
    --dm-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

body {
    margin: 0;
    padding: 0;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--tabbar-height) + var(--footer-height));
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: var(--dm-text);
    background-color: var(--dm-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Encabezado Corporativo Documedic */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #0B4788 0%, #083363 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 10px rgba(11, 71, 136, 0.25);
    color: #ffffff;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1) drop-shadow(0 1px 3px rgba(255, 255, 255, 0.3));
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo {
    transform: scale(1.05);
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.header-badge {
    font-size: 14px;
    margin: 0;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.18);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Acceso permanente a la prueba gratuita — a diferencia del banner de
   conversion (descartable), este boton siempre esta visible, cierre o no
   el usuario el banner grande. */
.header-cta-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.header-cta-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.header-cta-btn i {
    font-size: 11px;
}

/* Toggle Tema */
.toggle-container {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.22);
    transition: all 0.3s ease;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
}

.thumb {
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb i {
    font-size: 10px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.thumb .icon-sun {
    color: #f59e0b;
    display: block;
}

.thumb .icon-moon {
    color: #38bdf8;
    display: none;
}

input:checked + .slider {
    background-color: #0f172a;
    border-color: rgba(255, 255, 255, 0.25);
}

input:checked + .slider .thumb {
    transform: translateX(24px);
    background-color: #1e293b;
}

input:checked + .slider .thumb .icon-sun {
    display: none;
}

input:checked + .slider .thumb .icon-moon {
    display: block;
}

/* Contenedor de Pestañas */
#tabsContainer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    box-sizing: border-box;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Filtros */
.filter-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-container select {
    flex: 1;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--dm-border);
    border-radius: 8px;
    background-color: var(--dm-surface);
    color: var(--dm-text);
    outline: none;
    font-weight: 500;
}

.clear-filters {
    display: none;
    padding: 8px 14px;
    background: #f1f5f9;
    border: 1px solid var(--dm-border);
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.clear-filters:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Buscador Principal */
.search-container {
    position: sticky;
    top: var(--header-height);
    z-index: 20;
    background-color: var(--dm-bg);
    padding: 4px 0 10px 0;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--dm-primary);
    font-size: 15px;
    pointer-events: none;
}

input[type="text"] {
    width: 100%;
    padding: 12px 42px 12px 40px;
    font-size: 15px;
    font-weight: 500;
    border: 2px solid var(--dm-border);
    border-radius: 12px;
    background-color: var(--dm-surface);
    color: var(--dm-text);
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(11, 71, 136, 0.06);
    transition: all 0.2s ease;
}

input[type="text"]:focus {
    border-color: var(--dm-primary);
    box-shadow: 0 0 0 3px rgba(11, 71, 136, 0.15);
    outline: none;
}

.clear-button {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--dm-text-secondary);
    cursor: pointer;
}

/* Botón Toggle de Filtros para Móviles */
.filter-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--dm-surface);
    border: 2px solid var(--dm-border);
    color: var(--dm-primary);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 8px;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(11, 71, 136, 0.06);
    transition: all 0.2s ease;
}

.filter-toggle-btn:hover, .filter-toggle-btn.is-open-active {
    background: color-mix(in srgb, var(--dm-primary) 10%, var(--dm-surface));
    border-color: var(--dm-primary);
    color: var(--dm-primary);
}

.filter-toggle-btn.has-active-filter {
    background: var(--dm-primary);
    color: #ffffff;
    border-color: var(--dm-primary);
}

.filter-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: #f59e0b;
    border-radius: 50%;
    border: 1.5px solid var(--dm-surface);
    display: none;
}

.filter-toggle-btn.has-active-filter .filter-badge {
    display: block;
}

/* Banner de Contador */
.results-count-banner {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dm-primary);
    background: color-mix(in srgb, var(--dm-accent) 15%, transparent);
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Tabla de Resultados */
.table-scroll-container {
    background: var(--dm-surface);
    border-radius: 12px;
    border: 1px solid var(--dm-border);
    box-shadow: var(--dm-shadow);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: color-mix(in srgb, var(--dm-primary) 8%, var(--dm-surface));
    color: var(--dm-primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--dm-border);
}

td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--dm-border);
    vertical-align: middle;
}

tbody tr:hover {
    background-color: color-mix(in srgb, var(--dm-accent) 8%, transparent);
}

/* Insignias de Código CIE-10 */
.badge-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    font-size: 13px;
    color: var(--dm-primary);
    background: color-mix(in srgb, var(--dm-accent) 18%, transparent);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--dm-primary) 30%, transparent);
    display: inline-block;
}

.highlight-code-match {
    color: #1e3a8a;
    font-weight: 900;
    text-decoration: underline;
    text-decoration-color: #f59e0b;
    text-decoration-thickness: 2px;
}

/* Resaltado dinámico en la descripción */
mark {
    background-color: color-mix(in srgb, var(--dm-accent) 30%, transparent);
    color: var(--dm-text);
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
    border-bottom: 1.5px solid var(--dm-accent);
}

/* Botones de Acción */
.action-btn-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-icon {
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    color: var(--dm-primary);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--dm-primary);
    color: #ffffff;
    border-color: var(--dm-primary);
}

.star-btn {
    color: #cbd5e1;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.15s ease;
}

.star-btn.is-favorite {
    color: #f59e0b;
}

.star-btn:hover {
    transform: scale(1.2);
}

/* Footer Corporativo Powered by Documedic (Minimalista y Fluido) */
.documedic-footer {
    position: relative;
    padding: 16px 0;
    margin-top: 12px;
    margin-bottom: var(--tabbar-height);
    background: transparent;
    color: var(--dm-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    border: none;
    text-align: center;
}

.documedic-footer p {
    margin: 0;
}

.footer-brand {
    color: var(--dm-primary);
    font-weight: 700;
    text-decoration: none;
}

/* Barra de Navegación Inferior Móvil/Desktop */
.tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tabbar-height);
    background: var(--dm-surface);
    border-top: 1px solid var(--dm-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--dm-text-secondary);
    cursor: pointer;
}

.tab i {
    font-size: 16px;
    margin-bottom: 2px;
}

.tab-icon-logo {
    height: 18px;
    width: auto;
    margin-bottom: 1px;
    vertical-align: middle;
    display: inline-block;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.tab.active .tab-icon-logo {
    opacity: 1;
    transform: scale(1.08);
}

.tab.active {
    color: var(--dm-primary);
}

/* Indicador de Carga Inicial Dedicado */
.initial-loading-badge {
    display: none;
    margin: 12px auto 4px auto;
    padding: 8px 20px;
    width: fit-content;
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(11, 71, 136, 0.08);
    text-align: center;
}

.initial-loading-badge p {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dm-primary);
}

.initial-loading-badge i {
    color: var(--dm-primary);
    font-size: 14px;
}

/* Banner discreto de conversion a Documedic */
.cta-banner {
    display: none;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 10px 12px 0 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(11, 71, 136, 0.08), rgba(99, 178, 228, 0.12));
    border: 1px solid var(--dm-border);
    border-radius: 12px;
}

.cta-banner-text {
    flex: 1 1 240px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--dm-text);
    line-height: 1.4;
}

.cta-banner-text i {
    color: var(--dm-primary);
    margin-right: 4px;
}

.cta-banner-btn {
    flex-shrink: 0;
    background: var(--dm-primary);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.cta-banner-btn:hover {
    background: var(--dm-primary-hover);
}

.cta-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--dm-text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.cta-banner-close:hover {
    color: var(--dm-text);
}

/* Estado Inicial Vacío Limpio */
.initial-empty-state-cell {
    padding: 28px 10px !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.initial-empty-state {
    text-align: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 4px;
    box-sizing: border-box;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
}

.empty-state-icon {
    font-size: 30px;
    color: var(--dm-accent);
    margin-bottom: 10px;
    opacity: 0.85;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dm-text);
    margin-bottom: 6px;
    word-break: break-word;
}

.empty-state-subtitle {
    font-size: 13px;
    color: var(--dm-text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
}

.search-pills-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
}

.search-pill-example {
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dm-primary);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-break: break-word;
}

.search-pill-example:hover {
    border-color: var(--dm-accent);
    background: var(--dm-bg);
    transform: translateY(-1px);
}

/* Scroll Loader */
.scroll-loader {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dm-primary);
}

/* Card de Contacto */
.contact-card {
    background: var(--dm-surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--dm-shadow);
    border: 1px solid var(--dm-border);
    max-width: 500px;
    margin: 20px auto;
    text-align: center;
}

.contact-logo {
    height: 50px;
    margin-bottom: 12px;
}

.contact-info {
    text-align: left;
    margin-top: 20px;
}

.contact-info p {
    margin: 10px 0;
    font-size: 14px;
    color: var(--dm-text-secondary);
}

.contact-info a {
    color: var(--dm-primary);
    font-weight: 600;
    text-decoration: none;
}

/* Codigo de cliente Documedic — quita banner/boton/pestana promocional */
.promo-code-box {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--dm-border);
    text-align: left;
}

.promo-code-label {
    font-size: 12.5px;
    color: var(--dm-text-secondary);
    margin: 0 0 10px 0;
}

.promo-code-form {
    display: flex;
    gap: 8px;
}

.promo-code-form input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--dm-border);
    border-radius: 8px;
    background: var(--dm-bg);
    color: var(--dm-text);
    font-size: 13px;
}

.promo-code-form button {
    flex-shrink: 0;
    background: var(--dm-primary);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.promo-code-form button:hover {
    background: var(--dm-primary-hover);
}

.promo-code-message {
    font-size: 12.5px;
    margin: 8px 0 0 0;
    min-height: 15px;
}

.promo-code-message.success {
    color: #16a34a;
    font-weight: 600;
}

.promo-code-message.error {
    color: #dc2626;
    font-weight: 600;
}

/* Floating Search Button */
.floating-search-button {
    display: none;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--dm-surface);
    margin: 8% auto;
    padding: 24px;
    border: 1px solid var(--dm-border);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    position: relative;
    color: var(--dm-text);
}

.close {
    color: var(--dm-text-secondary);
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--dm-primary);
}

.btn-google-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    background: #f1f5f9;
    border: 1px solid var(--dm-border);
    border-radius: 8px;
    color: var(--dm-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.btn-google-search:hover {
    background: var(--dm-surface);
    border-color: var(--dm-accent);
    color: var(--dm-primary-hover);
}

/* =========================================================
   RESPONSIVE DESIGN (Pantallas Pequeñas / Móviles < 640px)
   ========================================================= */
@media (max-width: 640px) {
    header {
        padding: 0 12px;
        height: 54px;
        gap: 6px;
        box-sizing: border-box;
    }

    .brand-link {
        gap: 6px;
    }

    .brand-logo {
        height: 26px;
    }

    .header-badge {
        font-size: 11px;
        padding: 2px 7px;
        white-space: nowrap;
    }

    .header-actions {
        gap: 6px;
    }

    .header-cta-btn {
        padding: 6px 8px;
    }

    .header-cta-btn span {
        display: none;
    }

    .toggle-container {
        flex-shrink: 0;
        margin-left: auto;
    }

    .toggle-switch {
        width: 42px;
        height: 22px;
    }

    .thumb {
        height: 16px;
        width: 16px;
        left: 2px;
        bottom: 2px;
    }

    .thumb i {
        font-size: 9.5px;
    }

    input:checked + .slider .thumb {
        transform: translateX(20px);
    }

    #tabsContainer {
        padding: 8px 10px;
    }

    .search-input-wrapper {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .search-input-wrapper input[type="text"] {
        flex: 1;
        min-width: 0;
        padding-right: 36px;
    }

    .search-input-wrapper .clear-button {
        right: 60px;
    }

    .filter-toggle-btn {
        display: inline-flex;
    }

    .filter-container {
        display: none;
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
        margin-bottom: 10px;
    }

    .filter-container.is-open {
        display: flex;
    }

    .filter-container select {
        width: 100%;
        min-width: 0;
    }

    th, td {
        padding: 6px 4px !important;
        font-size: 13px;
    }

    th {
        font-size: 11px !important;
        letter-spacing: -0.2px !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
    }

    /* Columna 1: Estrella / Favoritos (Tamaño intermedio equilibrado) */
    th:nth-child(1), td:not(.initial-empty-state-cell):nth-child(1) {
        width: 26px !important;
        font-size: 13.5px !important;
        white-space: nowrap !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        text-align: center !important;
    }

    /* Columna 2: Código (Fit exacto al badge) */
    th:nth-child(2), td:not(.initial-empty-state-cell):nth-child(2) {
        width: 1% !important;
        white-space: nowrap !important;
        padding-left: 2px !important;
        padding-right: 6px !important;
    }

    .badge-code {
        font-size: 10.5px !important;
        padding: 1px 5px !important;
        letter-spacing: -0.2px;
        display: inline-block;
    }

    /* Columna 3: Descripción (Ocupa todo el espacio restante disponible) */
    th:nth-child(3), td:not(.initial-empty-state-cell):nth-child(3) {
        width: auto !important;
        font-size: 13px;
        line-height: 1.35;
        padding-left: 4px !important;
        padding-right: 6px !important;
        word-break: break-word;
    }

    /* Columna 4: Copiar (Fit exacto a los 2 botones) */
    th:nth-child(4), td:not(.initial-empty-state-cell):nth-child(4) {
        width: 1% !important;
        white-space: nowrap !important;
        padding-left: 2px !important;
        padding-right: 4px !important;
        text-align: center !important;
    }

    .action-btn-group {
        gap: 2px !important;
    }

    .btn-icon {
        width: 26px !important;
        height: 26px !important;
        border-radius: 6px !important;
        font-size: 11px !important;
    }

    .documedic-footer {
        font-size: 11px;
        padding: 12px 8px;
        margin-bottom: calc(var(--tabbar-height) + 10px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}