/* ============================================================
   HAMITO DATATABLE
   ============================================================ */

/* --- Contenedor Principal --- */
.ht-datatable-wrapper {
    position: relative;
}

/* --- Barra de Herramientas --- */
.ht-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: .85rem;
    flex-wrap: wrap;
}

.ht-search {
    position: relative;
    flex: 0 0 260px;
}

.ht-search input {
    width: 100%;
    padding: .5rem .85rem .5rem 2.3rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.83rem;
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    transition: border-color .2s, box-shadow .2s, background .2s;
    color: #1e293b;
}

.ht-search input:focus {
    outline: none;
    border-color: var(--primary-color, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, .08);
    background: #fff;
}

.ht-search::before {
    content: "\F52A";
    font-family: "bootstrap-icons";
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .8rem;
    pointer-events: none;
}

.ht-info {
    font-size: 0.76rem;
    color: #94a3b8;
    font-weight: 500;
}

/* --- Tabla Principal --- */
.ht-table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.ht-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    line-height: 1.4;
}

/* Encabezados */
.ht-table thead th {
    background: linear-gradient(180deg, #f0f4f8 0%, #e8edf3 100%);
    color: #3d5170;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .7rem .9rem;
    border-bottom: 2px solid #d1d9e0;
    white-space: nowrap;
    user-select: none;
    position: relative;
}

.ht-table thead th:first-child { border-radius: 8px 0 0 0; }
.ht-table thead th:last-child  { border-radius: 0 8px 0 0; }

.ht-table thead th.sortable {
    cursor: pointer;
    padding-right: 1.6rem;
    transition: background .15s;
}
.ht-table thead th.sortable:hover {
    background: linear-gradient(180deg, #e2e8f0 0%, #d8dfe8 100%);
    color: var(--primary-color, #1e3a5f);
}

.ht-table thead th.sortable::after {
    content: "\F148";
    font-family: "bootstrap-icons";
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .65rem;
    opacity: .35;
}
.ht-table thead th.sort-asc::after  { content: "\F145"; opacity: 1; color: var(--primary-color, #1e3a5f); }
.ht-table thead th.sort-desc::after { content: "\F13C"; opacity: 1; color: var(--primary-color, #1e3a5f); }

/* Celdas */
.ht-table tbody td {
    padding: .55rem .9rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.ht-table tbody tr {
    transition: background-color .1s;
}

/* Filas zebra */
.ht-table tbody tr:nth-child(even) td {
    background: #f9f9f9;
}
.ht-table tbody tr:nth-child(odd) td {
    background: #fff;
}

.ht-table tbody tr:hover td {
    background: #eef1f8 !important;
}

.ht-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Botón Expandir (+) --- */
.ht-expand-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .72rem;
    font-weight: 700;
    transition: all .2s;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.ht-expand-btn:hover {
    border-color: var(--primary-color, #1e3a5f);
    color: var(--primary-color, #1e3a5f);
    background: var(--primary-light, #e0e7ff);
}
.ht-expand-btn.expanded {
    background: var(--primary-color, #1e3a5f);
    border-color: var(--primary-color, #1e3a5f);
    color: #fff;
    transform: rotate(45deg);
}

/* Fila de detalle expandida */
.ht-detail-row td {
    padding: 0 !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0;
}
.ht-detail-content {
    padding: .7rem 1rem .7rem 3rem;
}
.ht-detail-item {
    display: flex;
    padding: .3rem 0;
    font-size: 0.81rem;
    border-bottom: 1px solid #f1f5f9;
}
.ht-detail-item:last-child { border-bottom: none; }
.ht-detail-label {
    font-weight: 600;
    color: #64748b;
    min-width: 120px;
    flex-shrink: 0;
    text-transform: uppercase;
    font-size: 0.69rem;
    letter-spacing: .3px;
    padding-top: .1rem;
}
.ht-detail-value { color: #334155; }

/* --- Paginación --- */
.ht-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .85rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.ht-pagination-info {
    font-size: 0.76rem;
    color: #94a3b8;
}
.ht-pagination-buttons {
    display: flex;
    gap: .2rem;
}
.ht-page-btn {
    padding: .32rem .6rem;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: 'Inter', sans-serif;
    min-width: 32px;
    text-align: center;
}
.ht-page-btn:hover:not(:disabled) {
    border-color: var(--primary-color, #1e3a5f);
    color: var(--primary-color, #1e3a5f);
    background: #eff6ff;
}
.ht-page-btn.active {
    background: var(--primary-color, #1e3a5f);
    border-color: var(--primary-color, #1e3a5f);
    color: #fff;
    font-weight: 600;
}
.ht-page-btn:disabled { opacity: .38; cursor: not-allowed; }

/* --- Estado vacío / cargando --- */
.ht-status {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
    font-size: 0.84rem;
}
.ht-status i {
    font-size: 2rem;
    display: block;
    margin-bottom: .5rem;
    opacity: .45;
}
.ht-loading-bar {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color, #1e3a5f), transparent);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    animation: htLoadingSlide 1.2s ease-in-out infinite;
    border-radius: 2px;
}
@keyframes htLoadingSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- Botones de Acción --- */
.ht-actions {
    display: flex;
    gap: .3rem;
    justify-content: center;
}
.ht-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all .18s;
    font-size: .8rem;
}
.ht-action-btn:hover {
    background: var(--primary-color, #1e3a5f);
    border-color: var(--primary-color, #1e3a5f);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.ht-action-btn.danger:hover  { background: #ef4444; border-color: #ef4444; }
.ht-action-btn.success:hover { background: #10b981; border-color: #10b981; }

/* --- Columna expand --- */
.ht-col-expand {
    width: 36px;
    text-align: center;
    padding-left: .5rem !important;
    padding-right: .25rem !important;
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .ht-search { flex: 1 1 100%; }
    .ht-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 575.98px) {
    .ht-table { font-size: .79rem; }
    .ht-table thead th { font-size: .68rem; padding: .48rem .65rem; }
    .ht-table tbody td { padding: .42rem .65rem; }
    .ht-pagination { flex-direction: column; align-items: center; }
    .ht-detail-content { padding-left: 1.5rem; }
}
