/* WP Advanced Form - Frontend Styles */

/* Form Container */
.wpaf-form-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Form Header */
.wpaf-form-header {
    margin-bottom: 30px;
    text-align: center;
}

.wpaf-form-title {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.wpaf-form-description {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

/* Form Messages */
.wpaf-form-messages {
    margin-bottom: 20px;
}

.wpaf-form-success,
.wpaf-form-error {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.wpaf-form-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.wpaf-form-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.wpaf-success-message,
.wpaf-error-message {
    margin: 0;
    font-weight: 500;
}

/* Form Fields */
.wpaf-form-fields {
    margin-bottom: 30px;
}

/* Form Table Layout */
.wpaf-form-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.wpaf-form-row {
    border-bottom: 1px solid #e5e7eb;
}

.wpaf-form-row:last-child {
    border-bottom: none;
}

.wpaf-form-label {
    padding: 15px 20px 15px 0;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    vertical-align: middle;
    width: 30%;
    text-align: left;
}

.wpaf-form-field {
    padding: 15px 0;
    vertical-align: middle;
    overflow: hidden;
    max-width: 100%;
}

.wpaf-field {
    margin-bottom: 25px;
}

.wpaf-field__label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.wpaf-required {
    color: #e74c3c;
    font-weight: bold;
}

.wpaf-field__input {
    position: relative;
}

/* Prevent field__input class from affecting wrapper divs */
div.wpaf-field__input,
fieldset.wpaf-field__input {
    width: auto;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    margin: 0;
}

/* Input Styles */
.wpaf-input,
.wpaf-textarea,
.wpaf-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    color: #374151;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

.wpaf-input:focus,
.wpaf-textarea:focus,
.wpaf-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wpaf-input::placeholder,
.wpaf-textarea::placeholder {
    color: #9ca3af;
}

/* Textarea specific */
.wpaf-textarea {
    resize: vertical;
    min-height: 100px;
}

/* File Input */
input[type="file"].wpaf-file,
.wpaf-file {
    width: 100%;
    max-width: 100%;
    padding: 8px;
    border: 2px dashed #e5e7eb;
    border-radius: 6px;
    background-color: #f9fafb;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.wpaf-file:hover {
    border-color: #d1d5db;
}

.wpaf-file:focus {
    outline: none;
    border-color: #3b82f6;
}

.wpaf-file-info {
    margin-top: 5px;
    font-size: 12px;
    color: #6b7280;
    word-break: break-word;
}

/* Custom File Upload Wrapper (Japanese Text) */
.wpaf-file-upload-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.wpaf-file-upload-label {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    cursor: pointer;
    gap: 10px;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.wpaf-file-upload-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3b82f6;
    color: #ffffff;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s;
    white-space: nowrap;
    max-width: 150px;
}

.wpaf-file-upload-button:hover {
    background-color: #2563eb;
}

.wpaf-file-upload-filename {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 160px);
    padding: 8px 12px;
    background-color: #f3f4f6;
    border: 2px dashed #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    display: block;
}

.wpaf-file-upload-filename.has-file {
    color: #374151;
    font-weight: 500;
    border-color: #3b82f6;
    background-color: #eff6ff;
}

/* Radio and Checkbox Groups */
.wpaf-radio-group,
.wpaf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Ensure radio/checkbox groups don't get text input styling */
.wpaf-radio-group.wpaf-field__input,
.wpaf-checkbox-group.wpaf-field__input {
    width: auto;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
}

.wpaf-radio-label,
.wpaf-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.wpaf-radio,
.wpaf-checkbox,
input[type="radio"].wpaf-field__input,
input[type="checkbox"].wpaf-field__input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    /* Override any text input styles */
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 0;
    box-sizing: border-box;
}

input[type="radio"].wpaf-field__input {
    border-radius: 50%;
}

.wpaf-radio-text,
.wpaf-checkbox-text {
    color: #374151;
    font-size: 16px;
}

/* Error Messages */
.wpaf-field__error {
    margin-top: 5px;
    padding: 8px 12px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #dc2626;
    font-size: 14px;
}

.wpaf-field--error .wpaf-input,
.wpaf-field--error .wpaf-textarea,
.wpaf-field--error .wpaf-select {
    border-color: #dc2626;
}

.wpaf-field--error .wpaf-input:focus,
.wpaf-field--error .wpaf-textarea:focus,
.wpaf-field--error .wpaf-select:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Submit Button */
.wpaf-form-submit {
    text-align: center;
    margin-bottom: 20px;
}

.wpaf-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    position: relative;
    min-width: 140px;
}

