/**
 * NFS Standalone System CSS
 * Styling for the standalone invoice management system
 */

/* Main Container */
.nfs-standalone-system {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nfs-section {
    margin-bottom: 30px;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Filters Section */
.nfs-filters-container {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.nfs-filters-form {
    display: block;
}

.nfs-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.nfs-filter-item {
    display: flex;
    flex-direction: column;
}

.nfs-filter-item label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.nfs-search-input,
.nfs-select-filter {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.3s ease;
}

.nfs-search-input:focus,
.nfs-select-filter:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.nfs-filters-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.nfs-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-height: 40px;
}

.nfs-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nfs-btn:active {
    transform: translateY(0);
}

.nfs-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.nfs-btn-primary {
    background: #007cba;
    color: white;
}

.nfs-btn-primary:hover {
    background: #005a87;
}

.nfs-btn-secondary {
    background: #6c757d;
    color: white;
}

.nfs-btn-secondary:hover {
    background: #545b62;
}

.nfs-btn-clear {
    background: #6c757d;
    color: white;
}

.nfs-btn-clear:hover {
    background: #545b62;
}

.nfs-btn-export {
    background: #28a745;
    color: white;
}

.nfs-btn-export:hover {
    background: #218838;
}

/* Listing Section */
.nfs-listing-container {
    padding: 20px;
}

.nfs-listing-status {
    margin-bottom: 20px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 4px;
    border-left: 4px solid #367C2B;
}

.nfs-filter-summary {
    margin: 0 0 5px 0;
    font-weight: 600;
    color: #333;
}

.nfs-results-count {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.nfs-no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

.nfs-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.nfs-invoices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.nfs-invoices-table th,
.nfs-invoices-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.nfs-invoices-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

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

.nfs-invoice-checkbox,
#nfs-select-all {
    transform: scale(1.2);
    cursor: pointer;
}

.nfs-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.nfs-status-aprovada {
    background: #d4edda;
    color: #155724;
}

.nfs-status-cancelada {
    background: #f8d7da;
    color: #721c24;
}

.nfs-status-devolvida {
    background: #fff3cd;
    color: #856404;
}

.nfs-status-em.análise {
    background: #d1ecf1;
    color: #0c5460;
}

.nfs-pagination {
    text-align: center;
    margin-top: 20px;
}

.nfs-load-more-count {
    font-size: 12px;
    opacity: 0.8;
}

/* Totals Section */
.nfs-totals-container {
    padding: 20px;
}

.nfs-totals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.nfs-totals-header h3 {
    margin: 0;
    color: #333;
}

.nfs-totals-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.nfs-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.nfs-total-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.nfs-total-final {
    background: #d4edda;
    border: 2px solid #28a745;
}

.nfs-total-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.nfs-total-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.nfs-final-value {
    color: #28a745;
    font-size: 20px;
}

.nfs-totals-empty {
    opacity: 0.7;
}

/* Approval Section */
.nfs-approval-container {
    padding: 20px;
}

.nfs-approval-header {
    margin-bottom: 20px;
    text-align: center;
}

.nfs-approval-header h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.nfs-approval-description {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.nfs-approval-form {
    max-width: 800px;
    margin: 0 auto;
}

.nfs-approval-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.nfs-approval-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
}

.nfs-selection-options,
.nfs-status-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nfs-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nfs-radio-option:hover {
    background: #f8f9fa;
    border-color: #007cba;
}

.nfs-radio-option input[type="radio"] {
    margin: 2px 0 0 0;
    transform: scale(1.2);
}

.nfs-radio-option input[type="radio"]:checked + .nfs-radio-label {
    font-weight: 600;
}

.nfs-radio-label {
    flex: 1;
    cursor: pointer;
}

.nfs-radio-label small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 2px;
}

.nfs-status-approved {
    border-color: #28a745;
}

.nfs-status-approved:hover {
    background: #d4edda;
}

.nfs-status-rejected {
    border-color: #dc3545;
}

.nfs-status-rejected:hover {
    background: #f8d7da;
}

.nfs-status-returned {
    border-color: #ffc107;
}

.nfs-status-returned:hover {
    background: #fff3cd;
}

.nfs-status-analysis {
    border-color: #17a2b8;
}

.nfs-status-analysis:hover {
    background: #d1ecf1;
}

.nfs-selected-totals {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.nfs-selected-totals h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.nfs-selected-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.nfs-selected-total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.nfs-selected-total-label {
    color: #666;
}

.nfs-approval-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.nfs-approval-feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    font-weight: 500;
}

.nfs-approval-feedback.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nfs-approval-feedback.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading Overlay */
.nfs-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.nfs-loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nfs-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .nfs-approval-options {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .nfs-totals-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .nfs-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .nfs-filters-actions {
        flex-direction: column;
    }
    
    .nfs-totals-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .nfs-totals-grid {
        grid-template-columns: 1fr;
    }
    
    .nfs-table-container {
        font-size: 12px;
    }
    
    .nfs-invoices-table th,
    .nfs-invoices-table td {
        padding: 8px 4px;
    }
    
    .nfs-approval-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .nfs-section {
        margin-bottom: 20px;
    }
    
    .nfs-filters-container,
    .nfs-listing-container,
    .nfs-totals-container,
    .nfs-approval-container {
        padding: 15px;
    }
    
    .nfs-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .nfs-filters-section,
    .nfs-approval-section {
        display: none;
    }
    
    .nfs-invoices-table {
        font-size: 12px;
    }
    
    .nfs-checkbox-col {
        display: none;
    }
}