body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    margin: 0;
    padding: 20px;
}

.invoice-container {
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.company-logo {
    /* Margins are adjusted for flex alignment */
}

.logo-placeholder {
    display: block;
    width: 150px;
    height: 150px;
    border: 2px dashed #ccc;
    text-align: center;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-placeholder span {
    font-family: Arial, sans-serif;
    color: #aaa;
}

#logo-preview {
    max-width: 100%;
    max-height: 100%;
}

.invoice-meta {
    /* Stacks the invoice number and date vertically */
}

.invoice-meta .invoice-number,
.invoice-meta .invoice-date {
    margin-bottom: 10px; /* Adds space between the fields */
}

.unit-price-header {
    display: flex;
    justify-content: space-between;
    align-items: left;
}

.currency-selector select {
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.unit-price-cell {
    display: flex;
    align-items: center;
}

.currency-symbol {
    margin-right: 5px;
}


.invoice-details, .invoice-summary, .invoice-footer {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sender-details, .customer-details, .notes, .terms {
    width: 48%;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Fix for overlapping */
}

/* Make input in unit price cell not take full width, to leave space for currency symbol */
.unit-price-cell input[type="number"] {
    flex: 1;
    min-width: 0;
}

textarea {
    height: 100px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed; /* Fix for overlapping */
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 8px;
    text-align: left;
    word-wrap: break-word; /* Fix for long text */
}

/* Setting column widths */
.invoice-items th:nth-child(1), .invoice-items td:nth-child(1) {
    width: 50%; /* Description */
}
.invoice-items th:nth-child(2), .invoice-items td:nth-child(2),
.invoice-items th:nth-child(3), .invoice-items td:nth-child(3),
.invoice-items th:nth-child(4), .invoice-items td:nth-child(4) {
    width: calc(50% / 3);
}

thead {
    background-color: #f2f2f2;
}

#add-item, .generate-invoice {
    background-color: #0056b3;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: block;
    margin: 10px 0;
}

.total-amount {
    text-align: right;
}

.signature-box {
    border: 1px dashed #ccc;
    height: 100px;
    margin-top: 10px;
}
