/* ====== CONTENEDOR GENERAL ====== */
.history-container{
    margin:0 auto;
    max-width:1280px;
    padding:28px 14px 20px;
    box-sizing:border-box;
}

/* ====== HEADER ====== */
.history-header{
    display:flex; align-items:center; justify-content:space-between;
    gap:.8rem; flex-wrap:wrap; margin-bottom:14px;
}
.history-title{ margin:0; font-weight:800; color:#e7eefc; }
.history-actions{ display:flex; align-items:center; gap:.6rem; }

/* Botones genéricos */
.btn{
    -webkit-appearance:none; appearance:none;
    background-clip:padding-box; background-repeat:no-repeat;
    padding:10px 16px; border-radius:1.7rem; border:1px solid transparent;
    font-weight:600; cursor:pointer; line-height:1;
    transition:transform .12s ease, filter .12s ease, background .18s ease;
}
.btn:hover{ transform:translateY(-1px); filter:brightness(.98); }
.btn:disabled{ opacity:.5; cursor:not-allowed; transform:none; }
.btn-primary{
    color:#fff;
    background-image:linear-gradient(90deg,#406aff 0%,#6be8fd 100%);
    box-shadow:0 3px 18px rgba(35,41,70,.15);
}
.btn-primary:hover{
    background-image:linear-gradient(90deg,#2954c6 0%,#4fd2e7 100%);
}
.btn-secondary{
    background:#fff; border:1px solid #e5e7eb; color:#232946;
}
.history-container .history-actions .btn,
.history-container .filters-actions .btn,
.history-container .history-pagination .btn{
    border-radius:1.7rem;
}

/* ====== FILTROS (CARD) */
.history-filters{
    background:#f6f8fb; border:1px solid #e5e7eb; border-radius:16px;
    padding:14px; box-shadow:0 3px 16px #23294612;
    margin:4px 0 16px;
}
.filters-row{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
    gap:12px;
    align-items:end;
}
@media(min-width:1024px){
    .filters-row:first-child{ grid-template-columns:200px 1fr 1fr 1fr; }
}
.filter-field{ min-width:0; }
.filter-label{
    display:block; font-weight:700; font-size:.9rem; margin:0 0 4px 2px; color:#4b68a7;
}
.filter-input{
    width:100%; padding:10px 12px; border:1px solid #e5e7eb; border-radius:12px;
    background:#fff; color:#232946; box-sizing:border-box;
}
.filter-input::placeholder{ color:#9aa3b2; }
.filters-actions{
    display:flex; gap:.6rem; flex-wrap:wrap; margin-top:10px;
    justify-content:flex-start;
}

/* ====== MENSAJES ====== */
.history-loading{ margin:6px 0; color:#4b68a7; }
.history-error{ margin:6px 0; color:#e94560; font-weight:700; }

/* ====== TABLA */
.history-table-container{
    width:100%;
    max-height:calc(100vh - 320px);
    overflow:auto;
    margin:6px 0 22px;
    padding:0 2px 14px;
    box-sizing:border-box;
    background:#f6f8fb; border:1px solid #e5e7eb; border-radius:16px;
    box-shadow:0 3px 16px #23294612;

    /* === Scrollbar (mismo diseño que inventario) === */
    scrollbar-width: thin;                 /* Firefox */
    scrollbar-color: #b6c2d6 transparent;  /* Firefox */
}
.history-table-container::-webkit-scrollbar{ /* Chrome/Edge/Safari */
    height:10px; width:10px;
}
.history-table-container::-webkit-scrollbar-thumb{
    border-radius:10px; background:#b6c2d6;
}
.history-table-container::-webkit-scrollbar-thumb:hover{
    background:#94a3b8;
}

.history-table{
    width:100%; min-width:1000px;
    border-collapse:separate; border-spacing:0;
    color:#232946; font-size:.98rem;
}
.history-table th,
.history-table td{
    padding:12px 12px; text-align:left; white-space:nowrap;
}
.history-table thead th{
    position:sticky; top:0; z-index:5;
    background:#eaf3ff; color:#4b68a7; font-weight:800;
    border-bottom:2px solid #e1eaf2;
    backdrop-filter:blur(4px);
}
.history-table tbody tr:nth-child(even){ background:#f4f6fa; }
.history-table tbody tr:nth-child(odd){  background:#f6f8fb; }
.history-table tbody tr:hover{ background:#e0ebff; }
.history-table td{ border-bottom:1px solid #e1eaf2; }
.history-empty{ text-align:center; padding:16px; color:#4b68a7; }

/* Ordenable */
.th.sortable{ cursor:pointer; user-select:none; }
.th.sortable:hover{ background:#f7f7fb; }
.th.sorted-asc, .th.sorted-desc{ color:#232946; }

/* Alineaciones/anchos sugeridos */
.num{ text-align:right; }
.w-tipo{ width:120px; }
.w-fecha{ width:140px; }
.w-talla{ width:120px; }
.w-lote{ width:120px; }
.w-num{ width:120px; }

/* Botón acción */
.w-action { width: 96px; }
.cell-action { white-space: nowrap; }
.btn-xxs {
    padding: 4px 8px;
    font-size: 0.78rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
.btn-revert {
    background: #ef4444;
    color: #fff;
}
.btn-revert:hover { filter: brightness(0.92); }
.btn-revert:active { transform: translateY(1px); }

/* ====== PAGINACIÓN ====== */
.history-pagination{
    display:flex; justify-content:space-between; align-items:center;
    gap:.75rem; flex-wrap:wrap; margin:4px 0 34px;
    font-size:.95rem; color:#232946;
}
.page-info{ opacity:.9; }
.page-actions{ display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.limit-label{ margin-left:4px; margin-right:4px; color:#6b7280; }
.select.limit-select{
    padding:8px 10px; border:1px solid #e5e7eb; border-radius:10px; background:#fff; color:#232946;
}

/* ====== MODALES ====== */
.modal-overlay{
    position:fixed; inset:0; padding:16px;
    display:flex; align-items:center; justify-content:center;
    background:rgba(0,0,0,.45);
    z-index:1000;
}
.modal-card{
    width:min(520px, 92vw);
    background:#fff; color:#232946;
    border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.2);
    overflow:hidden;
}
.modal-header{
    padding:16px 18px; border-bottom:1px solid #e5e7eb; background:#f9fafb;
}
.modal-title{
    margin:0; font-weight:800; color:#232946; font-size:1.15rem;
}
.modal-body{ padding:16px 18px; }
.modal-actions{
    padding:14px 18px; display:flex; gap:.6rem; justify-content:flex-end;
    background:#f9fafb; border-top:1px solid #e5e7eb;
}

/* Loader modal reutilizando estilos de modal */
.modal-loading {
    text-align: center;
    width: 360px;
}

.spinner {
    width: 32px;
    height: 32px;
    margin: 8px auto 12px;
    border: 3px solid #e5e7eb;
    border-top-color: #406aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Por si no lo tienes ya */
.btn[disabled] { opacity: .6; cursor: not-allowed; }


/* ====== RESPONSIVE ====== */
@media(max-width:1100px){ .history-table{ min-width:900px; } }
@media(max-width:900px){  .history-table{ min-width:800px; } }
@media(max-width:700px){
    .history-container{ padding:18px 10px 16px; }
    .history-table{ min-width:650px; font-size:.95rem; }
    .history-table th, .history-table td{ padding:10px 9px; }
}
@media(max-width:560px){ .history-table{ min-width:560px; font-size:.92rem; } }
