/* ==========================================================================
   Contabilidad General Express - Módulo Informe Libro Diario (JournalBook CSS)
   ========================================================================== */

.journalbook-wrapper {
    padding: 24px 32px;
    background-color: #f8fafc;
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Barra Superior */
.journalbook-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.journalbook-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.journalbook-topbar .page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.journalbook-topbar .company-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Tarjeta de Filtros */
.filters-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    box-shadow: var(--shadow-sm);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-action {
    justify-content: end;
}

/* Tarjeta del Documento Oficial */
.journalbook-document-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

/* Encabezado Oficial */
.report-header-box {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
}

.header-company-meta h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.header-company-meta p {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.header-title-box {
    text-align: right;
}

.report-main-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.report-subtitle-date {
    font-size: 0.825rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.report-stamp {
    display: inline-block;
    font-size: 0.675rem;
    font-weight: 700;
    color: #0284c7;
    background-color: #e0f2fe;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabla del Libro Diario */
.report-table-wrapper {
    overflow-x: auto;
}

.journalbook-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.journalbook-table th {
    background-color: #f1f5f9;
    color: #334155;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #cbd5e1;
    text-transform: uppercase;
    font-size: 0.775rem;
    letter-spacing: 0.5px;
}

.journalbook-table th.col-code {
    width: 160px;
    text-align: left;
}

.journalbook-table th.col-desc {
    text-align: left;
}

.journalbook-table th.col-amount {
    width: 180px;
    text-align: right !important;
}

.journalbook-table td.col-amount {
    text-align: right !important;
}

.journalbook-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.journalbook-table tr:hover td {
    background-color: #f8fafc;
}

.journalbook-table tr.row-group td {
    font-weight: 700;
    background-color: #f8fafc;
    color: #0f172a;
}

.journalbook-table tfoot tr td {
    font-weight: 700;
    font-size: 0.95rem;
    padding: 14px;
    border-top: 2px solid #0f172a;
    border-bottom: 2px double #0f172a;
    background-color: #f8fafc;
    color: #0f172a;
}

/* Botones Interactivos Drill-Down */
.drilldown-link {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    text-align: right;
    transition: all var(--transition-fast);
}

.drilldown-link:hover {
    background-color: #eff6ff;
    color: #1d4ed8;
    text-decoration: underline;
}

.credit-amount {
    color: #dc2626;
}

.credit-amount.drilldown-link:hover {
    background-color: #fef2f2;
    color: #b91c1c;
}

/* Tabla y Contenedor del Modal Drilldown */
#jb-drilldown-modal .modal-card {
    max-width: 1000px !important;
    width: 92vw !important;
}

.table-drilldown {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-drilldown th {
    background-color: #f1f5f9;
    padding: 12px 14px;
    font-weight: 700;
    color: #334155;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
    white-space: nowrap;
}

.table-drilldown td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
    vertical-align: top;
}

.table-drilldown td:nth-child(1) {
    white-space: nowrap;
    width: 110px;
}

.table-drilldown td:nth-child(2) {
    white-space: nowrap;
    width: 160px;
}

.table-drilldown td:nth-child(3) {
    min-width: 240px;
}

.table-drilldown td:nth-child(4) {
    white-space: nowrap;
    width: 140px;
}

.table-drilldown td:nth-child(5) {
    white-space: nowrap;
    width: 150px;
}

.table-drilldown tr.clickable-drilldown-row:hover td {
    background-color: #f0f9ff;
}

.table-drilldown tr.clickable-drilldown-row:hover .entry-ref-badge {
    background-color: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

/* Reglas de Impresión de Alta Densidad (Ahorro de Papel) */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 10mm 10mm 10mm;
    }
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    .main-header, .main-footer, .journalbook-topbar, .topbar-left, .topbar-right, .page-title, .company-subtitle, .btn-back-link, .filters-card, #jb-drilldown-modal {
        display: none !important;
    }
    .journalbook-wrapper {
        padding: 0 !important;
        min-height: auto !important;
        background-color: transparent !important;
    }
    .journalbook-document-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .report-header-box {
        padding-bottom: 8px !important;
        margin-bottom: 12px !important;
        border-bottom: 1.5px solid #000000 !important;
    }
    .header-company-meta h2 {
        font-size: 11pt !important;
        color: #000000 !important;
    }
    .header-company-meta p {
        font-size: 8.5pt !important;
        color: #333333 !important;
    }
    .report-main-title {
        font-size: 11pt !important;
        color: #000000 !important;
    }
    .report-subtitle-date {
        font-size: 8.5pt !important;
        color: #333333 !important;
    }
    .report-stamp {
        display: none !important;
    }
    .report-table-wrapper {
        overflow: visible !important;
    }
    .journalbook-table {
        display: table !important;
        width: 100% !important;
        font-size: 8.5pt !important;
        line-height: 1.15 !important;
    }
    .journalbook-table thead {
        display: table-header-group !important;
    }
    .journalbook-table tbody {
        display: table-row-group !important;
    }
    .journalbook-table tfoot {
        display: table-footer-group !important;
    }
    .journalbook-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .journalbook-table th {
        position: relative !important;
        padding: 5px 6px 7px 6px !important;
        font-size: 8pt !important;
        background-color: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        text-align: left !important;
    }
    .journalbook-table th::after {
        content: "" !important;
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 1.5px !important;
        background-color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .journalbook-table th.col-amount,
    .journalbook-table td.col-amount {
        text-align: right !important;
    }
    .journalbook-table td {
        padding: 3px 6px !important; /* Líneas compactas y juntas para máximo ahorro de papel */
        border-bottom: 1px solid #e2e8f0 !important;
    }
    .journalbook-table tfoot tr td {
        padding: 5px 6px !important;
        font-size: 9pt !important;
        border-top: 1.5px solid #000000 !important;
        border-bottom: 2px double #000000 !important;
    }
    .journalbook-table th,
    .journalbook-table td,
    .journalbook-table span,
    .journalbook-table a,
    .drilldown-link,
    .credit-amount {
        color: #000000 !important;
        background-color: transparent !important;
    }
    .drilldown-link {
        padding: 0 !important;
        color: #000000 !important;
        text-decoration: none !important;
        font-weight: 600 !important;
    }
}
