/* =============================================
   Desarrollo – Hoja Consulta COFEPRIS
   Swiss Design / Premium Document
   ============================================= */

/* ── Typography (Caveat for signatures) ────── */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&display=swap');

/* ── Design Tokens (shared palette with CC) ── */
:root {
    --hc-base: #1e293b;
    --hc-base-mid: #334155;
    --hc-accent: #478978;
    --hc-ice: #f8f9fa;
    --hc-border: #e2e8f0;
    --hc-text: #1e293b;
    --hc-text-muted: #64748b;
    --hc-text-light: #94a3b8;
    --hc-white: #ffffff;
    --hc-font-head: 'Inter', 'Helvetica Neue', 'Segoe UI', sans-serif;
    --hc-font-body: 'Inter', 'Roboto', 'Open Sans', system-ui, sans-serif;
    --hc-font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', 'Consolas', monospace;
    --hc-rule-thin: 0.5px;
    --hc-rule-thick: 0.75px;
    --hc-rule-heavy: 1.5px;
    --hc-rule-color: #334155;
}

/* ── Layout Shell ────────────────────────────── */
.hc-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
}

/* ── Toolbar ─────────────────────────────────── */
.hc-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 1.25rem;
    background: var(--pv-card-surface);
    border-bottom: 1px solid var(--pv-card-border);
    backdrop-filter: var(--pv-glass-blur);
    flex-shrink: 0;
    z-index: 10;
}

.hc-toolbar__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.hc-toolbar__icon {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--pv-text-muted);
}

.hc-toolbar__heading {
    font-size: var(--pv-text-sm);
    font-weight: 700;
    color: var(--pv-text-primary);
    white-space: nowrap;
}

/* ── Search ──────────────────────────────────── */
.hc-search {
    position: relative;
    flex: 1;
    max-width: 28rem;
}

.hc-search__input {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: var(--pv-text-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--pv-card-border);
    color: var(--pv-text-primary);
    border-radius: var(--pv-input-radius);
    transition: border-color var(--pv-duration-fast) ease, box-shadow var(--pv-duration-fast) ease;
}

.hc-search__input::placeholder {
    color: var(--pv-text-secondary);
}

.hc-search__input:focus {
    outline: none;
    border-color: var(--pv-accent);
    box-shadow: var(--pv-glow-accent);
}

.hc-search__toggle {
    position: absolute;
    inset: 0 0 0 auto;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-text-muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color var(--pv-duration-fast) ease;
}

.hc-search__toggle:hover {
    color: var(--pv-text-primary);
}

.hc-search__chevron {
    width: 1rem;
    height: 1rem;
}

.hc-search__results {
    position: absolute;
    z-index: 50;
    margin-top: 0.25rem;
    width: 100%;
    background: var(--pv-card-surface-solid);
    border: 1px solid var(--pv-card-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    max-height: 15rem;
    overflow-y: auto;
    color: var(--pv-text-primary);
    text-align: left;
}

.hc-search__results>div:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* ── CTA Button ──────────────────────────────── */
.hc-btn-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    height: 36px;
    padding: 0 1.125rem;
    border: none;
    border-radius: var(--pv-input-radius);
    background: var(--pv-accent);
    color: #fff;
    font-size: var(--pv-text-sm);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    transition: background var(--pv-duration-fast) ease,
        box-shadow var(--pv-duration-fast) ease,
        transform 0.1s ease;
}

.hc-btn-cta:hover {
    background: var(--pv-accent-hover);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.hc-btn-cta:active {
    transform: scale(0.97);
}

.hc-btn-cta__icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ── Document Viewport ───────────────────────── */
.hc-document-viewport {
    flex: 1;
    background: rgba(10, 14, 26, 0.6);
    padding: 2.5rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

/* ── Paper Sheet ─────────────────────────────── */
#cofepris-doc-preview {
    background: #ffffff !important;
    color: var(--hc-text) !important;
    font-family: var(--hc-font-body) !important;
    font-size: 10.5px;
    line-height: 1.65;
    border-radius: 0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Force dark text */
#cofepris-doc-preview :where(div, span, td, th, p, h1, h2, h3, li, label) {
    color: #1e293b;
}

/* ── Letterhead ──────────────────────────────── */
.hc-letterhead {
    padding: 20mm 25mm 0 25mm;
}

.hc-logo img {
    height: 28px;
    width: auto;
    display: block;
}

.hc-accent-bar {
    height: 0.5pt;
    background: var(--hc-accent);
    margin-top: 8px;
    margin-bottom: 14px;
}

/* ── Date Line ───────────────────────────────── */
.hc-date {
    text-align: right;
    font-family: var(--hc-font-body);
    font-size: 9.5px;
    color: var(--hc-text-muted);
    margin-bottom: 20px;
}

/* ── Addressee ───────────────────────────────── */
.hc-addressee {
    font-family: var(--hc-font-head);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--hc-base);
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── Subject Line ────────────────────────────── */
.hc-subject {
    text-align: right;
    margin-bottom: 20px;
}

.hc-subject p {
    font-family: var(--hc-font-head);
    font-size: 9.5px;
    font-weight: 700;
    color: var(--hc-base);
}

/* ── Body Text ───────────────────────────────── */
.hc-body-text {
    font-family: var(--hc-font-body);
    font-size: 10px;
    color: var(--hc-text);
    text-align: justify;
    margin-bottom: 20px;
    line-height: 1.7;
}

/* ── Section Headings ────────────────────────── */
.hc-section-num {
    font-family: var(--hc-font-head);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hc-base);
    margin-bottom: 8px;
}

