﻿body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
}

hr.dashed {
    border-top: 3px dashed #bbb;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #333;
}

input, button {
    padding: 10px;
    margin: 5px 0;
    width: 100%;
    box-sizing: border-box;
}

button {
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

    button:hover {
        background-color: #45a049;
    }

ul {
    list-style-type: none;
    padding: 0;
}

li {
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
}

.small-action-btn {
    font-size: 12px;
    padding: 2px 8px;
    margin-left: 4px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

    .small-action-btn.edit {
        background: #f0ad4e;
        color: #fff;
    }

    .small-action-btn.delete {
        background: #d9534f;
        color: #fff;
    }

    .small-action-btn.edit:hover {
        background: #ec971f;
    }

    .small-action-btn.delete:hover {
        background: #c9302c;
    }

.saved-trips-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
    gap: 8px;
}

    .saved-trips-container select,
    .saved-trips-container button {
        width: 180px;
        max-width: 100%;
        font-size: 1rem;
        padding: 8px 12px;
        box-sizing: border-box;
    }

    .saved-trips-container button {
        background: #4CAF50;
        color: #fff;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.2s;
    }

        .saved-trips-container button:hover {
            background: #388e3c;
        }

        .saved-trips-container button:nth-child(3) {
            background: #e53935;
            color: #fff;
            border: none;
            border-radius: 4px;
            margin-left: 8px;
            cursor: pointer;
            transition: background 0.2s;
        }

            .saved-trips-container button:nth-child(3):hover {
                background: #b71c1c;
            }

.expense-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

    .expense-table th, .expense-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }

    .expense-table th {
        background-color: #f2f2f2;
    }

    /* Đảm bảo các nút nằm trên một hàng và có khoảng cách */
    .expense-table button {
        display: inline-block;
        margin-right: 6px;
        padding: 4px 12px;
        border: none;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
    }

    /* Nút Sửa */
    .expense-table button.edit-btn {
        background-color: #1976d2;
        color: #fff;
    }

    .expense-table button.edit-btn:hover {
        background-color: #1565c0;
    }

    /* Nút Xóa */
    .expense-table button.delete-btn {
        background-color: #e53935;
        color: #fff;
    }

    .expense-table button.delete-btn:hover {
        background-color: #b71c1c;
    }

/* Đảm bảo bảng co giãn tốt trên mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* Cho phép cuộn ngang nếu bảng quá rộng */
}

/* Bảng tự co giãn, không bị bóp nhỏ quá */
.expense-table1 {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: auto;
    background: #fff;
}

/* Các ô cho phép xuống dòng */
.expense-table1 th, .expense-table1 td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
/*    white-space: normal;       Cho phép xuống dòng 
    word-break: break-word;    Tự động xuống dòng khi dài */
}

/* Cột chức năng nhỏ gọn, không tràn, cho phép xuống dòng */
.expense-table1 th:last-child,
.expense-table1 td:last-child {
    width: 80px;
    min-width: 50px;
    max-width: 100px;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    padding-left: 2px;
    padding-right: 2px;
}

/* Nút nhỏ gọn, icon căn giữa */
.expense-table1 .action-buttons {
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.expense-table1 button.edit-btn,
.expense-table1 button.delete-btn {
    padding: 2px 4px;
    min-width: 24px;
    height: 28px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 2px;
}

.expense-table1 button.edit-btn {
    background-color: #1976d2;
    color: #fff;
}
.expense-table1 button.edit-btn:hover {
    background-color: #1565c0;
}

.expense-table1 button.delete-btn {
    background-color: #e53935;
    color: #fff;
}
.expense-table1 button.delete-btn:hover {
    background-color: #b71c1c;
}

.expense-table1 button.edit-btn svg,
.expense-table1 button.delete-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.beneficiaries-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

    .beneficiaries-table th, .beneficiaries-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }
    .beneficiaries-table th {
        background-color: #f2f2f2;
    }

#memberList button {
    display: inline-block;
    margin-right: 6px;
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

/* Nút Sửa */
#memberList button.edit-btn {
    background-color: #1976d2;
    color: #fff;
}

#memberList button.edit-btn:hover {
    background-color: #1565c0;
}

/* Nút Xóa */
#memberList button.delete-btn {
    background-color: #e53935;
    color: #fff;
}

#memberList button.delete-btn:hover {
    background-color: #b71c1c;
}

#result {
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    background: #f9fff9;
    min-height: 40px;
    box-shadow: 0 2px 8px rgba(76,175,80,0.07);
}

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

.edit-btn, .delete-btn {
    padding: 4px 6px;
    min-width: 32px;
    height: 32px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 4px;
}

.edit-btn {
    background-color: #1976d2;
    color: #fff;
}
.edit-btn:hover {
    background-color: #1565c0;
}

.delete-btn {
    background-color: #e53935;
    color: #fff;
}
.delete-btn:hover {
    background-color: #b71c1c;
}

/* Đảm bảo icon không bị to quá */
.edit-btn svg, .delete-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.payer-name {
    color: #1976d2;
    font-weight: bold;
}
.receiver-name {
    color: #e53935;
    font-weight: bold;
}

.bank-info {
    color: #e53935;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.3);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    margin: auto;
    padding: 24px 20px 16px 20px;
    border-radius: 8px;
    max-width: 350px;
    min-width: 260px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

    .modal-content label {
        font-weight: bold;
        margin-top: 8px;
    }

    .modal-content input {
        width: 100%;
        padding: 8px;
        margin-bottom: 4px;
        box-sizing: border-box;
    }

    .modal-content button {
        margin-top: 10px;
    }

.close {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

    .close:hover {
        color: #e53935;
    }

/* Upload Bill Button Styles */
.upload-btn {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
    width: auto;
    min-width: 80px;
}

.upload-btn:hover {
    background-color: #F57C00;
}

/* Payment Status Styles */
.payment-status {
    color: #4CAF50;
    font-weight: bold;
    font-size: 12px;
}

/* Bill cell styling */
#result .expense-table td:last-child {
    text-align: center;
    min-width: 120px;
}

/* Bill modal styling */
.bill-modal {
    max-width: 500px;
    min-width: 300px;
}

.bill-modal img {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* View and Delete Bill buttons */
.view-bill-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-right: 4px;
    transition: background-color 0.3s;
}

.view-bill-btn:hover {
    background-color: #1976D2;
}

.delete-bill-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background-color 0.3s;
}

.delete-bill-btn:hover {
    background-color: #d32f2f;
}

/* Mobile responsive styles for memberList table */
@media (max-width: 768px) {
    /* Giảm padding cho các ô trên mobile */
    #memberList th, #memberList td {
        padding: 6px 4px;
        font-size: 14px;
    }

    /* Cột thao tác nhỏ gọn hơn */
    #memberList th:last-child,
    #memberList td:last-child {
        width: 80px;
        min-width: 70px;
    }

    /* Nút nhỏ gọn hơn trên mobile */
    #memberList button {
        padding: 3px 6px;
        font-size: 12px;
        margin-right: 2px;
    }

    /* Thông tin ngân hàng xuống dòng tốt hơn */
    #memberList .bank-info {
        font-size: 12px;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    /* Trên màn hình rất nhỏ, giảm thêm kích thước */
    #memberList th, #memberList td {
        padding: 4px 2px;
        font-size: 12px;
    }

    #memberList button {
        padding: 2px 4px;
        font-size: 11px;
    }
}