/**
 * Invoice Analyzer Styles
 */

.invoice-analyzer-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.analyzer-header {
    text-align: center;
    margin-bottom: 40px;
}

.analyzer-header h2 {
    color: #2c3e50;
    font-size: 32px;
    margin-bottom: 10px;
}

.analyzer-description {
    color: #7f8c8d;
    font-size: 16px;
}

/* Upload Section */
.upload-section {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.upload-box {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.upload-box.dragover {
    border-color: #2ecc71;
    background: #e8f5e9;
}

.upload-icon {
    color: #3498db;
    margin-bottom: 20px;
}

.upload-icon svg {
    display: inline-block;
}

.upload-box h3 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 10px;
}

.upload-box p {
    color: #7f8c8d;
    margin: 10px 0;
}

.file-info {
    font-size: 14px;
    color: #95a5a6;
}

.selected-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #2c3e50;
    font-weight: 500;
}

.file-details svg {
    color: #3498db;
}

.upload-actions {
    text-align: center;
    margin-top: 30px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52,152,219,0.3);
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46,204,113,0.3);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 18px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress Section */
.progress-section {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0%, 100% { width: 0%; }
    50% { width: 100%; }
}

.progress-text {
    text-align: center;
    color: #7f8c8d;
    font-size: 16px;
}

/* Results Section */
.results-section {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
}

.stat-card h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
}

.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.results-table thead {
    background: #34495e;
    color: white;
}

.results-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.results-table th.sortable:hover {
    background: #2c3e50;
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.5;
}

.results-table th.sorted .sort-icon {
    opacity: 1;
}

.results-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s ease;
}

.results-table tbody tr:hover {
    background: #f8f9fa;
}

.results-table td {
    padding: 15px;
}

.results-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.results-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

/* Error Messages */
.error-messages {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.error-messages h4 {
    color: #856404;
    margin-bottom: 10px;
}

.error-messages ul {
    margin: 0;
    padding-left: 20px;
    color: #856404;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Responsive */
@media (max-width: 768px) {
    .invoice-analyzer-wrapper {
        padding: 10px;
    }
    
    .upload-section {
        padding: 20px;
    }
    
    .upload-box {
        padding: 40px 20px;
    }
    
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
}