/* ═══════════════════════════════════════════════
   SISTEMA CFDI — Hoja de estilos principal
   Paleta: #0d2137 / #1a3a5c / #2b66a6 / #e9f0f7
   Fuentes: Barlow Condensed (títulos) + Barlow (cuerpo)
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────── */
:root {
    --bg: #f0f4f9;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --border: #d4dfee;
    --border-light: #e9f0f7;

    --navy: #0d2137;
    --blue-dark: #1a3a5c;
    --blue: #2b66a6;
    --blue-light: #3d82c8;
    --blue-pale: #e9f0f7;
    --blue-pale-2: #d6e5f5;

    --text-primary: #0d2137;
    --text-secondary: #4a6a8a;
    --text-muted: #8aa5c0;

    --green: #1a7a4a;
    --red: #c0392b;
    --amber: #c97d10;

    --shadow-sm: 0 1px 3px rgba(13, 33, 55, .08), 0 1px 2px rgba(13, 33, 55, .04);
    --shadow-md: 0 4px 16px rgba(13, 33, 55, .10), 0 1px 4px rgba(13, 33, 55, .06);
    --shadow-lg: 0 12px 40px rgba(13, 33, 55, .14), 0 2px 8px rgba(13, 33, 55, .08);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --transition: all .18s ease;
}

/* ── Reset & Base ───────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Barlow', sans-serif;
    font-weight: 400;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.55;
}

/* ── Header ─────────────────────────────────── */
.header {
    background: var(--navy);
    border-bottom: 3px solid var(--blue);
    padding: 0 32px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    background: var(--blue);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.header-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.header-sub {
    font-size: .72rem;
    color: var(--blue-light);
    letter-spacing: .06em;
    text-transform: uppercase;
    display: block;
    line-height: 1.1;
    margin-top: 1px;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-btn {
    font-family: 'Barlow', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .65);
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .02em;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(43, 102, 166, .35);
    color: #fff;
}

.nav-btn.active {
    background: var(--blue);
    color: #fff;
}

/* ── Layout ─────────────────────────────────── */
.page-wrapper {
    max-width: 1160px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ── Card ───────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-2);
}

.card-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--blue-dark);
    letter-spacing: .04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    color: var(--blue);
}

.card-body {
    padding: 24px;
}

/* ── Drop Zone ──────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--blue-light);
    border-radius: var(--radius-lg);
    background: var(--blue-pale);
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(43, 102, 166, .06) 0%, transparent 70%);
    pointer-events: none;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--blue);
    background: var(--blue-pale-2);
    box-shadow: 0 0 0 4px rgba(43, 102, 166, .10);
}

.drop-zone.drag-over {
    transform: scale(1.005);
}

.drop-icon {
    width: 64px;
    height: 64px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 4px 16px rgba(43, 102, 166, .30);
    transition: var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(43, 102, 166, .40);
}

.drop-icon svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
    stroke-width: 1.8;
    fill: none;
}

.drop-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blue-dark);
    letter-spacing: .04em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.drop-sub {
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.drop-sub span {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 4px;
    letter-spacing: .04em;
}

#fileInput {
    display: none;
}

.btn-browse {
    font-family: 'Barlow', sans-serif;
    font-size: .85rem;
    font-weight: 600;
    color: var(--blue);
    background: var(--surface);
    border: 1.5px solid var(--blue);
    padding: 9px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: .02em;
}

.btn-browse:hover {
    background: var(--blue);
    color: #fff;
}

/* ── Upload Progress ────────────────────────── */
.upload-progress-wrap {
    margin-top: 20px;
    display: none;
}

.upload-progress-wrap.visible {
    display: block;
}

.progress-bar-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue) 0%, var(--blue-light) 100%);
    border-radius: 3px;
    width: 0%;
    transition: width .3s ease;
}

.progress-label {
    font-size: .78rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* ── Stats Bar ──────────────────────────────── */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-chip strong {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--blue-dark);
    font-family: 'Barlow Condensed', sans-serif;
}

.stat-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
}

.stat-chip .dot.green {
    background: var(--green);
}

