/* ── Page header ── */
.history-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.8rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid #eef2ff;
}

.history-page-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.history-page-title i {
    color: #4f46e5;
    font-size: 1.3rem;
}

.history-badge {
    background: #eef2ff;
    color: #4f46e5;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
}

/* ── Search / filter bar ── */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.history-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.history-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    font-size: 0.9rem;
    background: #f8fafc;
    outline: none;
    transition: 0.2s;
    min-height: unset;
    resize: none;
}

.history-search input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: #fff;
}

.history-search .search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

[dir="rtl"] .history-search input {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
}

[dir="rtl"] .history-search .search-icon {
    left: unset;
    right: 0.9rem;
}

.history-sort-select {
    padding: 0.6rem 1.1rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.88rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    outline: none;
    min-width: 160px;
}

.history-sort-select:focus {
    border-color: #4f46e5;
}

/* ── Table ── */
.history-table-wrapper {
    border-radius: 1.4rem;
    overflow: hidden;
    border: 1px solid #edf2f7;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.history-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid #edf2f7;
    white-space: nowrap;
}

.history-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

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

.history-table tbody tr:hover {
    background: #f8fafc;
}

.history-table td {
    padding: 0.9rem 1.2rem;
    vertical-align: middle;
    color: #1e293b;
}

/* Name cell */
.video-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.video-thumb-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-thumb-icon i {
    color: #4f46e5;
    font-size: 1rem;
}

.video-title-text {
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
    max-width: 550px;
}

.video-ext-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #6366f1;
    background: #eef2ff;
    border-radius: 0.3rem;
    padding: 0.1rem 0.45rem;
    margin-top: 0.18rem;
    text-transform: uppercase;
}

/* Date cell */
.date-cell {
    color: #475569;
    font-size: 0.88rem;
    white-space: nowrap;
}

.date-cell .time-sub {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

/* Size cell */
.size-cell {
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.size-cell .size-unit {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.82rem;
}

/* Actions */
.actions-cell {
    white-space: nowrap;
}

.btn-action-dl {
    background: #0f172a;
    color: #fff;
    border: none;
    padding: 0.38rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
}

.btn-action-dl:hover {
    background: #1e293b;
    transform: scale(1.03);
    color: #fff;
}

.btn-action-del {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 0.38rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action-del:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* ── Empty state ── */
.history-empty {
    text-align: center;
    padding: 3.5rem 1rem;
    color: #94a3b8;
}

.history-empty i {
    font-size: 3rem;
    color: #c7d2fe;
    margin-bottom: 1rem;
    display: block;
}

.history-empty p {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: #64748b;
}

.history-empty span {
    font-size: 0.88rem;
}

/* ── Pagination ── */
.history-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}

/* ── Delete confirm modal ── */
.modal-confirm .modal-header {
    background: #fff5f5;
    border-bottom: 1px solid #fee2e2;
}

.modal-confirm .modal-title {
    color: #dc2626;
    font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 768px) {

    .history-table thead th:nth-child(3),
    .history-table tbody td:nth-child(3) {
        display: none;
    }

    .btn-action-dl span,
    .btn-action-del span {
        display: none;
    }

    .video-title-text {
        max-width: 160px;
    }
}

@media (max-width: 480px) {

    .history-table thead th:nth-child(2),
    .history-table tbody td:nth-child(2) {
        display: none;
    }
}