.hc-section-num span {
    margin-right: 6px;
}

/* ── Description List (product details) ──────── */
.hc-desc-list {
    padding-left: 20px;
    font-family: var(--hc-font-body);
    font-size: 10px;
    color: var(--hc-text);
    line-height: 1.8;
}

.hc-desc-list .hc-arrow {
    color: var(--hc-accent);
    font-weight: 700;
    margin-right: 4px;
}

.hc-desc-list .hc-field-value {
    font-weight: 700;
    color: var(--hc-base);
}

/* ── Booktabs Formula Table ──────────────────── */
.hc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
    font-family: var(--hc-font-body);
    margin-top: 4px;
    margin-bottom: 16px;
}

.hc-table thead {
    border-top: var(--hc-rule-heavy) solid var(--hc-rule-color);
}

.hc-table thead th {
    font-family: var(--hc-font-head);
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hc-text-muted);
    padding: 5px 8px;
    border: none;
    border-bottom: var(--hc-rule-thick) solid var(--hc-rule-color);
    background: transparent;
}

.hc-table thead th:first-child {
    text-align: left;
}

.hc-table thead th:not(:first-child) {
    text-align: center;
}

.hc-table tbody td {
    padding: 4px 8px;
    border: none;
    border-bottom: var(--hc-rule-thin) solid var(--hc-border);
    color: var(--hc-text);
    font-size: 9px;
    vertical-align: top;
}

/* Zebra striping */
.hc-table tbody tr:nth-child(even) {
    background: var(--hc-ice);
}

/* Bottom rule on last row */
.hc-table tbody tr:last-child td {
    border-bottom: var(--hc-rule-heavy) solid var(--hc-rule-color);
}

/* Cell types */
.hc-td-name {
    font-weight: 600;
    text-align: left;
    color: var(--hc-text);
}

.hc-td-num {
    font-family: var(--hc-font-mono);
    font-size: 8.5px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--hc-text);
}

.hc-td-func {
    text-align: left;
    font-style: italic;
    color: var(--hc-text-muted);
    font-size: 8.5px;
}

/* Equivalence sub-lines */
.hc-equiv-line {
    font-size: 8px;
    color: var(--hc-text-muted);
    font-style: italic;
}

/* Quick-edit link to Maestro de Materiales */
.hc-edit-link {
    display: inline-block;
    font-style: normal;
    font-size: 10px;
    color: var(--hc-accent);
    text-decoration: none;
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.hc-edit-link:hover {
    opacity: 1;
    color: #3b82f6;
}

/* ── Usage / Label Sections ──────────────────── */
.hc-content-text {
    font-family: var(--hc-font-body);
    font-size: 10px;
    color: var(--hc-text);
    line-height: 1.7;
    padding-left: 20px;
}

/* ── Signature Block ─────────────────────────── */
.hc-signature {
    width: 280px;
    margin: 40px auto 0;
    text-align: center;
}

.hc-sig-handwriting {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    font-weight: 600;
    color: var(--hc-base);
    line-height: 1.1;
    margin-bottom: 2px;
}

.hc-sig-line {
    width: 220px;
    border-bottom: 0.5px solid var(--hc-text-light);
    margin: 0 auto 4px;
}

.hc-sig-name {
    font-family: var(--hc-font-head);
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--hc-base);
    margin-bottom: 2px;
}

.hc-sig-title {
    font-family: var(--hc-font-body);
    font-size: 8px;
    color: var(--hc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hc-sig-company {
    font-family: var(--hc-font-head);
    font-size: 8px;
    font-weight: 700;
    color: var(--hc-base);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ── Footer Bar (Minimal white 3-column) ─────── */
.hc-footer-bar {
    background: #ffffff;
    border-top: 0.5pt solid #CBD5E1;
    padding: 8px 25mm 10px;
    margin-top: auto;
}

.hc-footer-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    font-family: var(--hc-font-body);
    font-size: 7px;
    color: #64748B;
    line-height: 1.55;
}

.hc-footer-inner span,
.hc-footer-inner div {
    color: #64748B !important;
}

.hc-footer-col {
    flex: 1;
}

.hc-footer-left {
    text-align: left;
}

.hc-footer-center {
    text-align: center;
    flex: 0 0 auto;
    padding: 0 16px;
    align-self: center;
}

.hc-footer-right {
    text-align: right;
}

.hc-footer-confidential {
    font-style: italic;
    color: #94a3b8 !important;
    font-size: 6.5px;
}

.hc-footer-docref {
    font-size: 6.5px;
    color: #94a3b8 !important;
}

.hc-footer-page {
    font-weight: 600;
    font-size: 7px;
    color: #475569 !important;
}

.hc-footer-company-name {
    font-weight: 600;
    font-size: 7px;
    letter-spacing: 0.02em;
    color: #475569 !important;
}

.hc-footer-contact {
    font-size: 6.5px;
    color: #94a3b8 !important;
    white-space: nowrap;
}



/* ── Criteria Checkbox Card ──────────────────── */
.cofepris-criteria-card:has(:checked) {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.4);
}

/* ── Print Optimizations ─────────────────────── */
@media print {
    #cofepris-doc-preview {
        box-shadow: none !important;
        border: none !important;
    }

    .hc-edit-link {
        display: none !important;
    }

    .hc-footer-bar,
    .hc-accent-bar,
    .hc-table tbody tr:nth-child(even) {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}