.wpaf-submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wpaf-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wpaf-submit-loading {
    display: none;
}

.wpaf-submit-button.wpaf-loading .wpaf-submit-loading {
    display: inline;
}

/* Form Footer */
.wpaf-form-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.wpaf-required-note {
    color: #6b7280;
}

/* Success Modal */
.wpaf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.wpaf-modal-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: wpaf-modal-slide-up 0.3s ease-out;
}

@keyframes wpaf-modal-slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wpaf-success-icon {
    font-size: 48px;
    color: #10b981;
    margin-bottom: 20px;
    line-height: 1;
}

.wpaf-success-text {
    font-size: 16px;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.5;
}

.wpaf-modal-close {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.15s ease-in-out;
}

.wpaf-modal-close:hover {
    background: #2563eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpaf-form-container {
        margin: 10px;
        padding: 20px;
    }

    .wpaf-form-title {
        font-size: 20px;
    }

    /* Stack table layout on mobile */
    .wpaf-form-table,
    .wpaf-form-row,
    .wpaf-form-label,
    .wpaf-form-field {
        display: block;
        width: 100%;
    }

    .wpaf-form-label {
        padding: 10px 0 5px 0;
        border-bottom: none;
    }

    .wpaf-form-field {
        padding: 5px 0 15px 0;
        overflow: hidden;
    }

    .wpaf-form-row {
        padding: 10px 0;
    }

    .wpaf-radio-group,
    .wpaf-checkbox-group {
        gap: 8px;
    }
    
    /* File input on mobile */
    input[type="file"].wpaf-file,
    .wpaf-file {
        font-size: 14px;
        padding: 6px;
    }

    .wpaf-submit-button {
        width: 100%;
        padding: 15px 20px;
    }
}

/* Loading Animation */
@keyframes wpaf-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.wpaf-submit-button.wpaf-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: wpaf-spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* No Fields Message */
.wpaf-no-fields {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-style: italic;
}

