/* ========================================
   FORM STYLES
   ======================================== */

/* Form Container */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.form-container h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.95rem;
}

.form-group label.required::after {
    content: " *";
    color: #e74c3c;
    font-weight: 600;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #2c3e50;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #ffffff;
}

.form-control:invalid {
    border-color: #e74c3c;
}

.form-control:valid {
    border-color: #27ae60;
}

/* Textarea */
.form-control[type="textarea"],
textarea.form-control {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* Select */
select.form-control {
    appearance: none;
    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.5em 1.5em;
    padding-right: 2.5rem;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.75rem;
    accent-color: #3498db;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
    color: #34495e;
    font-size: 0.95rem;
}

/* File Input */
.form-control[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #bdc3c7;
    background: #f8f9fa;
    cursor: pointer;
}

.form-control[type="file"]:hover {
    border-color: #3498db;
    background: #ecf0f1;
}

/* Form Row for Side-by-Side Fields */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ecf0f1;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-primary {
    background: #3498db;
    color: #ffffff;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.btn-success {
    background: #27ae60;
    color: #ffffff;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-danger {
    background: #e74c3c;
    color: #ffffff;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-width: 80px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-width: 160px;
}

/* Button States */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form Validation */
.form-control.is-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-control.is-valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #e74c3c;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #27ae60;
}

/* Form Help Text */
.form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.form-section h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Progress Bar */
.form-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.3s ease;
}

/* Form Steps */
.form-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.form-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.form-step::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #ecf0f1;
    z-index: -1;
}

.form-step:first-child::before {
    left: 50%;
}

.form-step:last-child::before {
    right: 50%;
}

.step-number {
    width: 40px;
    height: 40px;
    background: #ecf0f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
}

.form-step.active .step-number {
    background: #3498db;
    color: #ffffff;
}

.form-step.completed .step-number {
    background: #27ae60;
    color: #ffffff;
}

.step-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.form-step.active .step-label {
    color: #3498db;
}

.form-step.completed .step-label {
    color: #27ae60;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .form-steps {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-step::before {
        display: none;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 0.75rem;
        margin: 0.5rem;
    }
    
    .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
    }
}

/* Print Styles */
@media print {
    .form-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .form-actions,
    .btn {
        display: none;
    }
    
    .form-control {
        border: 1px solid #ddd;
        background: transparent;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .btn,
    .progress-fill {
        transition: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Focus Visible */
.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Alert Styles */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert ul {
    margin: 0;
    padding-left: 1.5rem;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .form-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .form-control {
        background: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .form-control:focus {
        border-color: #3498db;
        background: #2d2d2d;
    }
    
    .form-section {
        background: #2d2d2d;
    }
    
    .form-group label {
        color: #e0e0e0;
    }
    
    .step-label {
        color: #b0b0b0;
    }
    
    .alert-success {
        background-color: #1e4a2e;
        border-color: #2d5a3d;
        color: #d4edda;
    }
    
    .alert-danger {
        background-color: #4a1e1e;
        border-color: #5a2d2d;
        color: #f8d7da;
    }
}

/* Demo Page Styling */
.card {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.card-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Progress Bar */
.progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Dark Mode Demo Styling */
@media (prefers-color-scheme: dark) {
    .card {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .card-header {
        background: #3d3d3d;
        border-color: #404040;
    }
    
    .card-header h3 {
        color: #e0e0e0;
    }
}

/* File Upload Styles */
.file-upload-container {
    border: 2px dashed #63B3F6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-container:hover {
    border-color: #011F5B;
    background: #f0f8ff;
}

.file-upload-container.has-file {
    border-color: #28a745;
    background: #f0fff4;
}

.file-upload {
    display: none;
}

.file-upload-container p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.file-info {
    margin-top: 10px;
    display: none;
}

.file-info.show {
    display: block;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-name {
    font-weight: 600;
    color: #28a745;
    flex: 1;
}

.file-size {
    font-size: 0.85rem;
    color: #666;
    margin-right: 10px;
}

.remove-file-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.remove-file-btn:hover {
    background: #c82333;
}

.file-error {
    color: #dc3545;
    font-weight: 600;
}

/* Preserved file styles */
.preserved-file {
    display: block !important;
}

.preserved-file .file-item {
    background: #e8f5e8;
    border-color: #28a745;
}

.preserved-file .file-name {
    color: #155724;
}
