/* Invoice Module Styles */

/* Invoice Cards */
.invoice-card {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: white;
}

.invoice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.invoice-card .card-body {
    padding: 1.5rem;
}

.invoice-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.invoice-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #27ae60;
}

.invoice-customer {
    color: #6c757d;
    font-size: 0.9rem;
}

.invoice-date {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Invoice Form */
.invoice-form {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.invoice-form .form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.invoice-form .form-control,
.invoice-form .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.invoice-form .form-control:focus,
.invoice-form .form-select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Customer Info Section */
.customer-info-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

.customer-info-section h6 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Invoice Items Table */
.invoice-items-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

#invoiceItemsTable {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

#invoiceItemsTable thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#invoiceItemsTable thead th {
    border: none;
    padding: 1rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

#invoiceItemsTable tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

#invoiceItemsTable tbody tr:hover {
    background-color: #f8f9fa;
}

.invoice-item-input {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.invoice-item-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.15rem rgba(52, 152, 219, 0.25);
}

.item-total {
    font-weight: 600;
    color: #27ae60;
}

/* Invoice Totals */
.invoice-totals {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid #dee2e6;
}

.invoice-totals .row {
    margin-bottom: 0.5rem;
}

.invoice-totals .row:last-child {
    margin-bottom: 0;
    padding-top: 0.5rem;
    border-top: 2px solid #3498db;
    font-weight: 700;
    font-size: 1.1rem;
}

.invoice-totals .text-end {
    color: #27ae60;
    font-weight: 600;
}

/* Invoice Status Badges */
.status-draft { background-color: #6c757d !important; }
.status-sent { background-color: #17a2b8 !important; }
.status-pending { background-color: #ffc107 !important; color: #212529 !important; }
.status-paid { background-color: #28a745 !important; }
.status-overdue { background-color: #dc3545 !important; }
.status-cancelled { background-color: #343a40 !important; }

/* Invoice Type Badges */
.type-sales { background-color: #007bff !important; }
.type-return { background-color: #ffc107 !important; color: #212529 !important; }
.type-proforma { background-color: #17a2b8 !important; }
.type-advance { background-color: #28a745 !important; }

/* Invoice Statistics */
.invoice-stats {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 1rem;
}

.stat-card h4 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.stat-card p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-card.success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Invoice Actions */
.invoice-actions {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.invoice-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* Invoice Table */
.invoice-table-wrapper {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#invoicesTable {
    margin: 0;
}

#invoicesTable thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#invoicesTable thead th {
    border: none;
    padding: 1rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

#invoicesTable tbody td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

#invoicesTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Action Buttons */
.btn-group .btn {
    border-radius: 0;
    margin: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.dropdown-menu {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.dropdown-item i {
    width: 16px;
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .invoice-form {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .customer-info-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .invoice-items-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .invoice-totals {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .invoice-table-wrapper {
        padding: 1rem;
        overflow-x: auto;
    }
    
    #invoicesTable {
        font-size: 0.85rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 6px !important;
    }
}

/* Invoice Form Sections */
.invoice-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.invoice-section h6 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Add Item Button */
.add-item-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.add-item-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    color: white;
}

/* Submit Button */
.invoice-submit-btn {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.invoice-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(86, 171, 47, 0.3);
    color: white;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Invoice Preview Modal */
.invoice-preview {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
}

.invoice-preview .invoice-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3498db;
}

.invoice-preview .company-info {
    margin-bottom: 2rem;
}

.invoice-preview .customer-details {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.invoice-preview .items-table {
    margin-bottom: 2rem;
}

.invoice-preview .totals-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

/* Print Styles */
@media print {
    .invoice-actions,
    .btn,
    .dropdown,
    .navbar,
    .sidebar {
        display: none !important;
    }
    
    .invoice-preview {
        box-shadow: none;
        border: none;
        margin: 0;
        padding: 0;
    }
    
    body {
        background: white;
    }
    
    .page-break {
        page-break-before: always;
    }
}