/* Accessibility Improvements */
.wpaf-input:focus,
.wpaf-textarea:focus,
.wpaf-select:focus,
.wpaf-file:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .wpaf-form-container {
        border: 2px solid #000;
    }

    .wpaf-input,
    .wpaf-textarea,
    .wpaf-select {
        border-color: #000;
    }

    .wpaf-submit-button {
        background: #000;
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .wpaf-submit-button,
    .wpaf-input,
    .wpaf-textarea,
    .wpaf-select,
    .wpaf-file {
        transition: none;
    }

    .wpaf-submit-button:hover {
        transform: none;
    }

    @keyframes wpaf-modal-slide-up {

        from,
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wpaf-form-container {
        background: #1f2937;
        color: #f9fafb;
        border: 1px solid #374151;
    }

    .wpaf-form-title {
        color: #f9fafb;
    }

    .wpaf-form-description {
        color: #d1d5db;
    }

    .wpaf-field__label {
        color: #f3f4f6;
    }

    .wpaf-input,
    .wpaf-textarea,
    .wpaf-select {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .wpaf-input:focus,
    .wpaf-textarea:focus,
    .wpaf-select:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }

    .wpaf-file {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .wpaf-radio-text,
    .wpaf-checkbox-text {
        color: #f3f4f6;
    }

    .wpaf-modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
}

/* Confirm Submit Field Styles */
.wpaf-confirm-submit-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #f9fafb;
}

.wpaf-confirmation-section {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-bottom: 15px;
}

.wpaf-confirmation-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

.wpaf-confirmation-content {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.wpaf-confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Confirmation Modal */
.wpaf-modal.wpaf-confirmation-modal[aria-hidden="true"] {
    display: none;
}
.wpaf-modal.wpaf-confirmation-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow: auto;
    will-change: opacity;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.wpaf-modal.wpaf-confirmation-modal .wpaf-modal-content {
    box-sizing: border-box;
    max-width: 900px;
    width: 100%;
    background: #fff;
    border-radius: 6px;
    padding: 24px;
    position: relative;
    transform: translateX(-50%);
    animation: none;
}
.wpaf-modal.wpaf-confirmation-modal .wpaf-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.wpaf-initial-submit {
    text-align: center;
}

.wpaf-confirm-button,
.wpaf-submit-final,
.wpaf-back-to-form {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.wpaf-confirm-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.wpaf-confirm-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wpaf-confirm-button:active:not(:disabled) {
    transform: translateY(0);
}

.wpaf-confirm-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wpaf-submit-final {
    background-color: #10b981;
    color: white;
}

.wpaf-submit-final:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.wpaf-back-to-form {
    background-color: #6b7280;
    color: white;
}

.wpaf-back-to-form:hover {
    background-color: #4b5563;
    transform: translateY(-1px);
}

/* Responsive design for confirm submit */
@media (max-width: 768px) {
    .wpaf-confirmation-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .wpaf-confirm-button,
    .wpaf-submit-final,
    .wpaf-back-to-form {
        width: 100%;
        max-width: 200px;
    }
}

/* Confirmation table styles */
.wpaf-confirmation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.wpaf-confirmation-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.wpaf-confirmation-label {
    font-weight: 600;
    color: #374151;
    background-color: #f9fafb;
    width: 30%;
}

.wpaf-required-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 3px;
    background-color: #dc2626; /* red */
    color: #fff;
    vertical-align: middle;
}

.wpaf-confirmation-value {
    color: #6b7280;
    word-break: break-word;
}

/* Enhanced Error Styling */
.wpaf-field--error,
.wpaf-form-row--error {
    position: relative;
}

.wpaf-field--error .wpaf-field__error,
.wpaf-form-row--error .wpaf-field__error {
    color: #dc3232;
    font-size: 13px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.wpaf-field-error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 1px #dc3232 !important;
    background-color: #fef7f7;
}

.wpaf-field-error:focus {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.2) !important;
    outline: none;
}

/* Error message styling */
.wpaf-form-error {
    background-color: #fef7f7;
    border: 1px solid #dc3232;
    border-radius: 4px;
    padding: 12px 15px;
    margin: 15px 0;
    color: #dc3232;
    font-weight: 500;
}

.wpaf-form-error .wpaf-error-message {
    margin: 0;
    font-size: 14px;
}

/* Success message styling */
.wpaf-form-success {
    background-color: #f0f9ff;
    border: 1px solid #46b450;
    border-radius: 4px;
    padding: 12px 15px;
    margin: 15px 0;
    color: #46b450;
    font-weight: 500;
}

.wpaf-form-success .wpaf-success-message {
    margin: 0;
    font-size: 14px;
}

/* Agreement field styles */
.wpaf-agreement-wrapper {
    margin: 10px 0;
}

.wpaf-agreement-container {
    margin: 10px 0;
}

.wpaf-agreement-content {
    margin-bottom: 15px;
    padding: 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    line-height: 1.6;
    white-space: pre-line; /* Respect newlines (\n) and collapse spaces */
    word-wrap: break-word; /* Break long words if needed */
}

.wpaf-agreement-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.wpaf-agreement-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.wpaf-agreement-label input[type="checkbox"],
.wpaf-agreement-checkbox input[type="checkbox"],
input[type="checkbox"].wpaf-agreement.wpaf-field__input {
    margin-top: 2px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    /* Override any conflicting styles */
    padding: 0;
    border: 1px solid #d1d5db;
    accent-color: #3b82f6;
}

.wpaf-agreement-text {
    flex: 1;
    color: #333;
}

.wpaf-agreement-label:hover .wpaf-agreement-text {
    color: #0073aa;
}

.wpaf-agreement-container .wpaf-field-description {
    margin: 8px 0 0 24px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Postal code field styles - MW-WP-Form compatible */
.wpaf-zip-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
}

.wpaf-zip-symbol {
    font-size: 18px;
    font-weight: 500;
    color: #2c3e50;
    margin-right: 4px;
    user-select: none;
}

.zip-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zip-group .p-postal-code {
    text-align: center;
    font-size: 16px;
    letter-spacing: 1px;
    width: auto;
}

.zip-separator {
    font-size: 18px;
    color: #6b7280;
    font-weight: 500;
    margin: 0 4px;
}

.wpaf-postal-code-input {
    font-family: monospace, sans-serif;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-align: left;
}

.wpaf-postal-code-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Auto-formatting indicator */
.wpaf-postal-code-format {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* Prefecture and City field styles */
.wpaf-prefecture-display,
.wpaf-city-display {
    display: inline-block;
    padding: 2px 0;
}

/* Form Progress Indicator */
.wpaf-form-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.wpaf-progress-step {
    display: flex;
    align-items: center;
    margin: 0 10px;
    font-size: 14px;
    color: #6c757d;
}

.wpaf-progress-step.active {
    color: #0073aa;
    font-weight: 600;
}

.wpaf-progress-step.completed {
    color: #28a745;
}

.wpaf-progress-step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.wpaf-progress-step.active .step-number {
    background: #0073aa;
    color: white;
}

.wpaf-progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.wpaf-progress-arrow {
    margin: 0 15px;
    color: #dee2e6;
    font-size: 16px;
}

/* Confirmation Page Styles */
.wpaf-confirmation-page {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.wpaf-confirmation-title {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.wpaf-confirmation-content {
    margin-bottom: 20px;
}

.wpaf-confirmation-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.wpaf-confirm-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    min-width: 140px;
}

.wpaf-confirm-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wpaf-confirm-button:active:not(:disabled) {
    transform: translateY(0);
}

.wpaf-confirm-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wpaf-back-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.wpaf-back-button:hover {
    background: #545b62;
}

/* Confirm Submit Field Styles */
.wpaf-confirm-submit-container {
    margin: 20px 0;
}

.wpaf-initial-submit {
    text-align: center;
}

.wpaf-confirmation-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.wpaf-confirmation-fields {
    margin-bottom: 20px;
}

.wpaf-confirmation-field {
    display: flex;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.wpaf-confirmation-label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
    margin-right: 15px;
}

.wpaf-confirmation-value {
    color: #6c757d;
    flex: 1;
}

.wpaf-confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.wpaf-submit-final {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.wpaf-submit-final:hover {
    background: #218838;
}

.wpaf-back-to-form {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.wpaf-back-to-form:hover {
    background: #545b62;
}

/* ========================================
   CONFIRM SCREEN - Match Form Input Style
   ======================================== */

/* Confirm Screen Container - Match .wpaf-form-container */
.wpaf-confirm-screen {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Confirm Message - Match .wpaf-form-description */
.wpaf-confirm-message {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    text-align: center;
}

/* Confirm Data Container */
.wpaf-confirm-data {
    margin-bottom: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

/* Confirm Field Row - Match .wpaf-form-row */
.wpaf-confirm-field {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease;
}

.wpaf-confirm-field:last-child {
    border-bottom: none;
}

.wpaf-confirm-field:hover {
    background-color: #f9fafb;
}

/* Confirm Label - Match .wpaf-form-label */
.wpaf-confirm-label {
    padding: 15px 20px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    vertical-align: top;
    width: 30%;
    min-width: 120px;
    background-color: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}

/* Confirm Value - Match .wpaf-form-field */
.wpaf-confirm-value {
    padding: 15px 20px;
    color: #374151;
    font-size: 16px;
    line-height: 1.5;
    vertical-align: top;
    flex: 1;
    word-break: break-word;
}

/* Confirm Form */
.wpaf-confirm-form {
    margin-top: 30px;
}

/* Confirm Buttons - Match form submit buttons */
.wpaf-confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Back Button - Match .wpaf-button-back */
.wpaf-button-back {
    background: #6b7280;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    min-width: 140px;
}

.wpaf-button-back:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wpaf-button-back:active {
    transform: translateY(0);
}

/* Submit Button - Match .wpaf-submit-button */
.wpaf-button-submit,
.wpaf-button.wpaf-button-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    min-width: 140px;
}

.wpaf-button-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wpaf-button-submit:active {
    transform: translateY(0);
}

.wpaf-button-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Description in Confirm Screen */
.wpaf-confirm-screen .wpaf-form-description {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
}

/* Responsive Design for Confirm Screen */
@media (max-width: 768px) {
    .wpaf-confirm-screen {
        margin: 10px;
        padding: 20px;
    }

    .wpaf-confirm-field {
        flex-direction: column;
    }

    .wpaf-confirm-label {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 10px 15px;
    }

    .wpaf-confirm-value {
        padding: 10px 15px;
    }

    .wpaf-confirm-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .wpaf-button-back,
    .wpaf-button-submit {
        width: 100%;
    }
}

/* Dark Mode Support for Confirm Screen */
@media (prefers-color-scheme: dark) {
    .wpaf-confirm-screen {
        background: #1f2937;
        color: #f9fafb;
        border: 1px solid #374151;
    }

    .wpaf-confirm-message {
        background-color: #1e3a5f;
        border-color: #2563eb;
        color: #bfdbfe;
    }

    .wpaf-confirm-data {
        border-color: #4b5563;
    }

    .wpaf-confirm-field {
        border-color: #4b5563;
    }

    .wpaf-confirm-field:hover {
        background-color: #374151;
    }

    .wpaf-confirm-label {
        background-color: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }

    .wpaf-confirm-value {
        color: #d1d5db;
    }

    .wpaf-confirm-buttons {
        border-color: #4b5563;
    }
}

/* High Contrast Mode for Confirm Screen */
@media (prefers-contrast: high) {
    .wpaf-confirm-screen {
        border: 2px solid #000;
    }

    .wpaf-confirm-label {
        border-color: #000;
    }

    .wpaf-button-back,
    .wpaf-button-submit {
        border: 2px solid #000;
    }
}

/* Reduced Motion for Confirm Screen */
@media (prefers-reduced-motion: reduce) {
    .wpaf-button-back,
    .wpaf-button-submit {
        transition: none;
    }

    .wpaf-button-back:hover,
    .wpaf-button-submit:hover {
        transform: none;
    }
}

/* reCAPTCHA center alignment */
.wpaf-field--recaptcha {
    text-align: center;
    margin: 20px 0;
}

.wpaf-field--recaptcha .wpaf-field__input {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.wpaf-field--recaptcha .wpaf-field__input > div:first-child {
    margin: 0 auto;
}

/* reCAPTCHA error message - display below widget */
.wpaf-field--recaptcha .wpaf-field__error {
    margin-top: 10px;
    margin-bottom: 0;
    width: 100%;
    text-align: center;
}

/* ========================================
   Confirmation Screen Specific Styles
   ======================================== */

/* Confirmation instruction message */
.wpaf-form-confirm .wpaf-confirm-instruction {
    margin: 10px 0 20px;
    padding: 15px;
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1976d2;
    font-weight: 500;
}

/* Confirmation table styles */
.wpaf-confirm-table .wpaf-form-label {
    background-color: #f5f5f5;
    font-weight: 600;
}

.wpaf-confirm-table .wpaf-confirm-value {
    background-color: #fff;
    padding: 15px;
    word-wrap: break-word;
}

.wpaf-empty-value {
    color: #999;
    font-style: italic;
}

.wpaf-file-name {
    display: inline-block;
    max-width: 100%;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 3px;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Japanese address field styling */
.wpaf-postal-code-display {
    font-family: monospace, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    letter-spacing: 0.05em;
}

.wpaf-prefecture-display,
.wpaf-city-display {
    font-size: 15px;
    color: #2c3e50;
}

.wpaf-confirm-row.wpaf-address-field .wpaf-form-label {
    color: #34495e;
    font-weight: 600;
}

/* Confirmation buttons container */
.wpaf-confirm-buttons {
    margin-top: 30px;
}

.wpaf-confirm-buttons .form_submit_btn_area {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Back button styles */
.wpaf-back-button {
    background-color: #757575;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.wpaf-back-button:hover {
    background-color: #616161;
}

/* Complete/Submit button styles */
.wpaf-complete-button {
    background-color: #4caf50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.wpaf-complete-button:hover {
    background-color: #45a049;
}

/* Loading state for all buttons - visual disabled style but still allows submission */
.wpaf-loading {
    opacity: 0.7;
    cursor: wait !important;
    position: relative;
    pointer-events: auto !important; /* Allow form submission */
}

.wpaf-loading:hover {
    transform: none !important;
    box-shadow: none !important;
}

.wpaf-loading:active {
    transform: none !important;
}

/* Specific loading styles for different button types */
.wpaf-button-back.wpaf-loading,
.wpaf-complete-button.wpaf-loading,
.wpaf-submit-button.wpaf-loading,
.wpaf-confirm-button.wpaf-loading {
    opacity: 0.7;
    cursor: wait !important;
    position: relative;
}

.wpaf-complete-button.wpaf-loading .wpaf-loading-spinner {
    display: inline-block !important;
}

/* Loading spinner animation */
@keyframes wpaf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive for confirmation screen */
@media (max-width: 768px) {
    .wpaf-confirm-buttons .form_submit_btn_area {
        flex-direction: column;
    }
    
    .wpaf-back-button,
    .wpaf-complete-button {
        width: 100%;
    }
}