/**
 * SmartWeb Invoice System Frontend Styles
 */

/* Invoice List */
.smartweb-invoice-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.invoice-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-list-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
}

.invoice-actions {
    display: flex;
    gap: 0.5rem;
}

.invoice-actions button {
    padding: 0.5rem 1rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.invoice-actions button:hover {
    background: #4b5563;
}

/* Invoice Filters */
.invoice-filters {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Invoice Table */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invoice-table td {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.invoice-row {
    cursor: pointer;
    transition: background 0.15s;
}

.invoice-row:hover {
    background: #f9fafb;
}

.invoice-number {
    font-weight: 600;
    color: #1f2937;
}

.invoice-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.invoice-status.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.invoice-status.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.invoice-status.status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.invoice-status.status-draft {
    background: #e5e7eb;
    color: #374151;
}

.invoice-amount {
    font-weight: 600;
    color: #1f2937;
}

.invoice-actions-cell {
    text-align: right;
}

.action-btn {
    padding: 0.375rem 0.75rem;
    margin-left: 0.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #5a67d8;
}

.action-btn.secondary {
    background: #6b7280;
}

.action-btn.secondary:hover {
    background: #4b5563;
}

/* Invoice Viewer */
.smartweb-invoice-viewer {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.invoice-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-viewer-actions {
    display: flex;
    gap: 0.5rem;
}

.invoice-content {
    padding: 2rem;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.invoice-logo h1 {
    margin: 0;
    color: #1f2937;
    font-size: 2rem;
}

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

.invoice-details h2 {
    margin: 0 0 0.5rem 0;
    color: #6b7280;
    font-size: 1.5rem;
    font-weight: 400;
}

.invoice-meta {
    font-size: 0.9rem;
    color: #6b7280;
}

.invoice-meta strong {
    color: #374151;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-from h3,
.invoice-to h3 {
    margin: 0 0 0.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invoice-from address,
.invoice-to address {
    font-style: normal;
    color: #1f2937;
    line-height: 1.6;
}

.invoice-items {
    margin-bottom: 2rem;
}

.invoice-items table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-items th {
    text-align: left;
    padding: 0.75rem 0;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.invoice-items td {
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

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

.invoice-totals {
    margin-left: auto;
    max-width: 300px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    border-top: 2px solid #e5e7eb;
    margin-top: 0.5rem;
    padding-top: 1rem;
}

/* Invoice Notes */
.invoice-notes {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.invoice-notes h3 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.invoice-note {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-note:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.invoice-note strong {
    color: #374151;
}

.note-date {
    color: #6b7280;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.invoice-note p {
    margin: 0.5rem 0 0 0;
    color: #4b5563;
}

/* Payment Modal */
#payment-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#payment-modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    padding: 1.5rem;
    margin: 0;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
    font-size: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-content .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #6b7280;
    transition: background 0.2s;
}

.modal-content .close:hover {
    background: #e5e7eb;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.notification.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Print Styles */
@media print {
    .invoice-viewer-header,
    .invoice-viewer-actions,
    .invoice-actions {
        display: none;
    }
    
    .smartweb-invoice-viewer {
        box-shadow: none;
        max-width: 100%;
    }
    
    .invoice-content {
        padding: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .invoice-filters {
        flex-direction: column;
    }
    
    .invoice-table {
        font-size: 0.875rem;
    }
    
    .invoice-table th,
    .invoice-table td {
        padding: 0.75rem;
    }
    
    .invoice-parties {
        grid-template-columns: 1fr;
    }
    
    .invoice-header {
        flex-direction: column;
        text-align: center;
    }
    
    .invoice-details {
        text-align: center;
        margin-top: 1rem;
    }
}