/* form-styles.css - Frontend Form Styles */

/* Form Container */
.simple-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .simple-form {
        margin: 10px;
        padding: 20px;
        border-radius: 8px;
    }
}

/* Form Header */
.simple-form h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 768px) {
    .simple-form h3 {
        font-size: 24px;
    }
}

.simple-form .form-description {
    color: #666;
    margin-bottom: 40px;
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 768px) {
    .simple-form .form-description {
        margin-bottom: 30px;
        font-size: 15px;
    }
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .form-grid {
        gap: 12px;
    }
}

/* Field Width Classes */
.form-field {
    display: flex;
    flex-direction: column;
}

.form-field.width-25 { grid-column: span 1; }
.form-field.width-50 { grid-column: span 2; }
.form-field.width-75 { grid-column: span 3; }
.form-field.width-100 { grid-column: span 4; }

@media (max-width: 768px) {
    .form-field.width-25,
    .form-field.width-50,
    .form-field.width-75,
    .form-field.width-100 {
        grid-column: span 1;
    }
}

/* Form Labels */
.form-field label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 15px;
    display: block;
}

.form-field .required {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 2px;
}

/* Form Inputs */
.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #fff;
    font-family: inherit;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 4px rgba(0, 124, 186, 0.1);
    transform: translateY(-1px);
}

.form-field input:hover,
.form-field textarea:hover,
.form-field select:hover {
    border-color: #b8d4f0;
}

/* Textarea Specific */
.form-field textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
}

/* Select Specific */
.form-field select {
    cursor: pointer;
    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='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 48px;
}

/* Radio and Checkbox Groups */
.form-field .option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-field .option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.form-field .option-item:hover {
    background-color: #f8f9fa;
    border-color: #e1e8ed;
}

.form-field .option-item:has(input:checked) {
    background-color: #e7f3ff;
    border-color: #007cba;
}

.form-field .option-item input[type="radio"],
.form-field .option-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.3);
    accent-color: #007cba;
}

.form-field .option-item label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    font-size: 15px;
}

/* File Upload Styles */
.file-upload-container {
    position: relative;
}

.file-upload-area {
    border: 3px dashed #e1e8ed;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    background: #fafbfc;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: #007cba;
    background: rgba(0, 124, 186, 0.05);
    transform: translateY(-2px);
}

.file-upload-area.dragover {
    border-color: #007cba;
    background: rgba(0, 124, 186, 0.1);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.15);
}

.file-upload-icon {
    font-size: 56px;
    margin-bottom: 20px;
    color: #ccc;
    display: block;
}

.file-upload-text {
    color: #666;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.file-upload-subtext {
    color: #999;
    font-size: 14px;
    line-height: 1.4;
}

.file-upload-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Uploaded Files Display */
.uploaded-files {
    margin-top: 20px;
}

.uploaded-file,
.uploading-file {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.uploaded-file:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.uploaded-file-icon {
    font-size: 24px;
    margin-right: 16px;
    color: #28a745;
    min-width: 24px;
}

.uploading-file .uploaded-file-icon {
    color: #ffc107;
}

.uploaded-file-info {
    flex: 1;
    min-width: 0;
}

.uploaded-file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    word-break: break-word;
}

.uploaded-file-size {
    font-size: 13px;
    color: #666;
}

.uploaded-file-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uploaded-file-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Error States */
.form-field.has-error input,
.form-field.has-error textarea,
.form-field.has-error select,
.form-field.has-error .file-upload-area {
    border-color: #e53e3e;
    background-color: #fef2f2;
}

.form-field .field-error {
    background-color: #fef2f2;
    color: #c53030;
    padding: 10px 16px;
    border-radius: 6px;
    border-left: 4px solid #e53e3e;
    font-size: 14px;
    margin-top: 8px;
    display: none;
    animation: slideInDown 0.3s ease;
}

.form-field.has-error .field-error {
    display: block;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Submit Section */
.form-submit {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f1f3f4;
}

.form-submit-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 160px;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.4);
}

.form-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

.form-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2);
}

/* Loading Animation */
.form-submit-btn.loading {
    color: transparent;
}

.form-submit-btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid transparent;
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message */
.form-success {
    text-align: center;
    padding: 50px 20px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    border-radius: 12px;
    color: #155724;
    display: none;
    animation: successPulse 0.6s ease;
}

.form-success.show {
    display: block;
}

@keyframes successPulse {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.form-success h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #155724;
    font-size: 24px;
    font-weight: 700;
}

.form-success p {
    margin-bottom: 0;
    font-size: 16px;
    line-height: 1.5;
}

/* General Error Message */
.form-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f1c0c5 100%);
    border: 2px solid #dc3545;
    color: #721c24;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: none;
    animation: errorShake 0.5s ease;
}

.form-error.show {
    display: block;
}

@keyframes errorShake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .simple-form {
        padding: 15px;
    }
    
    .form-field input,
    .form-field textarea,
    .form-field select {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .file-upload-area {
        padding: 30px 15px;
    }
    
    .file-upload-icon {
        font-size: 40px;
        margin-bottom: 15px;
    }
    
    .file-upload-text {
        font-size: 16px;
    }
    
    .form-submit-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .uploaded-file,
    .uploading-file {
        padding: 12px;
    }
    
    .uploaded-file-icon {
        font-size: 20px;
        margin-right: 12px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .simple-form {
        border: 3px solid #000;
    }
    
    .form-field input,
    .form-field textarea,
    .form-field select {
        border: 2px solid #000;
    }
    
    .form-field input:focus,
    .form-field textarea:focus,
    .form-field select:focus {
        border: 3px solid #000;
        box-shadow: none;
    }
    
    .form-submit-btn {
        border: 2px solid #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .simple-form {
        background: #1a1a1a;
        color: #e0e0e0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .simple-form h3 {
        color: #e0e0e0;
    }
    
    .simple-form .form-description {
        color: #b0b0b0;
    }
    
    .form-field label {
        color: #e0e0e0;
    }
    
    .form-field input,
    .form-field textarea,
    .form-field select {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .form-field input:focus,
    .form-field textarea:focus,
    .form-field select:focus {
        border-color: #4a9eff;
        box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.1);
    }
    
    .option-item {
        background-color: #2a2a2a;
        border-color: #444;
    }
    
    .option-item:hover {
        background-color: #333;
        border-color: #555;
    }
    
    .file-upload-area {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .file-upload-area:hover {
        border-color: #4a9eff;
        background: rgba(74, 158, 255, 0.1);
    }
    
    .uploaded-file,
    .uploading-file {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .form-success {
        background: #1a3a2e;
        border-color: #28a745;
        color: #4fd69c;
    }
    
    .form-error {
        background: #3a1a1a;
        border-color: #dc3545;
        color: #f5a3a3;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .form-field input,
    .form-field textarea,
    .form-field select,
    .form-submit-btn,
    .file-upload-area,
    .uploaded-file,
    .option-item {
        transition: none;
    }
    
    .form-success,
    .form-error,
    .field-error {
        animation: none;
    }
    
    .form-submit-btn.loading::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .simple-form {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .form-submit,
    .file-upload-area,
    .uploaded-files {
        display: none;
    }
    
    .form-field input,
    .form-field textarea,
    .form-field select {
        border: 1px solid #000;
        background: white;
    }
}

/* Focus Visible for Better Accessibility */
.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible,
.option-item:focus-visible,
.form-submit-btn:focus-visible {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* Skip Link for Screen Readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Form Validation States */
.form-field input:valid {
    border-color: #28a745;
}

.form-field input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #dc3545;
}