/* ===== 基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ===== 註冊容器 ===== */
.register-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
    background: white;
}

/* ===== 註冊內容區域 ===== */
.register-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.register-form-container {
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

.register-form-container::-webkit-scrollbar {
    width: 8px;
}

.register-form-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.register-form-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.register-form-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 30px;
    transition: all 0.3s;
}

.back-link:hover {
    color: var(--primary-color);
    gap: 12px;
}

.back-link i {
    font-size: 16px;
}

.form-wrapper {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.form-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.form-subtitle {
    font-size: 15px;
    color: #666;
    margin-bottom: 35px;
}

/* ===== 表單樣式 ===== */
.form-group {
    margin-bottom: 25px;
    overflow: visible; /* 確保日期選擇器彈窗不會被裁剪 */
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.form-label i {
    color: var(--primary-color);
    font-size: 16px;
}

.required {
    color: #f44336;
}

.optional {
    color: #999;
    font-weight: 400;
    font-size: 13px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: #fafafa;
    box-sizing: border-box; /* 確保 padding 不會撐破容器 */
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder {
    color: #aaa;
}

.form-input.error {
    border-color: #f44336;
    background: #fff5f5;
}

.error-message {
    display: block;
    color: #f44336;
    font-size: 13px;
    margin-top: 6px;
}

.form-hint {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

/* 密碼輸入框 */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
    padding: 5px;
}

.toggle-password:hover {
    color: var(--primary-color);
}

/* 密碼強度指示器 */
.password-strength {
    margin-top: 10px;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    width: 0;
    background: #e0e0e0;
    transition: all 0.3s;
    border-radius: 3px;
}

.strength-text {
    font-size: 12px;
    color: #999;
    font-weight: 600;
}

/* 性別選項 */
.gender-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.radio-text {
    color: #666;
    font-size: 14px;
}

/* 核取方塊樣式 */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-text {
    color: #666;
    font-size: 14px;
}

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

.checkbox-text a:hover {
    text-decoration: underline;
}

/* 提交按鈕 */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: var(--shadow-primary);
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-lg);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-submit.loading {
    pointer-events: none;
}

/* 分隔線 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 30px 0;
    color: #999;
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}

.divider span {
    padding: 0 15px;
}

/* 社群註冊 */
.social-register {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn {
    color: #db4437;
}

.google-btn:hover {
    border-color: #db4437;
    background: #fff8f7;
}

.facebook-btn {
    color: #1877f2;
}

.facebook-btn:hover {
    border-color: #1877f2;
    background: #f0f7ff;
}

.social-btn i {
    font-size: 18px;
}

/* 登入區塊 */
.login-section {
    text-align: center;
    font-size: 14px;
    color: #666;
}

.login-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    transition: color 0.3s;
}

.login-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== 動畫效果 ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 響應式設計 ===== */
@media (max-width: 1024px) {
    .register-container {
        padding: 30px 15px;
    }

    .register-content {
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    .register-container {
        padding: 20px 15px;
    }

    .register-content {
        max-width: 100%;
    }

    .form-wrapper {
        padding: 30px 20px;
        border-radius: 12px;
    }

    .form-title {
        font-size: 26px;
    }

    .social-register {
        grid-template-columns: 1fr;
    }

    .gender-options {
        flex-direction: column;
        gap: 12px;
    }
    
    .step-indicators {
        gap: 5px;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .step-label {
        font-size: 11px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-prev,
    .btn-next,
    .btn-submit {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .register-container {
        padding: 15px 10px;
    }

    .form-wrapper {
        padding: 25px 15px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    .form-title {
        font-size: 24px;
    }

    .form-subtitle {
        font-size: 14px;
    }

    .form-input {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    /* ⭐ 手机版日期输入框额外优化 */
    .form-input[type="date"] {
        font-size: 16px; /* iOS防自动缩放 */
        min-height: 46px;
        padding-right: 45px; /* 為日曆圖標留出空間 */
    }

    .btn-submit {
        padding: 14px;
        font-size: 15px;
    }

    .form-group {
        margin-bottom: 20px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .step-label {
        font-size: 10px;
    }
}

/* ===== 載入動畫 ===== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 日期輸入樣式 ===== */
/* ⭐ 修复日期输入框在手机版的显示问题 */
.form-input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 50px; /* 確保高度足夠 */
    display: block;
}

/* 修复日期输入框内部控件 */
.form-input[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
    opacity: 0;
}

/* 显示自定义图标 */
.form-input[type="date"] {
    position: relative;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px 20px;
    padding-right: 45px; /* 為圖標留出空間 */
}

/* 移动端日期输入框防止缩放 */
@media (max-width: 768px) {
    .form-input[type="date"] {
        font-size: 16px; /* iOS Safari 防止自动缩放（最小16px）*/
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* 确保日期输入框的值显示正常 */
.form-input[type="date"]::-webkit-datetime-edit {
    padding: 0;
    display: inline-block;
}

.form-input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.form-input[type="date"]::-webkit-datetime-edit-text,
.form-input[type="date"]::-webkit-datetime-edit-month-field,
.form-input[type="date"]::-webkit-datetime-edit-day-field,
.form-input[type="date"]::-webkit-datetime-edit-year-field {
    padding: 0 2px;
}

/* 兼容舊瀏覽器 */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    font-size: 16px;
}

/* ===== 焦點狀態設計 ===== */
.form-input:focus-visible,
.btn-submit:focus-visible,
.social-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== 列印樣式 ===== */
@media print {

    .social-register,
    .back-link {
        display: none;
    }

    .register-container {
        background: white;
        padding: 0;
    }

    .form-wrapper {
        box-shadow: none;
    }
}

/* ===== 輸入框自動填入樣式 ===== */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fafafa inset;
    -webkit-text-fill-color: #333;
    transition: background-color 5000s ease-in-out 0s;
}

/* Alert styles */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}

.alert-danger {
    background: #fff5f5;
    color: #f44336;
    border: 1px solid #ffcdd2;
}

.alert i {
    font-size: 18px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ===== 進度指示器 ===== */
.progress-container {
    margin-bottom: 40px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 30px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    transition: width 0.4s ease;
    border-radius: 3px;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.step-label {
    font-size: 12px;
    color: #999;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s;
}

.step.active .step-number {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-primary);
    transform: scale(1.1);
}

.step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.step.completed .step-number {
    background: var(--primary-light);
    color: white;
}

.step.completed .step-label {
    color: var(--primary-light);
}

.step:hover:not(.active) .step-number {
    transform: scale(1.05);
}

/* ===== 分段內容 ===== */
.step-content {
    animation: fadeInRight 0.3s ease;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== 按鈕群組 ===== */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-prev,
.btn-next {
    flex: 1;
    padding: 14px 24px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    background: white;
    color: var(--primary-color);
}

.btn-prev:hover,
.btn-next:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.btn-prev:active,
.btn-next:active {
    transform: translateY(0);
}

.btn-next {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: var(--shadow-primary);
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-lg);
}

/* ===== 驗證碼輸入區域 ===== */
.input-with-verify {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.country-code-select {
    width: 90px;
    flex-shrink: 0;
}

.input-flex {
    flex: 1;
    min-width: 0;
}

.verify-code-row {
    width: 100%;
    margin-top: 10px;
}

.verify-code-field {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    transition: all 0.3s;
    overflow: hidden;
    box-sizing: border-box;
}

.verify-code-field:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow-focus);
}

.verify-code-input-inner {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 14px 18px;
    font-size: 15px;
    box-sizing: border-box;
}

.verify-code-input-inner::placeholder {
    color: #aaa;
}

.verify-send-link {
    flex-shrink: 0;
    background: none;
    border: none;
    border-left: 1px solid #e0e0e0;
    padding: 14px 16px;
    margin: 0;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.verify-send-link:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.02);
}

.verify-send-link:disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

.verify-status-icon {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.verify-status-icon:empty {
    display: none;
    width: 0;
    margin: 0;
    padding: 0;
}

.verify-status-icon.success {
    color: var(--primary-color);
}

.verify-status-icon.error {
    color: #f44336;
}

/* ⭐ 手機號碼提示區域樣式 */
.phone-input-tip {
    margin-top: 8px;
    padding: 10px 12px;
    background-color: #e3f2fd;
    border-left: 3px solid #2196F3;
    border-radius: 4px;
    font-size: 13px;
    color: #1976D2;
    line-height: 1.5;
}

.phone-input-tip i {
    margin-right: 6px;
}

/* 響應式設計 - 驗證碼區域 */
@media (max-width: 768px) {
    .verify-code-row {
        flex-wrap: nowrap;
    }
}

@media (max-width: 480px) {
    .input-with-verify {
        flex-direction: column;
    }
    
    .country-code-select {
        width: 100%;
    }
    
    .verify-code-row {
        gap: 0;
    }
    
    .verify-code-field {
        width: 100%;
    }

    .verify-code-input-inner {
        width: 100%;
    }
}

.btn-submit {
    flex: 1;
}

/* ===== 密碼提示 ===== */
.password-requirements {
    font-size: 12px;
    color: #666;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-top: 8px;
}

    .password-requirements ul {
        margin: 0;
        padding-left: 20px;
    }

    .password-requirements li {
        margin: 4px 0;
    }