.lph-log-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.lph-log-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.lph-log-tabs .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.lph-log-tabs .nav-link.active {
    background: var(--primary);
    color: #ffffff;
}

.lph-log-toolbar {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 0.8fr) minmax(420px, 1.6fr);
    gap: 12px;
    margin-left: 0;
    margin-right: 0;
}

.lph-log-toolbar > [class*="col-"] {
    width: auto;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

.lph-log-actions-col {
    grid-column: 1 / -1;
}

.lph-log-toolbar .btn {
    white-space: nowrap;
}

.lph-log-toolbar .form-control,
.lph-log-toolbar .searchable-select-wrapper {
    width: 100%;
}

.lph-log-toolbar .searchable-select-input {
    min-height: 38px;
}

.lph-log-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    width: 100%;
}

.lph-log-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 82px;
}

.lph-log-actions .btn-sm {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.lph-log-actions .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.lph-log-actions .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff;
}

.lph-log-actions .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
}

.lph-log-actions .btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
    color: #ffffff;
}

.lph-log-actions .btn-success {
    background-color: #198754;
    border-color: #198754;
    color: #ffffff;
}

.lph-log-actions .btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #ffffff;
}

.lph-date-range-group {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
}

.lph-date-range-group .form-control {
    min-width: 128px;
}

.lph-date-range-group .input-group-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.lph-date-range-group .input-group-text + .form-control,
.lph-date-range-group .form-control + .input-group-text,
.lph-date-range-group .input-group-text + .input-group-text {
    margin-left: -1px;
}

.lph-date-range-group .input-group-text:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.lph-date-range-group .input-group-text:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.lph-log-table-shell {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: #ffffff;
    max-width: 100%;
    overflow: hidden;
}

.lph-log-table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.lph-log-table th:nth-child(1),
.lph-log-table td:nth-child(1) {
    width: 15%;
}

.lph-log-table th:nth-child(2),
.lph-log-table td:nth-child(2) {
    width: 12%;
}

.lph-log-table th:nth-child(3),
.lph-log-table td:nth-child(3) {
    width: 13%;
}

.lph-log-table th:nth-child(4),
.lph-log-table td:nth-child(4) {
    width: 10%;
}

.lph-log-table th:nth-child(5),
.lph-log-table td:nth-child(5) {
    width: 20%;
}

.lph-log-table th:nth-child(6),
.lph-log-table td:nth-child(6) {
    width: 30%;
}

.lph-log-table th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    background: #f8fafc;
}

.lph-log-table th,
.lph-log-table td {
    padding: 14px 16px;
    vertical-align: top;
    font-size: 13px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.log-principal {
    font-weight: 700;
}

.log-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.module-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    background: var(--secondary-light);
    color: var(--secondary);
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1500px) {
    .lph-log-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .lph-log-toolbar {
        grid-template-columns: 1fr;
    }

    .lph-log-table th,
    .lph-log-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .lph-log-table th {
        font-size: 11px;
    }
}

@media (max-width: 520px) {
    .lph-date-range-group {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .lph-date-range-group .input-group-text,
    .lph-date-range-group .form-control {
        width: 100%;
        margin-left: 0;
        border-radius: 0;
    }

    .lph-date-range-group .input-group-text:first-child {
        border-radius: var(--radius-md) 0 0 0;
    }

    .lph-date-range-group .form-control:nth-child(2) {
        border-radius: 0 var(--radius-md) 0 0;
    }

    .lph-date-range-group .input-group-text:last-child {
        grid-column: 1 / -1;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}

/* 登入紀錄專用樣式 */
.lph-log-table.login-log-table th:nth-child(1),
.lph-log-table.login-log-table td:nth-child(1) {
    width: 15%;
}

.lph-log-table.login-log-table th:nth-child(2),
.lph-log-table.login-log-table td:nth-child(2) {
    width: 20%;
}

.lph-log-table.login-log-table th:nth-child(3),
.lph-log-table.login-log-table td:nth-child(3) {
    width: 20%;
}

.lph-log-table.login-log-table th:nth-child(4),
.lph-log-table.login-log-table td:nth-child(4) {
    width: 15%;
}

.lph-log-table.login-log-table th:nth-child(5),
.lph-log-table.login-log-table td:nth-child(5) {
    width: 30%;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.status-success {
    background: var(--success-light);
    color: var(--success);
}

.status-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.status-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* 錯誤紀錄專用樣式 */
.lph-log-table.error-log-table th:nth-child(1),
.lph-log-table.error-log-table td:nth-child(1) {
    width: 15%;
}

.lph-log-table.error-log-table th:nth-child(2),
.lph-log-table.error-log-table td:nth-child(2) {
    width: 10%;
}

.lph-log-table.error-log-table th:nth-child(3),
.lph-log-table.error-log-table td:nth-child(3) {
    width: 10%;
}

.lph-log-table.error-log-table th:nth-child(4),
.lph-log-table.error-log-table td:nth-child(4) {
    width: 20%;
}

.lph-log-table.error-log-table th:nth-child(5),
.lph-log-table.error-log-table td:nth-child(5) {
    width: 30%;
}

.lph-log-table.error-log-table th:nth-child(6),
.lph-log-table.error-log-table td:nth-child(6) {
    width: 15%;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.level-error {
    background: var(--danger-light);
    color: var(--danger);
}

.level-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.level-info {
    background: var(--secondary-light);
    color: var(--secondary);
}

.trace-id {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
}

#pagination-container.pagination-bar {
    margin-top: 24px;
}

#pagination-container .pagination-info {
    min-width: 150px;
    text-align: center;
}
