/* =============================================================================
   WooCommerce 自訂註冊外掛 - 前端樣式
   ============================================================================= */

/* ---------- CSS 變數 ---------- */
.wcr-wrap {
    --wcr-primary:       #333333;
    --wcr-primary-dark:  #111111;
    --wcr-secondary:     #666666;
    --wcr-success:       #10b981;
    --wcr-danger:        #ef4444;
    --wcr-warning:       #f59e0b;
    --wcr-text:          #333333;
    --wcr-text-muted:    #666666;
    --wcr-border:        #e5e7eb;
    --wcr-bg:            #ffffff;
    --wcr-white:         #ffffff;
    --wcr-radius:        12px;
    --wcr-radius-sm:     12px;
    --wcr-shadow:        none;
    --wcr-shadow-lg:     none;
    --wcr-transition:    0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ---------- 外層包裹 ---------- */
.wcr-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    min-height: 60vh;
}

/* ---------- 卡片 ---------- */
.wcr-card {
    width: 100%;
    max-width: 480px;
    background: var(--wcr-white);
    border: 1px solid var(--wcr-border);
    border-radius: var(--wcr-radius);
    box-shadow: var(--wcr-shadow-lg);
    overflow: hidden;
}

/* ---------- 頁首 ---------- */
.wcr-header {
    background: #ffffff;
    padding: 32px 36px 24px;
    text-align: center;
    color: var(--wcr-text);
    border-bottom: 1px solid var(--wcr-border);
}

.wcr-title {
    margin: 0 0 6px !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--wcr-text) !important;
    letter-spacing: 0;
}

.wcr-subtitle {
    margin: 0 !important;
    font-size: 14px;
    color: var(--wcr-text-muted);
}

/* ---------- 全域提示 ---------- */
.wcr-alert {
    margin: 20px 28px 0;
    padding: 12px 16px;
    border-radius: var(--wcr-radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcr-alert.is-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.wcr-alert.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---------- 表單主體 ---------- */
.wcr-form {
    padding: 28px;
}

/* ---------- 分段 ---------- */
.wcr-section {
    margin-bottom: 24px;
}

.wcr-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wcr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
}

.wcr-step-badge {
    width: 20px;
    height: 20px;
    background: #f5f5f5;
    color: var(--wcr-text);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- 分隔線 ---------- */
.wcr-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 24px;
    color: var(--wcr-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.wcr-divider::before,
.wcr-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wcr-border);
}

/* ---------- 欄位 ---------- */
.wcr-field {
    margin-bottom: 16px;
}

.wcr-field:last-child {
    margin-bottom: 0;
}

.wcr-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--wcr-text);
    margin-bottom: 6px;
}

.wcr-label-hidden {
    visibility: hidden;
    pointer-events: none;
}

.wcr-hint {
    font-weight: 400;
    color: var(--wcr-text-muted);
    font-size: 12px;
}

