body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: auto;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.header h1 {
    margin: 0;
    flex: 1 1;
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex: 1 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.add-button,
.report-button,
.import-button,
.export-button {
    background: #2ecc71;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    flex: none;
    transition: background 0.3s;
}

.report-button {
    background: #3498db;
}

.import-button,
.export-button {
    background: #9b59b6;
}

.done-button {
    background: #f1c40f;
}

.add-button:hover {
    background: #27ae60;
}

.report-button:hover {
    background: #2980b9;
}

.import-button:hover,
.export-button:hover {
    background: #8e44ad;
}

.done-button:hover {
    background: #d4ac0d;
}

.container {
    max-width: 1000px;
    margin: auto;
}

.bill {
    background: #fff;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.bill.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.bill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bill-header h2 {
    margin: 0;
    flex: 1;
    margin-bottom: 20px;
    margin-top: 20px;
}

.bill-header-buttons {
    display: flex;
    gap: 10px;
    flex: none;
    margin-bottom: 20px;
    margin-top: 20px;
}

.remove-bill,
.done-button {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
}

.remove-bill:hover {
    background: #c0392b;
}

.done-button {
    background: #f1c40f;
    pointer-events: all;
}

.done-button.done {
    background: #95a5a6;
}

.done-button:hover {
    background: #d4ac0d;
}

.users-section,
.items-section {
    margin-bottom: 20px;
    position: relative;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: none;
    border-radius: 8px;
}

.bill.disabled .users-section .overlay,
.bill.disabled .items-section .overlay {
    display: block;
}

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.users-header h3 {
    margin: 0;
}

.owner-selection {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.owner-selection label {
    font-weight: bold;
}

.owner-selection select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    appearance: none;
    background-color: #fff;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2210%22%20height%3D%227%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200l5%207%205-7z%22%20fill%3D%22%233498db%22/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 7px;
    cursor: pointer;
    width: 120px;
}

.users-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.user-tag {
    background-color: #3498db;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    position: relative;
    flex: 0 1 auto;
    max-width: 100%;
}

.user-tag .owner-symbol {
    color: yellow;
    margin-right: 6px;
    font-size: 14px;
}

.user-tag .remove-user {
    background: #e74c3c;
    color: #fff;
    border: none;
    margin-left: 8px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 0;
    transition: background 0.3s;
}

.user-tag .remove-user:hover {
    background: #c0392b;
}

.add-button {
    background: #2ecc71;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
}

.add-button:hover {
    background: #27ae60;
}

.report-button,
.import-button,
.export-button {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
}

.report-button:hover,
.import-button:hover,
.export-button:hover {
    background: #2980b9;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: top;
    cursor: pointer;
}

th {
    background-color: #f2f2f2;
}

th.item-name,
th.value {
    width: 10%;
}

th.user-column {
    width: 10%;
}

.split-value {
    margin-top: 4px;
    font-size: 12px;
    color: #555;
}

tfoot td {
    font-weight: bold;
    background-color: #f9f9f9;
}

.summary {
    margin-top: 15px;
    padding: 10px;
    background: #ecf0f1;
    border-radius: 5px;
}

.add-item-btn {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
}

.add-item-btn:hover {
    background: #2980b9;
}

.item-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.item-inputs input {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex: 1 1;
    max-width: 150px;
}

.total-row {
    background-color: #f9f9f9;
    font-weight: bold;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    /* Added for responsiveness */
    overflow-y: auto;
    /* Make modal content scrollable */
    border-radius: 8px;
    position: relative;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
}

@media (max-width: 1024px) {
    .header {
        flex-direction: column;
        margin-top: 30px;
        align-items: center;
    }

    .header-buttons {
        justify-content: center;
        width: 100%;
        margin-top: 30px
    }
    th.item-name,
    th.value,
    th.user-column {
        width: auto;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .owner-selection {
        flex-direction: column;
        align-items: flex-start;
    }

    .owner-selection label,
    .owner-selection select {
        width: 120px;
    }

    input[type="number"] {
        width: 100px;
    }

    .item-inputs input {
        max-width: 100%;
        width: 100%;
    }

    .users-tags {
        justify-content: flex-start;
    }

    .user-tag {
        padding: 4px 8px;
        font-size: 12px;
    }

    .user-tag .owner-symbol {
        margin-right: 4px;
        font-size: 12px;
    }

    .remove-user {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* Adjust input number width */
input[type="number"] {
    width: 100px;
}

/* Make report table scrollable */
#reportContent table {
    width: 100%;
}


.summary-section {
    border-top: 2px solid #ccc;
    padding-top: 20px;
}

.summary-section table {
    width: 100%;
    border-collapse: collapse;
}

.summary-section th, .summary-section td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.summary-section th {
    background-color: #f2f2f2;
}