/* Invoice Generator Styles */
* {
    box-sizing: border-box;
}

.invoice-generator-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.generator-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    color: #2c3e50;
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.header-left p {
    color: #7f8c8d;
    margin: 5px 0 0 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-preview {
    background: #3498db;
    color: white;
}

.btn-preview:hover {
    background: #2980b9;
}

.btn-download {
    background: #27ae60;
    color: white;
}

.btn-download:hover {
    background: #229954;
}

.btn-send {
    background: #e74c3c;
    color: white;
}

.btn-send:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    color: #3498db;
    border: 2px solid #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: white;
}

.generator-main {
    padding: 40px 0;
}

.row {
    display: flex;
    gap: 30px;
}

.col-md-4 {
    flex: 0 0 350px;
}

.col-md-8 {
    flex: 1;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 120px;
}

.panel-section h3 {
    color: #2c3e50;
    margin: 0 0 25px 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.logo-upload {
    text-align: center;
}

#logoPreview {
    margin-top: 15px;
}

#logoPreview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 8px;
}

/* Invoice Container */
.invoice-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.invoice-paper {
    padding: 40px;
    background: white;
    min-height: 800px;
}

/* Invoice Header */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 3px solid var(--accent-color, #3498db);
}

.company-info {
    display: flex;
    gap: 20px;
}

#companyLogo img {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
}

.company-details .editable {
    display: block;
    margin-bottom: 8px;
}

.company-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px !important;
}

.invoice-title h1 {
    font-size: 3rem;
    color: var(--accent-color, #3498db);
    margin: 0 0 20px 0;
    text-align: right;
}

.invoice-meta {
    text-align: right;
}

.invoice-meta > div {
    margin-bottom: 10px;
}

.invoice-meta label {
    font-weight: 600;
    color: #7f8c8d;
    display: inline-block;
    width: 80px;
    text-align: left;
}

/* Bill To Section */
.bill-to-section {
    margin-bottom: 40px;
}

.bill-to h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.client-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px !important;
}

/* Items Table */
.items-section {
    margin-bottom: 40px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.items-table th {
    background: var(--accent-color, #3498db);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.items-table td {
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.items-table .item-row:hover {
    background: #f8f9fa;
}

.items-table input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 14px;
    padding: 5px;
}

.items-table input:focus {
    outline: 2px solid var(--accent-color, #3498db);
    border-radius: 4px;
}

.item-amount {
    font-weight: 600;
    color: #27ae60;
    text-align: right;
}

.btn-remove-item {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-remove-item:hover {
    background: #c0392b;
}

.btn-add-item {
    background: var(--accent-color, #3498db);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.btn-add-item:hover {
    background: #2980b9;
}

/* Totals Section */
.totals-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
}

.totals-table {
    width: 300px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 16px;
}

.total-row:not(:last-child) {
    border-bottom: 1px solid #ecf0f1;
}

.final-total {
    font-weight: 700;
    font-size: 1.3rem;
    color: #2c3e50;
    border-top: 3px solid var(--accent-color, #3498db);
    margin-top: 10px;
    padding-top: 15px;
}

/* Notes and Payment Info */
.notes-section,
.payment-info {
    margin-bottom: 30px;
}

.notes-section h3,
.payment-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.notes,
#paymentInfo {
    width: 100%;
    min-height: 80px;
    line-height: 1.6;
}

/* Editable Elements */
.editable {
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    width: 100%;
}

.editable:focus {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 5px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    background: #95a5a6;
    color: white;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .row {
        flex-direction: column;
    }
    
    .col-md-4,
    .col-md-8 {
        flex: none;
        width: 100%;
    }
    
    .invoice-header {
        flex-direction: column;
        gap: 30px;
    }
    
    .invoice-title h1 {
        text-align: left;
        font-size: 2.5rem;
    }
    
    .invoice-meta {
        text-align: left;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .invoice-paper {
        padding: 20px;
    }
    
    .items-table {
        font-size: 12px;
    }
    
    .items-table th,
    .items-table td {
        padding: 8px;
    }
}

/* Print Styles */
@media print {
    .control-panel,
    .generator-header {
        display: none !important;
    }
    
    .invoice-generator-wrapper {
        background: white;
    }
    
    .invoice-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .invoice-paper {
        padding: 0;
    }
    
    .btn-remove-item,
    .btn-add-item {
        display: none;
    }
}

/* Color Customization */
:root {
    --accent-color: #3498db;
}

.invoice-paper[data-color="blue"] {
    --accent-color: #3498db;
}

.invoice-paper[data-color="green"] {
    --accent-color: #27ae60;
}

.invoice-paper[data-color="red"] {
    --accent-color: #e74c3c;
}

.invoice-paper[data-color="purple"] {
    --accent-color: #9b59b6;
}

.invoice-paper[data-color="orange"] {
    --accent-color: #f39c12;
}