/* Modern Form Design - Theme Inherited Styles */

/* Container */
.az-form-container {
    max-width: 600px !important;
    margin: 40px auto !important;
    padding: 40px !important;
    background: var(--wp--preset--color--background, #ffffff) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    font-family: inherit !important;
    color: var(--wp--preset--color--foreground, #1f2937) !important;
    border: 1px solid #e5e7eb !important;
    display: block !important;
    box-sizing: border-box !important;
}

.az-form-container * {
    box-sizing: border-box !important;
}

/* Title */
.az-form-container h3 {
    display: none !important;
}

/* Form Group */
.az-form-group {
    margin-bottom: 20px !important;
    display: block !important;
    width: 100% !important;
}

/* Labels */
.az-form-label {
    display: block !important;
    margin-bottom: 8px !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    font-weight: 600 !important;
    color: inherit !important;
    text-transform: capitalize !important;
}

/* Inputs (Text, Email, etc.) */
.az-form-control {
    display: block !important;
    width: 100% !important;
    padding: 10px 14px !important;
    font-size: 1rem !important; /* 16px prevents zoom on iOS */
    line-height: 1.5 !important;
    color: inherit !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important; /* Small radius */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    height: auto !important; /* Fix for some themes setting fixed height */
    min-height: 42px !important;
}

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

.az-form-control:focus {
    color: inherit;
    background-color: #fff;
    border-color: var(--wp--preset--color--primary, #2563eb);
    outline: 0;
    /* Use primary color with opacity for shadow if possible, otherwise generic blue */
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--primary, #2563eb), transparent 75%);
}

.az-form-control::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Textarea specific */
textarea.az-form-control {
    min-height: 120px !important;
    resize: vertical !important;
}

/* Select specific */
select.az-form-control {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    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 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.5rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
    padding-right: 2.5rem !important;
}

/* Checkboxes */
.az-form-checkbox-group {
    display: flex !important;
    align-items: center !important;
    margin-top: 8px !important;
}

.az-form-checkbox {
    width: 1.25rem !important;
    height: 1.25rem !important;
    margin-right: 0.5rem !important;
    border-radius: 4px !important;
    border: 1px solid #d1d5db !important;
    cursor: pointer !important;
}

:where(.az-form-checkbox) {
    accent-color: var(--wp--preset--color--primary, #2563eb);
}

/* Radio Buttons */
.az-form-radio-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 4px !important;
}

.az-radio-item {
    display: flex !important;
    align-items: center !important;
}

.az-radio-item input[type="radio"] {
    margin-right: 8px !important;
    width: 1.15rem !important;
    height: 1.15rem !important;
    cursor: pointer !important;
    margin-top: 0 !important; /* Reset WP styles */
}

:where(.az-radio-item input[type="radio"]) {
    accent-color: var(--wp--preset--color--primary, #2563eb);
}

.az-radio-item label {
    margin-bottom: 0 !important;
    font-weight: 400 !important;
    color: inherit !important;
    cursor: pointer !important;
    font-size: 1rem !important;
}

/* Submit Button */
.az-form-submit {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    cursor: pointer !important;
    margin-top: 24px !important;
    /* Keep structural styles strong, but allow theme overrides for colors */
}

/* Default styles with low specificity (0-0-0) to allow theme buttons to override */
:where(.az-form-submit) {
    font-weight: 600;
    line-height: 1.5;
    color: #ffffff;
    vertical-align: middle;
    user-select: none;
    background-color: var(--wp--preset--color--primary, #2563eb);
    background-image: none;
    border: 1px solid transparent;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: inherit;
}

:where(.az-form-submit:hover) {
    background-color: var(--wp--preset--color--primary, #1d4ed8);
    filter: brightness(0.9);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

:where(.az-form-submit:active) {
    filter: brightness(0.8);
    transform: translateY(0);
}

/* File Input - Better Styling */
.az-file-input {
    display: block !important;
    width: 100% !important;
    padding: 10px !important;
    background: #f9fafb !important;
    border: 1px dashed #d1d5db !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    color: inherit !important;
    cursor: pointer !important;
}

.az-file-input:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
}

/* Style the file button itself (modern browsers) */
.az-file-input::file-selector-button {
    margin-right: 16px !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    background-color: #e5e7eb !important;
    color: inherit !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
}

.az-file-input::file-selector-button:hover {
    background-color: #d1d5db !important;
}

/* Webkit fallback */
.az-file-input::-webkit-file-upload-button {
    margin-right: 16px !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    background-color: #e5e7eb !important;
    color: inherit !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
}

/* Messages */
.az-form-success, .az-form-error {
    padding: 1rem 1.25rem !important;
    margin-bottom: 1.5rem !important;
    border-radius: 6px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    display: block !important;
}

.az-form-success {
    color: #065f46 !important;
    background-color: #ecfdf5 !important;
    border: 1px solid #d1fae5 !important;
    border-left: 4px solid #10b981 !important;
    
    /* Make it bigger and centered as requested */
    padding: 2.5rem !important;
    font-size: 1.5rem !important;
    text-align: center !important;
    font-weight: 600 !important;
    margin-bottom: 0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.az-form-error {
    color: #991b1b !important;
    background-color: #fef2f2 !important;
    border: 1px solid #fee2e2 !important;
    border-left: 4px solid #ef4444 !important;
}

/* Responsive */
@media (max-width: 640px) {
    .az-form-container {
        padding: 20px !important;
        margin: 20px 10px !important;
        width: auto !important;
    }
}