/* Form Components */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
    color: #1f2937;
}

.form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
    color: #1f2937;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
    color: #1f2937;
    resize: vertical;
    min-height: 100px;
}

.form-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Extracted field styling */
.form-group.extracted {
    position: relative;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02), rgba(255, 255, 255, 0.8));
    padding: 20px;
    border-radius: 12px;
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.form-group.extracted .form-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(16, 185, 129, 0.3);
}

.form-group.extracted::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Confidence levels */
.form-group.confidence-high {
    border-color: rgba(16, 185, 129, 0.4);
}

.form-group.confidence-medium {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.02), rgba(255, 255, 255, 0.8));
}

.form-group.confidence-low {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.02), rgba(255, 255, 255, 0.8));
}

/* Form Grid */
.form-grid {
    display: grid;
    gap: 24px;
}

.form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* File Input */
.file-input {
    display: none;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    gap: 8px;
}

.file-input-label:hover {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

/* Checkbox and Radio */
.form-checkbox, .form-radio {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-right: 8px;
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox:checked, .form-radio:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.form-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Form Validation */
.form-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-error::before {
    content: '⚠';
    font-weight: bold;
}

.form-group.error .form-input,
.form-group.error .form-select,
.form-group.error .form-textarea {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-success {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-success::before {
    content: '✓';
    font-weight: bold;
}

.form-group.success .form-input,
.form-group.success .form-select,
.form-group.success .form-textarea {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Invoice Form Specific */
.invoice-form {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.invoice-form-section {
    margin-bottom: 32px;
}

.invoice-form-section:last-child {
    margin-bottom: 0;
}

.invoice-form-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

/* Line Items */
.line-items-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.line-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.line-items-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.add-item-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-item-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.item-card {
    background: #fafafa;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    position: relative;
}

.item-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.item-card.ai-extracted {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02), #fafafa);
}

.item-card.ai-extracted::before {
    content: 'AI Extracted';
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.item-row {
    display: grid;
    grid-template-columns: 2fr 3fr 1fr 1.5fr 2fr auto;
    gap: 16px;
    align-items: center;
}

.item-remove-btn {
    background: #ef4444;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.item-remove-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Calculation Summary */
.calculation-summary {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.calculation-summary.success {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(255, 255, 255, 1));
}

.calculation-summary.warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(255, 255, 255, 1));
}

.calculation-summary.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(255, 255, 255, 1));
}

.calculation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.calculation-icon {
    font-size: 1.5rem;
}

.calculation-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.calculation-details {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Processing States */
.form-submitting {
    position: relative;
    overflow: hidden;
}

.form-submitting::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    animation: shimmer 2s infinite;
    z-index: 1;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Upload Section */
.upload-section {
    margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .item-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .invoice-form {
        padding: 20px;
    }
    
    .calculation-summary {
        padding: 16px;
    }
}