.wr-form {
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    padding: 2rem;
    box-shadow: 0 12px 45px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.wr-form__header {
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.wr-form__title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

.wr-form__intro {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.wr-form__summary {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem 1.25rem;
}

.wr-form__summary li {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    background: #f8fafc;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.94rem;
}

.wr-form__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.wr-form__required-note {
    margin: 0;
    font-size: 0.92rem;
    color: #64748b;
}

.wr-required {
    color: #dc2626;
    font-weight: 700;
}

.wr-form__messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wr-notice {
    padding: 0.9rem 1rem;
    border-radius: 10px;
    font-size: 0.96rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid transparent;
}

.wr-notice--success {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #0f766e;
}

.wr-notice--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.wr-form__body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.wr-form__section {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.65) 0%, #ffffff 45%);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.wr-form__legend {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.wr-form__section-description {
    margin: -0.5rem 0 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
}

.wr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem 1.5rem;
}

.wr-grid-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .wr-grid-row {
        grid-template-columns: 1fr;
    }
}

.wr-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wr-field--full {
    grid-column: 1 / -1;
}

.wr-field--stack .wr-field__group {
    flex-wrap: wrap;
    align-items: stretch;
}

.wr-field__label {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.98rem;
}

.wr-field__group {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.wr-field__group--otp {
    margin-top: 0.5rem;
}

.wr-field input,
.wr-field select,
.wr-field textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #cbd5f5;
    font-size: 1rem;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    /* Enforce visual consistency across browsers */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    line-height: 1.5;
    /* Ensure text alignment consistency */
    box-sizing: border-box;
    /* Prevent padding from affecting width/height calculations */
}

/* Specific fix for date inputs in Safari/iOS which might have default rounded corners or shadows */
.wr-field input[type="date"],
.wr-field input[type="tel"],
.wr-field input[type="email"],
.wr-field input[type="text"] {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 8px;
    /* Force re-apply */
    min-height: 42px;
    /* Ensure uniform height with selects */
}

.wr-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    min-height: 42px;
    /* Match inputs */
}

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

.wr-help {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0.15rem 0 0;
    line-height: 1.5;
}

.wr-button {
    border: 1px solid #1d4ed8;
    color: #1d4ed8;
    background: #ffffff;
    padding: 0.55rem 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.95rem;
    font-weight: 600;
}

.wr-button--ghost {
    border-color: #2563eb;
    color: #2563eb;
    background: #f8fafc;
}

.wr-button--mini {
    border-color: #2563eb;
    color: #ffffff;
    background: #2563eb;
    padding: 0.45rem 0.85rem;
}

.wr-button--primary {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: #fff;
    border-color: #1d4ed8;
    font-size: 1.05rem;
    padding: 0.75rem 1.75rem;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.wr-button:hover {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.wr-form__footer {
    border-top: 1px solid #edf2f7;
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-end;
}

.wr-form__privacy {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
    text-align: left;
    width: 100%;
}

.wr-form__submit {
    align-self: flex-end;
}

.wr-line-login {
    margin-top: 1.25rem;
}

@media (max-width: 768px) {
    .wr-form {
        padding: 1.5rem;
        border-radius: 14px;
    }

    .wr-form__section {
        padding: 1.25rem;
    }
}

@media (max-width: 540px) {
    .wr-form {
        padding: 1.25rem;
    }

    .wr-form__summary {
        grid-template-columns: 1fr;
    }

    .wr-form__footer {
        align-items: stretch;
        text-align: left;
    }

    .wr-form__submit {
        width: 100%;
    }
}

/* ===== WooCommerce 帳戶編輯頁面 - 性別欄位 (Astra Modern 樣式) ===== */
/* 參考 Astra Addon 的 woo-modern-input.css */

/* 確保包含 wr 欄位的 form-row 容器使用相對定位 */
.woocommerce-account .form-row:has(#wr_gender) {
    position: relative;
}

/* 標籤樣式 - 使用 Astra modern 浮動標籤樣式 */
.woocommerce-account .form-row label[for="wr_gender"] {
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
    position: absolute;
    color: var(--ast-global-color-3, #3a3a3a);
    font-size: 0.7em;
    font-weight: inherit;
    margin-top: 0.35em;
    padding: 0 1.1em;
    line-height: 1.625;
    opacity: 0;
    height: auto;
    width: auto;
    clip-path: none;
    clip: unset;
    white-space: nowrap;
    overflow: hidden;
    max-width: 95%;
    text-overflow: ellipsis;
    z-index: 1;
    transition: all 0.2s ease-out;
}

/* 當 form-row 有 ast-animate-input 類時，標籤顯示 */
.woocommerce-account .form-row.ast-animate-input label[for="wr_gender"] {
    opacity: 1;
}

/* 選擇框（性別）基本樣式 */
.woocommerce-account select#wr_gender {
    border: 1px solid var(--ast-border-color, #eaeaea);
    border-radius: 4px;
    padding: 0.9em 2.5em 0.9em 0.8em;
    font-size: 1rem;
    line-height: 1;
    color: var(--ast-global-color-2, #3a3a3a);
    background-color: var(--ast-global-dark-bg-style, #fff);
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

/* 當 form-row 有 ast-animate-input 類時，select 使用不同 padding */
.woocommerce-account .form-row.ast-animate-input select#wr_gender {
    padding: 1.1em 2.5em 0.35em 0.7em;
}

/* ===== 出生年月日 select 下拉選單樣式 ===== */
.wr-birthdate-selects select.input-text {
    border: 1px solid var(--ast-border-color, #eaeaea);
    border-radius: 4px;
    padding: 0.9em 2em 0.9em 0.5em;
    font-size: 1rem;
    line-height: 1;
    color: var(--ast-global-color-2, #3a3a3a);
    background-color: var(--ast-global-dark-bg-style, #fff);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 0.9rem;
}

/* 生日 select 文字縮小 */
.wr-birthdate-selects select.input-text {
    font-size: 0.85rem;
}