/* Receivables Container */
.receivables-container {
    min-height: 100vh;
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Tab Navigation */
.receivables-tabs {
    display: flex;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
    gap: 5px;
    overflow-x: auto;
}

.receivables-tab {
    padding: 15px 25px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
    white-space: nowrap;
}

.receivables-tab:hover {
    color: #0066cc;
    background: #f8f9fa;
}

.receivables-tab.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
    background: #fff;
}

/* Tab Content */
.tab-content {
    padding: 20px;
}

.receivables-tab-content {
    display: none;
}

.receivables-tab-content.active {
    display: block;
}

/* Content Section */
.content-section {
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px;
}

.subsection-title {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin: 0 0 15px;
}

/* Search Panel */
.search-panel {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Search Form */
.invoice-search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-button-field {
    justify-content: flex-end;
}

.search-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.search-input {
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.search-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #0066cc;
    color: #fff;
}

.btn-primary:hover {
    background: #0052a3;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Results Section */
.results-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Notice Banners */
.notice-banner {
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-warning {
    background: #fff9c4;
    color: #856404;
    border: 1px solid #ffe082;
}

.notice-info {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #90caf9;
}

.notice-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.receivables-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.receivables-table thead {
    background: #f5f5f5;
}

.receivables-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    font-size: 12px;
}

.receivables-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
}

.receivables-table tbody tr:hover {
    background: #f8f9fa;
}

.receivables-table tbody tr:last-child td {
    border-bottom: none;
}

.no-data-row {
    background: transparent !important;
}

.no-data-cell {
    text-align: center;
    padding: 40px 20px !important;
    color: #999;
    font-size: 14px;
    font-weight: 500;
}

.checkbox-col {
    width: 40px;
    text-align: center;
}

.checkbox-col input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-open {
    background: #e3f2fd;
    color: #1565c0;
}

.status-partial {
    background: #fff9c4;
    color: #f57f17;
}

.status-overdue {
    background: #ffebee;
    color: #c62828;
}

.status-paid {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-pending {
    background: #fce4ec;
    color: #ad1457;
}

/* Action Buttons */
.btn-icon {
    background: transparent;
    border: 1px solid #ccc;
    color: #555;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    margin: 0 3px;
}

.btn-icon:hover {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.btn-view {
    background: #0066cc;
    color: #fff;
    border: none;
}

.btn-view:hover {
    background: #0052a3;
}

/* Link Styles */
.invoice-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

.invoice-link:hover {
    text-decoration: underline;
}

/* Unpaid Invoices - Receive Payments Tab */
.unpaid-invoices-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px;
}

.unpaid-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.account-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    background: #fff;
    padding: 15px 20px;
    gap: 20px;
    transition: background 0.2s;
}

.account-row:hover {
    background: #f8f9fa;
}

.account-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.account-invoice-count {
    display: flex;
    align-items: center;
}

.invoice-count-label {
    font-size: 14px;
    color: #666;
    padding: 6px 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.account-actions {
    display: flex;
    align-items: center;
}

.apply-payment-link {
    color: #0066cc;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    white-space: nowrap;
}

.apply-payment-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.total-outstanding {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    border: 2px solid #e0e0e0;
}

.total-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.total-amount {
    font-size: 18px;
    font-weight: 700;
    color: #2e7d32;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .search-row {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .receivables-tabs {
        padding: 0 10px;
    }
    
    .receivables-tab {
        padding: 12px 18px;
        font-size: 13px;
    }
    
    .tab-content {
        padding: 10px;
    }
    
    .search-panel,
    .results-section {
        padding: 15px;
    }
    
    .search-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-row {
        grid-template-columns: 1fr;
    }
    
    .receivables-table {
        font-size: 11px;
    }
    
    .receivables-table th,
    .receivables-table td {
        padding: 8px 6px;
    }
    
    .account-row {
        grid-template-columns: 40px 1fr;
        gap: 10px;
    }
    
    .account-invoice-count {
        grid-column: 2;
        justify-content: flex-start;
        margin-top: 5px;
    }
    
    .account-actions {
        grid-column: 2;
        margin-top: 5px;
    }
    
    .total-outstanding {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }
}

/* Scrollbar Styling */
.table-container::-webkit-scrollbar,
.receivables-tabs::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track,
.receivables-tabs::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb,
.receivables-tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.receivables-tabs::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Invoices Tab - Inline Search Panel */
.invoices-header {
    background: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.search-panel-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
}

.search-inline-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.inline-input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.inline-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.inline-select-small {
    width: 70px;
}

.inline-input-date {
    width: 140px;
}

.inline-separator {
    font-size: 13px;
    color: #666;
}

.button-group {
    display: flex;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.filter-btn {
    padding: 6px 12px;
    background: #fff;
    border: none;
    border-right: 1px solid #ccc;
    color: #555;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:last-child {
    border-right: none;
}

.filter-btn:hover {
    background: #f5f5f5;
}

.filter-btn.active {
    background: #0066cc;
    color: #fff;
}

.btn-search-inline {
    padding: 7px 20px;
    font-size: 12px;
}

.bulk-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.action-btn {
    padding: 7px 16px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    color: #555;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e5e5e5;
    border-color: #c0c0c0;
}

/* Invoices Table */
.invoices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.invoices-table thead {
    background: #404040;
    color: #fff;
}

.invoices-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    border-right: 1px solid #555;
}

.invoices-table th:last-child {
    border-right: none;
}

.invoices-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.invoices-table tbody tr:hover {
    background: #f8f9fa;
}

.invoices-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-number {
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
}

.invoice-number:hover {
    text-decoration: underline;
}

.finalized-icon {
    color: #666;
    font-size: 14px;
}

.status-overdue {
    color: #c62828;
    font-weight: 500;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.amount-overdue {
    color: #c62828;
    font-weight: 600;
}

.actions-col {
    width: 200px;
}

.action-mini-btn {
    padding: 4px 10px;
    background: #505050;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 2px;
}

.action-mini-btn:hover {
    background: #333;
}

/* Closed Invoices Header */
.closed-invoices-header {
    background: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.inline-input-wide {
    width: 280px;
}

/* Pending Transactions Tab */
.pending-subtabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.pending-subtab {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px 4px 0 0;
}

.pending-subtab:hover {
    background: #e8e8e8;
}

.pending-subtab.active {
    background: #fff;
    color: #333;
    font-weight: 600;
}

.pending-subtab-content {
    display: none;
}

.pending-subtab-content.active {
    display: block;
}

.pending-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px;
}

.pending-search-panel {
    background: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.pending-search-form {
    display: block;
}

.pending-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.pending-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pending-label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.pending-input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 140px;
}

.pending-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.pending-input-short {
    width: 80px;
}

.btn-pending-search {
    padding: 7px 20px;
    font-size: 12px;
    margin-top: 20px;
}

/* Pending Table */
.pending-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.pending-table thead {
    background: #404040;
    color: #fff;
}

.pending-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    border-right: 1px solid #555;
}

.pending-table th:last-child {
    border-right: none;
}

.pending-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.pending-table tbody tr:hover {
    background: #f8f9fa;
}

.pending-table tbody tr:last-child td {
    border-bottom: none;
}
