/* 基礎 CSS 設定 */
html, body { height: 100%; margin: 0; padding: 0; }
body {
    font-family: Arial, sans-serif;
    background: url('../back.png') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 5vh 0;
    box-sizing: border-box;
}
.container {
    width: 100%; max-width: 380px; background: rgba(255,255,255,0.95);
    padding: 25px; border-radius: 10px; box-shadow: 0 0 15px rgba(0,0,0,0.1);
    text-align: center; max-height: 95vh; overflow-y: auto;
}
img { width: 200px; margin-bottom: 15px; }
input, button {
    text-align: center; box-sizing: border-box; width: 100%;
    padding: 12px; border-radius: 5px; border: 1px solid #ccc;
    margin: 8px 0;
}
button {
    border: none; font-size: 16px; cursor: pointer;
    transition: background-color 0.2s, transform 0.1s ease;
}
.password-input-field { padding-right: 45px !important; }
.password-wrapper { margin-top: 8px; }
.password-container {
    position: relative; display: flex; align-items: center;
}
.password-container input { margin: 0; }
.toggle-password {
    position: absolute; right: 15px; top: 50%;
    transform: translateY(-50%);
    cursor: pointer; user-select: none;
}
button:hover { opacity: 0.9; }
button:active { transform: scale(0.98); }
#submitButton { background: #007bff; color: white; margin-top: 10px; }
#submitButton:disabled, button.mode-button:disabled, #sendOtpButton:disabled { 
    background: #ccc; 
    cursor: not-allowed; 
}

/* 讀取動畫 */
#loadingOverlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.85); z-index: 9999;
    flex-direction: column; align-items: center; justify-content: center;
    font-size: 18px; color: #333;
}
.spinner {
    width: 40px; height: 40px; border: 4px solid #ccc; border-top: 4px solid #007bff;
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 提示訊息 (修正版) */
.error-message {
    display: none;
    height: auto;
    color: #d9534f;
    font-size: 12px; text-align: left;
    margin-top: 3px;
    margin-bottom: 5px;
}
#resultMessage {
    padding: 10px; margin-top: 10px; border-radius: 5px;
    display: none; text-align: center; word-wrap: break-word;
}
.result-success { background-color: #dff0d8; color: #3c763d; border: 1px solid #d6e9c6; }
.result-error { background-color: #f2dede; color: #a94442; border: 1px solid #ebccd1; }

/* Turnstile 置中 */
#turnstile-widget {
    display: flex; justify-content: center; margin: 15px 0;
}

/* RWD 特定樣式 */
body.rwd-page { padding: 0; }
body.rwd-page .container {
    max-height: 100%; height: 100%; border-radius: 0;
    box-shadow: none; padding: 20px 15px;
}

/* 成功提示 Modal 樣式 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; justify-content: center; align-items: center;
    z-index: 10000; opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.visible { display: flex; opacity: 1; }
.modal-content {
    background: white; padding: 20px 30px; border-radius: 10px;
    text-align: center; width: 90%; max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
#modalCloseButton {
    background-color: #007bff; color: white; margin-top: 15px;
}
.modal-reminder { font-size: 14px; color: #6c757d; margin-top: 15px; }

/* password-service.html 新增樣式 */
hr { border: 0; height: 1px; background: #eee; margin: 20px 0; }
#mode-selection-container { display: flex; gap: 10px; margin-bottom: 15px; }
.mode-button {
    flex: 1; background-color: #6c757d; color: white;
    padding: 10px; border-radius: 5px; margin-top: 0;
}
.mode-button:hover { background-color: #5a6268; }
.mode-button.active { background-color: #007bff; font-weight: bold; }
.otp-container {
    display: flex; gap: 10px; align-items: center;
    justify-content: center;
}
#otpCode { flex-grow: 1; }
#sendOtpButton {
    flex-shrink: 0; width: auto; padding: 12px 15px;
    background-color: #28a745; color: white;
}
.result-message-inline {
    display: none;
    height: auto;
    font-size: 12px;
    text-align: center;
    margin: 8px 0 -5px 0;
}
.result-message-inline.success { color: #3c763d; }
.result-message-inline.error { color: #a94442; }