.stat-chip .dot.amber {
    background: var(--amber);
}

/* ── Toast de errores ───────────────────────── */
#toast-errores {
    display: none;
    margin-top: 14px;
    background: #fff5f5;
    border: 1px solid #f5c6c6;
    border-left: 4px solid var(--red);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .82rem;
    color: var(--red);
}

#toast-errores ul {
    margin: 4px 0 0 16px;
}

/* ── Tabla de archivos ──────────────────────── */
.table-wrap {
    /* scroll virtual: altura fija con overflow */
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.table-wrap::-webkit-scrollbar {
    width: 6px;
}

.table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.xml-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.xml-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--navy);
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 11px 16px;
    text-align: left;
    border-bottom: 2px solid var(--blue);
    white-space: nowrap;
}

.xml-table thead th:last-child {
    text-align: center;
}

/* Anchos de columnas */
.col-num {
    width: 52px;
}

.col-nombre {
    /* auto */
}

.col-acc {
    width: 180px;
}

.xml-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background .12s;
    animation: rowIn .22s ease both;
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xml-table tbody tr:hover {
    background: var(--blue-pale);
}

.xml-table td {
    padding: 10px 16px;
    font-size: .84rem;
    color: var(--text-primary);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-num {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text-muted);
    text-align: center;
}

.td-nombre {
    font-weight: 500;
    color: var(--blue-dark);
}

.td-nombre .file-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: var(--blue-pale-2);
    border-radius: 3px;
    margin-right: 7px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    flex-shrink: 0;
    font-size: .62rem;
    font-weight: 700;
    color: var(--blue);
    text-align: center;
    line-height: 18px;
    letter-spacing: 0;
}

.td-acc {
    text-align: center;
}

.btn-acc-group {
    display: inline-flex;
    gap: 6px;
    justify-content: center;
}

/* Botones de acción de la tabla */
.btn-dl {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Barlow', sans-serif;
    font-size: .76rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: .02em;
    white-space: nowrap;
    text-decoration: none;
}

.btn-dl svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.btn-dl-excel {
    background: #e8f5ec;
    color: #1a7a4a;
    border-color: #b3d9bf;
}

.btn-dl-excel:hover {
    background: #1a7a4a;
    color: #fff;
    border-color: #1a7a4a;
}

.btn-dl-pdf {
    background: #fdecea;
    color: #c0392b;
    border-color: #f4b8b3;
}

.btn-dl-pdf:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--border);
    margin-bottom: 14px;
}

.empty-state p {
    font-size: .88rem;
}

/* ── Modal promo ────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 35, .72);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 750px;
    width: calc(100% - 32px);
    overflow: hidden;
    transform: translateY(16px) scale(.97);
    transition: transform .22s ease;
    position: relative;
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
}


.modal-promo-img {
    width: 100%;
    max-height: 500px;
    display: block;
    object-fit: contain;
}

.modal-footer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border-light);
    background: var(--surface-2);
}

.modal-footer p {
    font-size: .82rem;
    color: var(--text-secondary);
    flex: 1;
}

.btn-modal-close {
    font-family: 'Barlow', sans-serif;
    font-size: .82rem;
    font-weight: 600;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-modal-close:hover {
    background: var(--blue);
}

.btn-modal-demo {
    font-family: 'Barlow', sans-serif;
    font-size: .82rem;
    font-weight: 600;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-modal-demo:hover {
    background: var(--blue);
}


.modal-close-x {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, .45);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close-x:hover {
    background: rgba(0, 0, 0, .7);
}

/* ── Responsive básico ──────────────────────── */
@media (max-width: 640px) {
    .header {
        padding: 0 16px;
    }

    .header-sub {
        display: none;
    }

    .page-wrapper {
        padding: 20px 14px;
    }

    .card-body {
        padding: 16px;
    }

    .drop-zone {
        padding: 36px 16px;
    }

    .col-num {
        width: 38px;
    }

    .col-acc {
        width: 150px;
    }

    .btn-dl {
        font-size: .7rem;
        padding: 4px 9px;
    }
}