/* WP Smart Form - Frontend Styles */

.wpsf-form-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
}

/* Step indicator */
.wpsf-steps {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 32px;
    position: relative;
}

.wpsf-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.wpsf-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    color: #666;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s;
}

.wpsf-step-active .wpsf-step-number {
    background: var(--wpsf-primary, #2563eb);
    color: #fff;
}

.wpsf-step-completed .wpsf-step-number {
    background: #10b981;
    color: #fff;
}

.wpsf-step-label {
    font-size: 13px;
    color: #666;
}

.wpsf-step-active .wpsf-step-label {
    color: var(--wpsf-primary, #2563eb);
    font-weight: 600;
}

/* Form fields */
.wpsf-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.wpsf-field {
    width: 100%;
    box-sizing: border-box;
}

/* モバイルでは幅指定をすべて 100% にリセット */
@media (max-width: 600px) {
    .wpsf-field {
        width: 100% !important;
    }
}

.wpsf-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.wpsf-required {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 600;
}

.wpsf-sub-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.wpsf-input,
.wpsf-select,
.wpsf-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--wpsf-radius, 4px);
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.wpsf-input:focus,
.wpsf-select:focus,
.wpsf-textarea:focus {
    outline: none;
    border-color: var(--wpsf-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wpsf-input.wpsf-valid {
    border-color: #10b981;
}

.wpsf-input.wpsf-invalid,
.wpsf-select.wpsf-invalid,
.wpsf-textarea.wpsf-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.wpsf-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Name split layout */
.wpsf-name-split {
    display: flex;
    gap: 12px;
}

.wpsf-name-field {
    flex: 1;
}

/* Address fields */
.wpsf-address-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpsf-zip-row {
    max-width: 200px;
}

.wpsf-zip-input {
    letter-spacing: 2px;
}

/* Radio & Checkbox */
.wpsf-radio-group,
.wpsf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpsf-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}

.wpsf-radio-label,
.wpsf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--wpsf-radius, 4px);
    cursor: pointer;
    transition: all 0.15s;
}

