/*=============================================
=            1. 基礎設置            =
=============================================*/

/* 英文字體 */
@font-face {
    font-family: 'Dual-Language';
    src: local('Poppins');
    unicode-range: U+0000-007F, U+0080-00FF, U+0100-017F;
    /* 英文字符範圍 */
}

/* 中文字體 */
@font-face {
    font-family: 'Dual-Language';
    src: local('Noto Sans TC');
    unicode-range: U+4E00-9FFF;
    /* 中文字符範圍 */
}

/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Dual-Language', 'Poppins', 'Noto Sans TC';
}

/*=============================================
=            2. 頁面布局            =
=============================================*/

/* 頁面背景與置中設定 */
body {
    background: linear-gradient(135deg, #d4f4e2 0%, #c8e9ff 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

/* 主容器樣式 */
.container {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    transition: transform 0.3s ease;
    position: relative;
}

/* Logo 相關樣式 */
.logo-container {
    margin-bottom: 1rem;
}

.logo {
    width: 80px;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/*=============================================
=            3. 表單相關            =
=============================================*/

/* 表單容器顯示控制 */
.form-container {
    display: none;
}

.form-container.active {
    display: block;
}

/* 標題區域樣式 */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

/* 輸入框群組樣式 */
.input-group {
    position: relative;
    margin-bottom: 3rem;
}

.input-group input {
    width: 100%;
    padding: 10px 10px;
    font-size: 16px;
    color: #333;
    border: none;
    border-bottom: 1px solid #ddd;
    outline: none;
    background: transparent;
    transition: all 0.3s ease;
    padding-right: 60px;
}

.input-group label {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #666;
    pointer-events: none;
    transition: all 0.3s ease;
    padding: 10px 10px;
}

.input-note {
    position: absolute;
    left: 0;
    bottom: -35px;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-note i {
    color: #80BEE7;
}

.input-group input:focus~label,
.input-group input:valid~label,
.input-group.filled label {
    top: -20px;
    font-size: 14px;
    color: #4a90e2;
}

.input-group input:focus {
    border-bottom: 2px solid #4a90e2;
}

.phone-input-group {
    margin-bottom: 4rem;
    /* 只增加電話號碼輸入框的底部間距 */
}

/* 輸入框內圖示定位 */
.input-group .fa-lock,
.input-group .fa-user,
.input-group .fa-phone {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

/* 密碼顯示切換按鈕 */
.password-toggle {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 2;
    color: #666;
}

/* 檢查按鈕 */
.check-username-btn,
.check-phone-btn {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.check-username-btn:hover {
    color: #4CAF50;
}

.check-username-btn.checking {
    animation: rotate 1s linear infinite;
}

/* 驗證狀態 */
.username-status,
.phone-status {
    position: absolute;
    left: 0;
    bottom: -20px;
    font-size: 12px;
    width: 100%;
    text-align: left;
}

.username-status.error,
.phone-status.error {
    color: #f44336;
}

.username-status.success,
.phone-status .success {
    color: #4CAF50;
}

/* 錯誤與成功訊息樣式 */
.error-message {
    color: #d63031;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

.success-message {
    color: #00b894;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* 密碼提示文字 */
.password-hint {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/*=============================================
=            4. 按鈕樣式            =
=============================================*/

/* 按鈕容器 */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* 基本按鈕樣式 */
.btn {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 主要按鈕樣式 */
.primary-btn {
    background: linear-gradient(135deg, #00a8ff 0%, #0097e6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.3);
}

/* 次要按鈕樣式 */
.secondary-btn {
    background: white;
    border: 2px solid #00a8ff;
    color: #00a8ff;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.1);
}

/* 按鈕懸浮效果 */
.btn:hover {
    transform: translateY(-2px);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #0097e6 0%, #0086d1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 168, 255, 0.4);
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #00a8ff 0%, #0097e6 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 168, 255, 0.2);
}

/* 按鈕點擊效果 */
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 168, 255, 0.2);
}

/* 語言切換按鈕 */
.language-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.language-btn {
    background: transparent;
    border: 2px solid #00a8ff;
    color: #00a8ff;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.language-btn:hover {
    background: #00a8ff;
    color: white;
}

/* 功能提示按鈕 */
.features-hint {
    margin-top: 10px;
    text-align: center;
}

.features-btn {
    background: transparent;
    border: 1px solid #00a8ff;
    color: #00a8ff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.features-btn:hover {
    background: rgba(0, 168, 255, 0.1);
    transform: translateY(-1px);
}

.features-btn:active {
    transform: translateY(1px);
}

.features-btn i {
    font-size: 16px;
    color: #00a8ff;
    transition: all 0.3s ease;
}

.features-btn:hover i {
    transform: rotate(15deg);
}

.features-text {
    font-weight: 500;
}

/*=============================================
=            5. Modal 樣式            =
=============================================*/

/* 功能介紹 Modal */
.features-modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    animation: featuresFadeIn 0.3s ease;
}

.features-modal-content {
    background-color: #ffffff;
    width: 90%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(0);
    animation: featuresSlideIn 0.3s ease;
}

.features-modal-header {
    background: linear-gradient(135deg, #80BEE7, #99CBEA);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.features-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.features-modal-close {
    color: white;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.features-modal-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.features-modal-body {
    padding: 20px;
}

/* 功能項目樣式 */
.features-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid rgba(128, 190, 231, 0.2);
    transition: all 0.3s ease;
}

.features-item:last-child {
    border-bottom: none;
}

.features-item:hover {
    background-color: rgba(128, 190, 231, 0.05);
    transform: translateX(5px);
}

.features-icon {
    color: #80BEE7;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(128, 190, 231, 0.1);
    border-radius: 10px;
    margin-right: 15px;
    flex-shrink: 0;
}

.features-content {
    flex: 1;
}

.features-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: #2C3E50;
}

.features-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/*=============================================
=            6. 條款和複選框            =
=============================================*/

/* 免責聲明樣式 */
.disclaimer {
    margin-top: 1.5rem;
    text-align: center;
    padding: 0 1rem;
}

.disclaimer-text {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    display: block;
}

/* 條款 Modal */
.terms-modal {
    display: flex;
    /* 改為 flex 布局 */
    align-items: center;
    /* 垂直居中 */
    justify-content: center;
    /* 水平居中 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    /* 防止背景滾動 */
}

.terms-modal-content {
    background-color: #fefefe;
    margin: 20px;
    /* 改用固定邊距 */
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    /* 設置最大高度為視窗高度的 80% */
    border-radius: 8px;
    display: flex;
    /* 使用 flex 布局 */
    flex-direction: column;
    /* 垂直排列 */
    overflow: hidden;
    /* 隱藏溢出部分 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.terms-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    /* 使用 padding 代替 margin */
    background: #f8f9fa;
    /* 添加背景色 */
    border-bottom: 1px solid #eee;
}

.terms-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.terms-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
}

.terms-modal-close:hover {
    color: #333;
}

.terms-modal-body {
    padding: 20px;
    overflow-y: auto;
    /* 添加垂直滾動 */
    flex: 1;
    /* 讓內容區域自動佔據剩餘空間 */
}

.terms-modal-body pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.6;
    color: #666;
    margin: 0;
    /* 移除預設邊距 */
}

/* 自定義滾動條樣式 */
.terms-modal-body::-webkit-scrollbar {
    width: 8px;
}

.terms-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.terms-modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.terms-modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 條款複選框樣式 */
.terms-group {
    margin: 15px 0;
}

.checkbox-group {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.checkbox-group input[type="checkbox"] {
    opacity: 0;
    position: absolute;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #666;
    border-radius: 3px;
    display: inline-block;
    position: relative;
    margin-right: 10px;
    flex-shrink: 0;
}

.checkbox-group input[type="checkbox"]:checked+label .checkbox-custom::after {
    content: '\2714';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4CAF50;
}

.terms-text {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.terms-text a {
    color: #4CAF50;
    text-decoration: none;
}

.terms-text a:hover {
    text-decoration: underline;
}

/*=============================================
=            7. 更新通知              =
=============================================*/

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.system-updates-modal {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.updates-list {
    margin: 15px 0;
}

.update-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}

.update-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.update-type {
    font-size: 20px;
}

.update-title {
    font-weight: 600;
    flex-grow: 1;
}

.update-date {
    color: #666;
    font-size: 0.9em;
}

.update-content {
    color: #333;
    white-space: pre-wrap;
}

/*=============================================
=            8. 響應式設計            =
=============================================*/

/* 平板尺寸 */
@media (max-width: 768px) {
    .features-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .features-btn i {
        font-size: 14px;
    }

    .features-modal-content {
        width: 95%;
        margin: 10px;
    }

    .features-modal-header {
        padding: 15px;
    }

    .features-modal-header h2 {
        font-size: 1.1rem;
    }

    .features-modal-body {
        padding: 15px;
    }

    .features-item {
        padding: 12px;
    }

    .features-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .features-content h3 {
        font-size: 1rem;
    }

    .features-content p {
        font-size: 0.85rem;
    }

    .terms-modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 15px;
    }

    .terms-modal-header {
        padding: 15px;
    }

    .terms-modal-body {
        padding: 15px;
    }
}

/* 手機尺寸 */
@media (max-width: 480px) {
    .logo {
        width: 60px;
    }

    .logo-container {
        margin-bottom: 0.5rem;
    }

    .container {
        padding: 1.5rem;
    }

    .header h2 {
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
        gap: 0.8rem;
    }

    .btn {
        width: 100%;
        padding: 0.7rem;
        font-size: 0.85rem;
    }

    .input-group .fa-lock,
    .input-group .fa-user,
    .input-group .fa-phone {
        right: 2%;
    }

    .password-toggle {
        right: 30px;
    }

    .check-username-btn,
    .check-phone-btn {
        right: 10%;
    }

    .input-group input {
        padding-right: 60px;
    }

    .terms-modal-content {
        width: 98%;
        max-height: 90vh;
        margin: 10px;
    }

    .terms-modal-header h2 {
        font-size: 1.1rem;
    }
}

/* 小型手機尺寸 */
@media (max-width: 320px) {
    .logo {
        width: 100px;
    }

    .logo-container {
        margin-bottom: 1rem;
    }
}

/*=============================================
=            8. 動畫效果            =
=============================================*/

/* Modal 淡入動畫 */
@keyframes featuresFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal 滑入動畫 */
@keyframes featuresSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 旋轉動畫 */
@keyframes rotate {
    from {
        transform: translateY(-50%) rotate(0deg);
    }

    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* 加載動畫 */
@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

.checking .fa-check {
    animation: spinner 1s linear infinite;
}