/* Form Optimization Styles */
/* Enhanced UX for contact forms with validation states */

/* Form Container Enhancements */
.contact-form {
    position: relative;
}

/* Field Container */
.field {
    position: relative;
    margin-bottom: 1rem;
    transition: all 0.2s ease-in-out;
}

/* Field Labels */
.field label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    color: inherit;
    font-size: 0.95rem;
    line-height: 1.3;
}

/* Required Field Indicator */
.field .required {
    color: #dc3545;
    font-weight: 600;
    margin-left: 3px;
}

/* Optional Field Indicator */
.field .optional {
    color: #6c757d;
    font-weight: 400;
    font-size: 0.85rem;
}

/* Form Input Elements */
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--color-canvas-default, #fff);
    color: var(--color-fg-default, #000);
    transition: all 0.3s ease-in-out;
    line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #999;
    opacity: 0.8;
}

/* Input Focus State */
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: #0550ae;
    box-shadow: 0 0 0 4px rgba(5, 80, 174, 0.15);
    background-color: var(--color-canvas-inset, #f6f8fa);
}

/* Valid Field State */
.field-valid-state input,
.field-valid-state textarea,
.field-valid-state select {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.field-valid-state input:focus,
.field-valid-state textarea:focus,
.field-valid-state select:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
}

/* Valid Field Indicator */
.field-valid-state::after {
    content: '✓';
    position: absolute;
    right: 14px;
    top: 44px;
    color: #28a745;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Error Field State */
.field-error-state input,
.field-error-state textarea,
.field-error-state select {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.04);
}

.field-error-state input:focus,
.field-error-state textarea:focus,
.field-error-state select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.15);
}

/* Error Message */
.field-error {
    display: block;
    margin-top: 0.6rem;
    color: #dc3545;
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 1.25rem;
    animation: slideDown 0.2s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field Hint */
.field-hint {
    display: block;
    margin-top: 0.4rem;
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Checkbox Field */
.field-checkbox {
    margin-bottom: 1.75rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 400;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    gap: 0.75rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid #e1e4e8;
    border-radius: 4px;
    accent-color: #0550ae;
}

.checkbox-label input[type="checkbox"]:checked {
    background-color: #0550ae;
    border-color: #0550ae;
}

.checkbox-label input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(5, 80, 174, 0.25);
}

.field-checkbox.field-error-state .checkbox-label input[type="checkbox"] {
    border-color: #dc3545;
}

/* Form Alert Messages */
.form-alert,
.form-success,
.form-warning {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-alert {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #dc3545;
}

.form-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
    color: #28a745;
}

.form-warning {
    background-color: rgba(255, 193, 7, 0.12);
    border-color: #ffc107;
    color: #b88600;
}

/* Submit Button */
.field button[type="submit"],
button[type="submit"].btn {
    padding: 0.95rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    border: none;
    border-radius: 8px;
    width: 100%;
    max-width: none;
}

button[type="submit"].btn.primary {
    background-color: #0550ae;
    color: white;
}

button[type="submit"].btn.primary:hover:not(:disabled) {
    background-color: #0339a6;
    box-shadow: 0 6px 16px rgba(5, 80, 174, 0.35);
    transform: translateY(-2px);
}

button[type="submit"].btn.primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Disabled Submit Button */
button[type="submit"]:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Toasts */
.toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    min-width: 260px;
    max-width: 360px;
    background: rgba(17, 17, 26, 0.95);
    color: #fff;
    padding: 12px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    animation: toastIn 200ms ease forwards;
}
.toast--success { border-left: 4px solid #28a745; }
.toast--error { border-left: 4px solid #dc3545; }
.toast--warning { border-left: 4px solid #ffc107; }
.toast__icon { font-size: 18px; }
.toast__msg { flex: 1; font-size: 0.95rem; line-height: 1.3; }
.toast__close { background: transparent; border: 0; color: #fff; cursor: pointer; opacity: 0.7; }
.toast__close:hover { opacity: 1; }
@keyframes toastIn {
    to { opacity: 1; transform: translateY(0); }
}

/* Form Helper Text */
.form-helper {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Form Header */
.form-next {
    color: #0550ae;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(5, 80, 174, 0.05);
    border-radius: 6px;
    border-left: 4px solid #0550ae;
}

.form-next strong {
    color: var(--color-fg-default, #000);
}

/* Responsive Design */
@media (max-width: 768px) {
    .field {
        margin-bottom: 1.25rem;
    }

    .field input,
    .field textarea,
    .field select {
        padding: 0.65rem 0.875rem;
        font-size: 1rem;
    }

    .field-valid-state::after {
        right: 8px;
        top: 35px;
        font-size: 1rem;
    }

    .checkbox-label {
        font-size: 0.9rem;
    }

    button[type="submit"].btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .field input,
    .field textarea,
    .field select {
        background-color: #1e1e1e;
        color: #fff;
        border-color: #404040;
    }

    .field input::placeholder,
    .field textarea::placeholder {
        color: #999;
    }

    .field input:focus,
    .field textarea:focus,
    .field select:focus {
        background-color: #262626;
        border-color: #5a9fd4;
    }

    .field-valid-state input,
    .field-valid-state textarea {
        background-color: #1a2b1f;
    }

    .field-error-state input,
    .field-error-state textarea {
        background-color: #2b1a1f;
    }

    .form-next {
        background-color: rgba(5, 80, 174, 0.15);
        color: #5a9fd4;
    }

    .form-next strong {
        color: #fff;
    }

    .form-alert {
        background-color: rgba(220, 53, 69, 0.15);
    }

    .form-success {
        background-color: rgba(40, 167, 69, 0.15);
    }
}
