﻿body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #f8f9fa;
    color: #343a40;
    margin: 0;
    padding: 1rem;
}

/* Title */
h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

/* Table style */
table {
    width: 100%;
    font-size: 13px;
    table-layout: fixed;
    border-collapse: collapse;
}

th, td {
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
}

thead th {
    background-color: #198754 !important; /* Bootstrap green */
    color: #fff;
    font-weight: 600;
}

tbody tr:hover {
    background-color: #eef8f1;
}

tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

table input {
    width: 100%;
    padding: 4px 6px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

    table input:focus {
        border-color: #198754;
        background-color: #f9fff9;
        outline: none;
    }

/* Các ô input ở cột 2 và 3 */
td:nth-child(2) input,
td:nth-child(3) input {
    background-color: #f5f8fa;
    border: none;
    font-weight: 600;
    cursor: default;
    text-align: left;
}

td:nth-child(2) input {
    color: #2c3e50;
    padding-left: 6px;
}

td:nth-child(3) input {
    color: #495057;
    text-align: center;
}

pre {
    background: #f8f9fa;
    padding: 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 1rem;
}

/* Button group and flex container */
.button-group,
.d-flex.gap-2 {
    flex-wrap: wrap;
    row-gap: 10px;
}

/* Responsive styles */
@media (max-width: 768px) {

    .table-responsive {
        overflow-x: auto; /* Cho phép trượt ngang */
    }

    table {
        font-size: 12px;
        width: auto; /* Bảng không bắt buộc full width */
        min-width: 600px; /* Giữ bảng không quá nhỏ */
        table-layout: auto; /* Cột co giãn */
    }

    th, td {
        padding: 6px;
        white-space: nowrap; /* Không xuống dòng */
    }

    h3 {
        font-size: 1.2rem;
    }

    /* Select và button full width 48% (2 nút ngang) */
    select.form-select,
    .btn {
        width: 48%;
    }

    /* Inputs nhỏ hơn */
    td input {
        font-size: 12px;
    }

    pre {
        font-size: 12px;
    }

    /* Button row container */
    .button-row {
        display: flex;
        flex-direction: row; 
        gap: 10px; 
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: visible;
        padding-bottom: 0.5rem;
    }
}

@media (max-width: 769px) {

    .button-row {
        display: flex;
        flex-wrap: wrap; 
        gap: 0.5rem;
        justify-content: center;
        overflow-x: visible;
        padding-bottom: 0;
    }

        .button-row > button {
            flex: 1 1 auto; 
            min-width: 120px;
            width: 47%;
        }
}

.table-nowrap td,
.table-nowrap th {
    max-width: 180px;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
    font-size: 0.9rem;
    padding: 0.4rem;
}

@media (max-width: 768px) {
    .table-nowrap {
        font-size: 0.8rem;
    }

        .table-nowrap td,
        .table-nowrap th {
            max-width: 120px;
            padding: 0.3rem;
        }

        .table-nowrap button {
            font-size: 0.75rem;
            padding: 0.2rem 0.4rem;
        }
}

