:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --text-color: #333;
    --light-gray: #f7f7f7;
    --border-color: #ddd;
    --white: #fff;
    --danger-color: #e53935;
    --danger-hover: #c62828;
}

.invoice-container {
    background-color: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
    text-align: center;
    margin: 20px;
}

.invoice-container h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-weight: 600;
}

.invoice-container form {
    text-align: left;
}

.company-details, .client-details, .invoice-details, .invoice-items, .invoice-summary, .service-specifics, .payment-instructions {
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 8px;
}

.company-details h2, .client-details h2, .invoice-details h2, .invoice-items h2, .service-specifics h2, .payment-instructions h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.company-details input, .client-details input, .invoice-details input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    margin-bottom: 15px;
}

.dynamic-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
}

.item-header {
    display: flex;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    padding: 0 10px 10px 40px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.item-type-header, .item-type-container { width: 100px; }
.item-description-header, .item-description { flex-grow: 1; }
.item-quantity-header, .item-hours, .item-quantity { width: 80px; }
.item-price-header, .item-rate, .item-price { width: 90px; }
.item-discount-header, .item-discount { width: 90px; }
.item-total-header, .item-total { width: 110px; text-align: right; }

.item-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    background-color: var(--light-gray);
    padding: 10px;
    border-radius: 8px;
}

.item-row input, .item-row select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    width: 100%;
}

#add-item {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
    margin-top: 10px;
}

#add-item:hover {
    background: #3a7ac8;
}

.remove-item button {
    background-color: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem !important;
    font-family: sans-serif !important;
    transition: background-color 0.3s;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.remove-item button:hover {
    background-color: var(--danger-hover);
}

.invoice-summary {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--light-gray);
    border-radius: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row input {
    width: 120px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: right;
    font-size: 1.1rem;
}

#subtotal, #total {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.2rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.required {
    color: var(--danger-color);
    margin-left: 4px;
}

@media (max-width: 768px) {
    .invoice-container {
        padding: 20px;
    }

    .item-header {
        display: none;
    }

    .item-row {
        flex-direction: column;
        align-items: stretch;
        border: 1px solid var(--border-color);
        padding: 15px;
    }

    .item-row > div {
        width: 100% !important;
        margin-bottom: 10px;
    }

    .item-row input, .item-row select {
        width: 100%;
    }

    .remove-item {
        text-align: right;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-top: 10px;
    }

    .summary-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-row input {
        width: 100%;
        margin-top: 5px;
    }
}
