/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

/* Form styles */
.form-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Logo preview */
.logo-preview {
    margin-top: 10px;
    width: 150px;
    height: 80px;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Items table */
#itemsContainer {
    margin-bottom: 15px;
}

.item-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.item-row input {
    flex: 1;
}

.item-row .item-desc {
    flex: 3;
}

.item-row .remove-item {
    background: #e74c3c;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-row .remove-item:hover {
    background: #c0392b;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #ecf0f1;
    color: #333;
}

.btn-secondary:hover {
    background-color: #bdc3c7;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 25px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-modal:hover {
    color: #333;
}

.modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Invoice preview styles */
.invoice-preview {
    background: white;
    padding: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.invoice-title h2 {
    font-size: 28px;
    color: #2c3e50;
    margin: 0;
}

.invoice-meta {
    text-align: right;
}

.invoice-logo {
    max-height: 80px;
    margin-bottom: 20px;
}

.invoice-addresses {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.invoice-from, .invoice-to {
    flex: 1;
}

.invoice-to {
    text-align: right;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.invoice-items th {
    background-color: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #ddd;
}

.invoice-items td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.invoice-items tr:last-child td {
    border-bottom: 2px solid #ddd;
}

.invoice-total {
    text-align: right;
    margin-top: 20px;
}

.invoice-total table {
    display: inline-block;
    border-collapse: collapse;
}

.invoice-total td {
    padding: 8px 15px;
}

.invoice-total tr:last-child td {
    font-weight: bold;
    font-size: 18px;
    border-top: 2px solid #ddd;
}

.invoice-notes {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Responsive styles */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .invoice-header, .invoice-addresses {
        flex-direction: column;
    }
    
    .invoice-meta, .invoice-to {
        text-align: left;
        margin-top: 20px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .item-row {
        flex-wrap: wrap;
    }
    
    .item-row input {
        flex: 100%;
        margin-bottom: 5px;
    }
    
    .item-row .remove-item {
        flex: 0 0 100%;
    }
}

@media (max-width: 480px) {
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
}