/* Main Invoice Generator Styles */
#invoice-generator-app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.invoice-generator-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    padding: 30px;
}

/* Header Styles */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-upload-section {
    text-align: center;
}

.logo-preview {
    width: 150px;
    height: 100px;
    border: 2px dashed #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-upload-btn {
    background: #4a6cf7;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.logo-upload-btn:hover {
    background: #3a5ce5;
}

.invoice-title-section input {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    border: none;
    outline: none;
    background: transparent;
    padding: 5px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.invoice-title-section input:focus {
    border-bottom-color: #4a6cf7;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.preview-btn {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.preview-btn:hover {
    background: #e9ecef;
}

.download-btn {
    background: #28a745;
    color: white;
}

.download-btn:hover {
    background: #218838;
}

/* Main Content Layout */
.invoice-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

/* From Section */
.from-section, .bill-to-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #4a6cf7;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: #4a6cf7;
    outline: none;
}

.input-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* Invoice Info Section */
.invoice-info-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.date-picker-wrapper {
    position: relative;
}

.date-picker-wrapper i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

/* Items Table */
.items-section {
    margin-bottom: 30px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.items-table th {
    background: #4a6cf7;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.items-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.items-table tr:hover {
    background: #f9f9f9;
}

.items-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.add-item-btn {
    background: #4a6cf7;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.add-item-btn:hover {
    background: #3a5ce5;
}

/* Totals Section */
.totals-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.color-picker-section,
.tax-section,
.discount-section {
    margin-bottom: 25px;
}

.color-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: #333;
}

.tax-options,
.discount-options {
    display: grid;
    gap: 15px;
    margin-top: 15px;
}

.tax-option,
.discount-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Notes and Signature */
.notes-section,
.signature-section {
    margin-bottom: 30px;
}

.signature-pad-container {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    background: white;
}

.signature-pad {
    width: 100%;
    height: 150px;
    cursor: crosshair;
    background: white;
    border: 1px solid #eee;
}

.signature-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.clear-signature-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

/* Totals Display */
.final-totals {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    border: 2px solid #4a6cf7;
    margin-top: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
}

.total-row.final-total {
    font-size: 20px;
    font-weight: bold;
    color: #4a6cf7;
    border-bottom: none;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

/* Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    overflow: auto;
}

.preview-modal-content {
    background: white;
    width: 210mm;
    min-height: 297mm;
    margin: 20px auto;
    padding: 20mm;
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
    position: relative;
}

.close-preview {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 992px) {
    .invoice-main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .invoice-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .preview-modal-content {
        width: 95%;
        padding: 10px;
        margin: 10px auto;
    }
}

/* Animation for new items */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.items-table tr {
    animation: fadeIn 0.3s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #4a6cf7;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a5ce5;
}