/* Professional ERP Form Enhancements */

/* Advanced Form Styling */
.professional-form {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-body {
    padding: 2rem;
}

.form-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.form-section-icon {
    width: 2rem;
    height: 2rem;
    background: #3b82f6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* Enhanced Form Fields */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group.required .form-label::after {
    content: " *";
    color: #ef4444;
    font-weight: 500;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    line-height: 1.25;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
    background-color: #ffffff;
}

.form-control:hover {
    border-color: #9ca3af;
}

.form-control.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-control.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.form-control.success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Enhanced Select Styling */
select.form-control {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem 1.25rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Textarea Enhancement */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Input Group Styling */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
    border-right: none;
}

.input-group .form-control:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.input-group .form-control:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-right: 1.5px solid #d1d5db;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #6b7280;
    text-align: center;
    white-space: nowrap;
    background-color: #f9fafb;
    border: 1.5px solid #d1d5db;
    border-left: none;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Error Messages */
.form-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #ef4444;
    line-height: 1.25;
}

.form-error i {
    font-size: 0.875rem;
}

.form-help {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.25;
}

/* Professional Button Styling */
.btn-professional {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    position: relative;
    overflow: hidden;
}

.btn-professional:focus {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.btn-professional:disabled,
.btn-professional.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #3b82f6;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
    color: #374151;
    background-color: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-secondary:hover {
    color: #111827;
    background-color: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Success Button */
.btn-success {
    color: #ffffff;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #059669;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Danger Button */
.btn-danger {
    color: #ffffff;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: #dc2626;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Warning Button */
.btn-warning {
    color: #ffffff;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #f59e0b;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #d97706;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Form Actions */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    margin: 2rem -2rem -2rem;
}

.form-actions-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-actions-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Professional Grid Layout */
.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-grid-cols-1 {
    grid-template-columns: 1fr;
}

.form-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Card-based Form Layout */
.form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    margin-bottom: 1.5rem;
}

.form-card-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.form-card-body {
    padding: 1.5rem;
}

/* Loading States */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: inherit;
    z-index: 10;
}

.form-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    width: 2rem;
    height: 2rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .form-grid-cols-2,
    .form-grid-cols-3,
    .form-grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions-left,
    .form-actions-right {
        justify-content: center;
    }
    
    .btn-professional {
        width: 100%;
        justify-content: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .professional-form {
        background: #1f2937;
        border-color: #374151;
    }
    
    .form-section {
        background: #374151;
        border-color: #4b5563;
    }
    
    .form-control {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-control:focus {
        background-color: #374151;
        border-color: #3b82f6;
    }
    
    .form-label {
        color: #d1d5db;
    }
    
    .form-actions {
        background-color: #374151;
        border-color: #4b5563;
    }
}