.wcr-field-note {
    margin: 6px 0 0 28px;
    color: var(--wcr-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

/* ---------- 並排欄位 ---------- */
.wcr-field-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.wcr-field-grow {
    flex: 1;
}

.wcr-field-btn {
    flex-shrink: 0;
}

.wcr-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ---------- 輸入框 ---------- */
.wcr-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcr-input-icon {
    width: 18px;
    height: 18px;
    color: var(--wcr-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
}

.wcr-input-icon svg {
    width: 16px;
    height: 16px;
}

.wcr-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--wcr-border);
    border-radius: var(--wcr-radius-sm);
    font-size: 14px;
    color: var(--wcr-text);
    background: var(--wcr-white);
    transition: border-color var(--wcr-transition), box-shadow var(--wcr-transition);
    box-sizing: border-box;
    -webkit-appearance: none;
}

.wcr-input:focus {
    outline: none;
    border-color: var(--wcr-primary);
    box-shadow: 0 0 0 3px rgba(51,51,51,0.08);
}

.wcr-input.is-valid {
    border-color: var(--wcr-success);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

.wcr-input.is-invalid {
    border-color: var(--wcr-danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.wcr-input-otp {
    letter-spacing: 4px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    padding-left: 14px;
}

/* ---------- 密碼 Eye Icon ---------- */
.wcr-password-wrap .wcr-input {
    padding-right: 44px;
}

.wcr-eye-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 44px;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wcr-text-muted) !important;
    padding: 0;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    transition: none !important;
}

.wcr-eye-btn:hover,
.wcr-eye-btn:focus,
.wcr-eye-btn:active {
    background: transparent !important;
    border: none !important;
    color: var(--wcr-text-muted) !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
}

.wcr-eye-btn .eye-icon {
    width: 18px;
    height: 18px;
}

/* ---------- 密碼強度 ---------- */
.wcr-pw-strength {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.wcr-pw-strength.visible {
    display: flex;
}

.wcr-pw-bar {
    flex: 1;
    height: 4px;
    background: var(--wcr-border);
    border-radius: 99px;
    overflow: hidden;
}

.wcr-pw-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
}

.wcr-pw-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- 欄位回饋訊息 ---------- */
.wcr-field-feedback {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wcr-field-feedback.is-success { color: var(--wcr-success); }
.wcr-field-feedback.is-error   { color: var(--wcr-danger); }

/* ---------- 生日下拉選單 ---------- */
.wcr-birthday-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.wcr-select-wrap {
    position: relative;
}

.wcr-select-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--wcr-text-muted);
    pointer-events: none;
}

.wcr-select {
    width: 100%;
    height: 44px;
    padding: 0 32px 0 12px;
    border: 1.5px solid var(--wcr-border);
    border-radius: var(--wcr-radius-sm);
    font-size: 13px;
    color: var(--wcr-text);
    background: var(--wcr-white);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color var(--wcr-transition), box-shadow var(--wcr-transition);
    box-sizing: border-box;
}

.wcr-select:focus {
    outline: none;
    border-color: var(--wcr-primary);
    box-shadow: 0 0 0 3px rgba(51,51,51,0.08);
}

/* ---------- Checkbox ---------- */
.wcr-section-checks {
    background: var(--wcr-bg);
    border: 1px solid var(--wcr-border);
    border-radius: var(--wcr-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wcr-check-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.wcr-check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wcr-check-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--wcr-border);
    border-radius: 4px;
    background: var(--wcr-white);
    flex-shrink: 0;
    margin-top: 2px;
    transition: all var(--wcr-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.wcr-check:checked + .wcr-check-box {
    background: var(--wcr-primary);
    border-color: var(--wcr-primary);
}

.wcr-check:checked + .wcr-check-box::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
    display: block;
}

.wcr-check-text {
    font-size: 13px;
    color: var(--wcr-text-muted);
    line-height: 1.5;
}

.wcr-check-text a {
    color: var(--wcr-primary);
    text-decoration: none;
}

.wcr-check-text a:hover {
    text-decoration: underline;
}

.wcr-optional {
    font-style: italic;
    color: #9ca3af;
    font-size: 11px;
}

.wcr-required-mark {
    color: var(--wcr-danger);
    margin-left: 2px;
}

/* ---------- 按鈕 ---------- */
.wcr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: var(--wcr-radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--wcr-transition);
    white-space: nowrap;
}

/* 次要按鈕（發送驗證碼）*/
.wcr-btn-secondary {
    background: transparent;
    border: 1.5px solid var(--wcr-primary);
    color: var(--wcr-primary);
}

.wcr-btn-secondary:hover:not(:disabled) {
    background: var(--wcr-primary);
    color: #fff;
}

/* 主要按鈕（立即加入）*/
.wcr-btn-primary {
    width: 100%;
    height: 50px;
    background: var(--wcr-primary);
    color: #fff;
    font-size: 16px;
    margin-top: 20px;
    border-radius: var(--wcr-radius);
    box-shadow: none;
    transition: all 0.25s ease;
}

.wcr-btn-primary:hover:not(:disabled) {
    background: var(--wcr-primary-dark);
    transform: translateY(-1px);
    box-shadow: none;
}

.wcr-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* 禁用狀態 */
.wcr-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---------- 旋轉動畫 ---------- */
@keyframes wcr-spin {
    to { transform: rotate(360deg); }
}

.wcr-spin {
    width: 18px;
    height: 18px;
    animation: wcr-spin 0.8s linear infinite;
}

/* ---------- 登入連結 ---------- */
.wcr-login-link {
    text-align: center;
    margin: 16px 0 0;
    font-size: 13px;
    color: var(--wcr-text-muted);
}

.wcr-login-link a {
    color: var(--wcr-primary);
    text-decoration: none;
    font-weight: 600;
}

/* ---------- 已登入訊息 ---------- */
.wcr-logged-in {
    text-align: center;
    padding: 24px;
    color: var(--wcr-text-muted);
}

.wcr-logged-in a {
    color: var(--wcr-primary);
    font-weight: 600;
}

/* ---------- 成功動畫覆蓋層 ---------- */
.wcr-success-overlay {
    text-align: center;
    padding: 48px 28px;
}

.wcr-success-icon {
    width: 72px;
    height: 72px;
    background: #ecfdf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: wcr-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes wcr-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.wcr-success-icon svg {
    width: 36px;
    height: 36px;
    color: var(--wcr-success);
}

.wcr-success-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--wcr-text) !important;
    margin: 0 0 8px !important;
}

.wcr-success-msg {
    color: var(--wcr-text-muted);
    font-size: 14px;
    margin: 0;
}

/* ---------- RWD ---------- */
@media (max-width: 520px) {
    .wcr-wrap {
        padding: 0;
    }

    .wcr-header {
        padding: 28px 24px 22px;
    }

    .wcr-form {
        padding: 20px;
    }

    .wcr-field-row {
        flex-direction: column;
    }

    .wcr-name-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .wcr-field-btn {
        width: 100%;
    }

    .wcr-field-btn .wcr-btn {
        width: 100%;
    }

    .wcr-birthday-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .wcr-label-hidden {
        display: none;
    }
}
