/* ====================================================
   LICHSU.CSS - CSS chuyên dụng cho trang Lịch Sử Thông Số
   Dự án: Quản Lý Dự Án IoT - Bộ Lọc Chủ Động 1 Pha
   ==================================================== */

/* --- Thẻ thông kê nhanh trên cùng --- */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-overview-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(27, 75, 54, 0.08);
    border-left: 5px solid var(--primary-dark);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-overview-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(27, 75, 54, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(40, 167, 69, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #28a745;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(23, 162, 184, 0.12);
    color: #17a2b8;
}

.stat-icon.orange {
    background: rgba(253, 126, 20, 0.12);
    color: #fd7e14;
}

.stat-icon.purple {
    background: rgba(111, 66, 193, 0.12);
    color: #6f42c1;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1b4b36;
    margin-top: 2px;
}

/* --- Card Lịch Sử --- */
.history-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 8px 28px rgba(13, 45, 30, 0.08);
    border: 1px solid rgba(27, 75, 54, 0.16);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.history-card:hover {
    box-shadow: 0 12px 36px rgba(13, 45, 30, 0.12);
    border-color: rgba(0, 230, 118, 0.4);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 230, 118, 0.22);
    flex-wrap: wrap;
    gap: 15px;
}

.history-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.history-card-title i {
    font-size: 20px;
    color: #28a745;
}

/* --- Thanh công cụ Quản lý & Nút Xóa --- */
.toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    background: #f8faf9;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #e2ebe6;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.select-all-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    cursor: pointer;
    user-select: none;
    padding-right: 12px;
    border-right: 2px solid #dde6e1;
}

/* Checkbox tuỳ biến chất lượng cao */
.custom-checkbox {
    width: 19px;
    height: 19px;
    cursor: pointer;
    accent-color: #1b4b36;
    border-radius: 4px;
    transition: all 0.2s;
}

/* --- Các nút bấm chức năng (Buttons) --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.35);
}

.btn-danger-dark {
    background-color: #8c1a26;
    color: white;
}

.btn-danger-dark:hover:not(:disabled) {
    background-color: #72141f;
}

.btn-secondary {
    background-color: #ffffff;
    color: #495057;
    border: 1px solid #ced4da;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #e9ecef;
    color: #212529;
}

.btn-success {
    background-color: #1b4b36;
    color: white;
    box-shadow: 0 4px 12px rgba(27, 75, 54, 0.25);
}

.btn-success:hover:not(:disabled) {
    background-color: #256a4b;
    box-shadow: 0 6px 16px rgba(27, 75, 54, 0.35);
}

.btn-export {
    background-color: #207245;
    color: white;
}

.btn-export:hover:not(:disabled) {
    background-color: #175332;
}

/* --- Thanh tìm kiếm (Search Input) --- */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    color: #889891;
    font-size: 14px;
    pointer-events: none;
}

.search-input {
    padding: 9px 15px 9px 38px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 13.5px;
    width: 260px;
    transition: all 0.25s;
    background: #ffffff;
    color: #333;
}

.search-input:focus {
    outline: none;
    border-color: #1b4b36;
    box-shadow: 0 0 0 3px rgba(27, 75, 54, 0.15);
}

/* --- Bảng thông số (Table) --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    flex: 1;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: center;
    white-space: normal;
    table-layout: auto;
}

.history-table thead {
    background-color: #1b4b36;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.history-table th {
    padding: 11px 8px;
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #143727;
    vertical-align: middle;
    text-align: center;
    line-height: 1.35;
}

.history-table th i {
    margin-right: 4px;
    opacity: 0.85;
}

.history-table td {
    padding: 11px 8px;
    border-bottom: 1px solid #e9ecef;
    color: #333333;
    transition: background-color 0.2s;
    vertical-align: middle;
    text-align: center;
}

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

.history-table tbody tr.selected {
    background-color: #e3f2ec !important;
}

.history-table td.val-voltage {
    font-weight: 700;
    color: #1b4b36;
}

.history-table td.val-current {
    font-weight: 700;
    color: #0c5460;
}

.history-table td.val-if {
    font-weight: 700;
    color: #d39e00;
}

/* --- Badges trạng thái --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Nút xóa từng dòng */
.btn-row-delete {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 15px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-row-delete:hover {
    background: rgba(220, 53, 69, 0.12);
    transform: scale(1.15);
}

/* --- Phân trang và thống kê chân bảng --- */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13.5px;
    color: #6c757d;
}

.pagination {
    display: flex;
    gap: 6px;
}

.page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background: #ffffff;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(.disabled) {
    background: #e9ecef;
}

.page-btn.active {
    background: #1b4b36;
    color: white;
    border-color: #1b4b36;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: default;
}

/* --- Thông báo Toast --- */
.history-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1b4b36;
    color: white;
    padding: 14px 22px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.history-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.history-toast i {
    font-size: 18px;
    color: #a8e6cf;
}
