/**
 * Contact Form Styles
 * WCAG 2.2 AA Compliant
 */

/* Form Container */
.dm-contact-form-wrapper {
    max-width: 100%;
}

.dm-contact-form {
    display: block;
}

/* Form Fields Grid */
.dm-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 -10px;
}

.dm-form-field {
    padding: 0 10px;
    box-sizing: border-box;
}

/* Labels */
.dm-form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.dm-form-required {
    color: #D32F2F;
    margin-left: 4px;
    font-size: 0.9em;
}

.dm-form-optional {
    color: inherit !important;
    margin-left: 4px;
    font-size: 0.85em;
    font-weight: 400;
}

/* Form Inputs */
.dm-form-input,
.dm-form-textarea,
.dm-form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    background-color: #FFFFFF;
    color: #333333;
    transition: border-color 0.3s ease, outline-color 0.3s ease;
    box-sizing: border-box;
}

.dm-form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Focus State - WCAG Requirement */
/* Focus styles managed by global WCAG settings */

/* Error State */
.dm-form-input.error,
.dm-form-textarea.error,
.dm-form-select.error,
.dm-form-input[aria-invalid="true"],
.dm-form-textarea[aria-invalid="true"],
.dm-form-select[aria-invalid="true"] {
    border-color: #D32F2F;
}

/* Error Messages */
.dm-form-error {
    display: none;
    color: #D32F2F;
    font-size: 14px;
    margin-top: 4px;
}

.dm-form-error:not(:empty) {
    display: block;
}

/* Math Captcha */
.dm-math-question {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: inherit;
}

/* Checkboxes */
.dm-form-field-checkbox {
    margin-top: 16px;
    margin-bottom: 0;
}

.dm-form-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
}

.dm-form-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #CCCCCC;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-top: 2px;
}

.dm-form-checkbox:checked {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.dm-form-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Focus styles managed by global WCAG settings */

.dm-form-checkbox-label {
    font-size: 14px;
    line-height: 1.6;
    color: inherit;
    display: inline;
}

.dm-form-checkbox-label .dm-form-required,
.dm-form-checkbox-label .dm-form-optional {
    display: inline;
    white-space: nowrap;
    margin-left: 0;
}

.dm-form-checkbox-label a {
    color: inherit;
    text-decoration: underline;
}

/* Submit Button */
.dm-form-actions {
    margin-top: 20px;
}

.dm-form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: #FFFFFF;
    background-color: #4CAF50;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.15s ease;
    text-decoration: none;
}

.dm-form-submit:hover {
    background-color: #45A049;
}

/* Focus styles managed by global WCAG settings */

.dm-form-submit:active {
    transform: translateY(1px);
}

.dm-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dm-button-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.dm-button-icon i,
.dm-button-icon svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Loading State */
.dm-form-loading .dm-form-submit {
    position: relative;
}

.dm-form-loading .dm-form-submit::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: dm-spinner 0.6s linear infinite;
}

@keyframes dm-spinner {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Messages */
.dm-form-messages {
    margin-top: 20px;
}

.dm-form-message {
    padding: 14px 16px;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
}

.dm-form-success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid #4CAF50;
}

.dm-form-error-general {
    background-color: #FFEBEE;
    color: #C62828;
    border-left: 4px solid #D32F2F;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {

    /* High contrast focus managed by global WCAG settings */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .dm-form-input,
    .dm-form-textarea,
    .dm-form-select,
    .dm-form-checkbox,
    .dm-form-submit {
        transition: none;
    }

    .dm-form-loading .dm-form-submit::after {
        animation: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {

    .dm-form-field[style*="width: 50%"],
    .dm-form-field[style*="width: 33%"] {
        width: 100% !important;
    }

    .dm-form-fields {
        margin: 0;
    }

    .dm-form-field {
        padding: 0;
    }

    .dm-form-submit {
        width: 100%;
    }
}

/* File Upload Styles */
.dm-form-file-wrapper {
    position: relative;
}

.dm-form-file-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.dm-form-file-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: #333333;
    background-color: #F5F5F5;
    border: 2px solid #CCCCCC;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dm-form-file-button:hover {
    background-color: #E8E8E8;
    border-color: #999999;
}

/* Focus styles managed by global WCAG settings */

.dm-file-icon {
    font-size: 18px;
    line-height: 1;
}

.dm-form-file-name {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: #4CAF50;
    font-weight: 500;
}

.dm-form-file-info {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #666666;
    font-style: italic;
}

/* File Upload Error State */
.dm-form-file-input.error+.dm-form-file-button {
    border-color: #D32F2F;
}

.dm-form-file-input[aria-invalid="true"]+.dm-form-file-button {
    border-color: #D32F2F;
}

/* Print Styles */
@media print {

    .dm-form-submit,
    .dm-form-messages {
        display: none;
    }

    .dm-contact-form {
        border: 1px solid #000;
        padding: 20px;
    }

    .dm-form-file-button {
        display: none;
    }
}