.wpsf-radio-label:hover,
.wpsf-checkbox-label:hover {
    background: #f8f9fa;
    border-color: var(--wpsf-primary, #2563eb);
}

.wpsf-radio-label input:checked + span,
.wpsf-checkbox-label input:checked + span {
    color: var(--wpsf-primary, #2563eb);
    font-weight: 500;
}

/* Consent */
.wpsf-consent-field {
    padding: 16px;
    background: #f8f9fa;
    border-radius: var(--wpsf-radius, 4px);
    border: 1px solid #e5e7eb;
}

.wpsf-consent-field a {
    color: var(--wpsf-primary, #2563eb);
}

/* File input */
.wpsf-file-input {
    width: 100%;
    padding: 8px;
    border: 2px dashed #d1d5db;
    border-radius: var(--wpsf-radius, 4px);
    background: #f9fafb;
}

.wpsf-file-help {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Heading & Paragraph */
.wpsf-heading {
    margin: 8px 0;
    color: #1f2937;
}

.wpsf-paragraph {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

.wpsf-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 16px 0;
}

/* Help text */
.wpsf-help-text {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Error message */
.wpsf-error-message {
    display: block;
    font-size: 13px;
    color: #dc3545;
    margin-top: 4px;
}

/* Email confirm */
.wpsf-email-confirm {
    margin-top: 8px;
}

/* Buttons */
.wpsf-form-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.wpsf-btn {
    display: inline-block;
    padding: 12px 40px;
    border: none;
    border-radius: var(--wpsf-radius, 4px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.wpsf-btn-submit,
.wpsf-btn-confirm {
    position: relative;
    background: var(--wpsf-btn-bg, #2563eb);
    color: var(--wpsf-btn-text, #fff);
}

.wpsf-btn-submit:hover,
.wpsf-btn-confirm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wpsf-btn-submit:disabled,
.wpsf-btn-confirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 必須項目カウント 吹き出し（ボタン上部） */
.wpsf-submit-hint {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 10;
}
.wpsf-submit-hint::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #f59e0b;
}
.wpsf-submit-hint::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -1px;
    border: 5px solid transparent;
    border-top-color: #fef3c7;
    z-index: 1;
}

/* ボタンスタイルパターン */
[data-btn-style="outline"] .wpsf-btn-confirm,
[data-btn-style="outline"] .wpsf-btn-submit {
    background: transparent;
    border: 2px solid var(--wpsf-btn-bg, #2563eb);
    color: var(--wpsf-btn-bg, #2563eb);
}
[data-btn-style="outline"] .wpsf-btn-confirm:hover,
[data-btn-style="outline"] .wpsf-btn-submit:hover {
    background: var(--wpsf-btn-bg, #2563eb);
    color: var(--wpsf-btn-text, #fff);
}

[data-btn-style="rounded"] .wpsf-btn-confirm,
[data-btn-style="rounded"] .wpsf-btn-submit {
    border-radius: 999px;
}

[data-btn-style="outline-rounded"] .wpsf-btn-confirm,
[data-btn-style="outline-rounded"] .wpsf-btn-submit {
    border-radius: 999px;
    background: transparent;
    border: 2px solid var(--wpsf-btn-bg, #2563eb);
    color: var(--wpsf-btn-bg, #2563eb);
}
[data-btn-style="outline-rounded"] .wpsf-btn-confirm:hover,
[data-btn-style="outline-rounded"] .wpsf-btn-submit:hover {
    background: var(--wpsf-btn-bg, #2563eb);
    color: var(--wpsf-btn-text, #fff);
}

[data-btn-style="gradient"] .wpsf-btn-confirm,
[data-btn-style="gradient"] .wpsf-btn-submit {
    background: linear-gradient(90deg, var(--wpsf-btn-bg, #2563eb), var(--wpsf-btn-grad, #7c3aed));
}

[data-btn-style="arrow"] .wpsf-btn-confirm::after,
[data-btn-style="arrow"] .wpsf-btn-submit::after {
    content: ' →';
}

.wpsf-btn-back {
    background: #e5e7eb;
    color: #374151;
}

.wpsf-btn-back:hover {
    background: #d1d5db;
}

/* Loading */
.wpsf-form-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.wpsf-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--wpsf-primary, #2563eb);
    border-radius: 50%;
    animation: wpsf-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes wpsf-spin {
    to { transform: rotate(360deg); }
}

/* Completion (inline) */
.wpsf-completion-page {
    text-align: center;
    padding: 40px 20px;
}

.wpsf-completion-icon {
    font-size: 48px;
    color: #10b981;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    background: #d1fae5;
    margin: 0 auto 20px;
    display: block;
}

.wpsf-completion-page h3 {
    margin-bottom: 12px;
    font-size: 20px;
}

.wpsf-completion-page p {
    color: #6b7280;
    font-size: 15px;
}

/* Completion (外部ページ注入: ?wpsf_done=ID) */
.wpsf-completion-wrap {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.wpsf-completion-wrap .wpsf-completion-icon {
    font-size: 36px;
    color: #10b981;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    background: #d1fae5;
    margin: 0 auto 20px;
    display: block;
}

.wpsf-completion-wrap .wpsf-completion-title {
    margin-bottom: 12px;
    font-size: 22px;
    color: #111827;
}

.wpsf-completion-wrap .wpsf-completion-message {
    color: #6b7280;
    font-size: 15px;
    line-height: 1.7;
}

/* Confirmation page */
.wpsf-confirmation-page {
    padding: 20px 0;
}

.wpsf-confirmation-data {
    margin-bottom: 24px;
}

.wpsf-confirmation-data table {
    width: 100%;
    border-collapse: collapse;
}

.wpsf-confirmation-data th,
.wpsf-confirmation-data td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}

.wpsf-confirmation-data th {
    width: 30%;
    background: #f9fafb;
    font-weight: 500;
}

/* EFO - Progress bar */
.wpsf-efo-progress {
    margin-bottom: 20px;
}

.wpsf-efo-progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.wpsf-efo-progress-fill {
    height: 100%;
    background: var(--wpsf-primary, #2563eb);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

.wpsf-efo-progress-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    text-align: right;
}

/* EFO - Field status icons */
.wpsf-field-status {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.wpsf-field-status-ok::after { content: '✓'; color: #10b981; }
.wpsf-field-status-error::after { content: '!'; color: #dc3545; }

/* Responsive */
@media (max-width: 768px) {
    .wpsf-form-wrapper {
        padding: 16px;
    }

    .wpsf-name-split {
        flex-direction: column;
    }

    .wpsf-btn {
        width: 100%;
        padding: 14px 24px;
    }

    .wpsf-form-actions {
        flex-direction: column;
    }
}

/* reCAPTCHA container */
.wpsf-recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}
