/* --- 健身打卡应用样式 v3.9.1 (修复弹窗文字白屏Bug) --- */

#fitness-app-container {
    max-width: 600px; margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border: 1px solid #eef0f2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
    overflow: visible !important;
    position: relative;
}

/* --- Tab 导航栏 --- */
.fitness-tabs {
    display: flex; background: #fff; padding: 0 10px;
    border-bottom: 1px solid #f0f0f0; border-radius: 16px 16px 0 0;
}
.fitness-tab-item {
    flex: 1; text-align: center; padding: 16px 0;
    font-size: 0.95em; font-weight: 600; color: #9aa5b1;
    cursor: pointer; position: relative; transition: all 0.3s ease;
}
.fitness-tab-item:hover { color: #555; }
.fitness-tab-item.active { color: #2d3748; }
.fitness-tab-item.active::after {
    content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; background-color: #007bff; border-radius: 3px;
}

/* --- 内容区域 --- */
.fitness-tab-content { display: none; padding: 20px; animation: fadeIn 0.4s ease; }
.fitness-tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 表单区域 --- */
#fitness-checkin-form { margin-bottom: 0; }
#fitness-checkin-form h3 { display: none; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 0.9em; color: #4a5568; }

/* --- 姓名按钮布局 --- */
.name-btn-wrapper { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-container { 
    position: relative; flex: 1 1 100px; min-width: 0; 
}
@media (max-width: 600px) {
    .btn-container { flex: 0 0 calc(50% - 5px); max-width: calc(50% - 5px); }
}

.name-btn {
    width: 100%; padding: 12px 5px; font-size: 0.95em; font-weight: 500;
    border-radius: 10px; border: 1px solid #e2e8f0; background-color: #fff;
    color: #4a5568; cursor: pointer; transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center; position: relative; overflow: hidden;
    box-sizing: border-box; white-space: nowrap; text-overflow: ellipsis;
}
.name-btn:hover { border-color: #cbd5e0; transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.name-btn.selected { font-weight: 700; background-color: #fff; border-width: 2px; transform: translateY(-1px); }

/* --- 统计气泡 --- */
.stats-popover {
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%) translateY(10px);
    width: 140px; background: rgba(30, 30, 30, 0.95); color: #fff;
    padding: 10px; border-radius: 8px;
    font-size: 0.8em; line-height: 1.5; text-align: center;
    z-index: 9999; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.stats-popover::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: rgba(30, 30, 30, 0.95) transparent transparent transparent;
}
.stats-popover.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.popover-quote { color: #ffd700; font-weight: 700; margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 5px; display: block; }
.spinner { display: inline-block; width: 10px; height: 10px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 5px;}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 上传控件 --- */
.form-group input[type="file"]#fitness-photo { display: none; }
.custom-file-upload-label {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 15px; border-radius: 10px;
    border: 1px dashed #cbd5e0; background-color: #fafbfb; color: #4a5568;
    font-weight: 500; cursor: pointer; transition: 0.2s; box-sizing: border-box; font-size: 0.9em;
}
.custom-file-upload-label:hover { background-color: #f0f7ff; border-color: #4299e1; color: #2b6cb0; }
#file-chosen-name { display: block; margin-top: 5px; font-size: 0.8em; color: #a0aec0; text-align: center; }

/* --- 提交按钮 --- */
#fitness-submit-btn {
    width: 100%; padding: 14px; font-size: 1em; font-weight: 700;
    border: none; border-radius: 10px; background: linear-gradient(135deg, #007bff 0%, #0062cc 100%);
    color: white; cursor: pointer; transition: all 0.3s ease; margin-top: 5px;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.25); box-sizing: border-box;
}
#fitness-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0, 123, 255, 0.35); }
#fitness-submit-btn:disabled { background: #cbd5e0; transform: none; box-shadow: none; cursor: not-allowed; }

/* --- 消息提示 --- */
#fitness-message { padding: 12px; margin-top: 15px; border-radius: 8px; text-align: center; font-weight: 600; display: none; box-sizing: border-box; font-size: 0.9em; }
#fitness-message.loading { background-color: #ebf8ff; color: #2b6cb0; }
#fitness-message.success { background-color: #f0fff4; color: #2f855a; }
#fitness-message.error { background-color: #fff5f5; color: #c53030; }

/* --- 日历区域 --- */
#fitness-calendar-wrapper { padding: 0; }
#calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 5px; }
#calendar-header h4 { margin: 0; font-size: 1.1em; font-weight: 700; color: #2d3748; }
.calendar-nav-btn { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #718096; font-weight: bold; font-size: 0.8em; transition: all 0.2s ease; }
.calendar-nav-btn:hover { background: #f7fafc; color: #2d3748; }
#calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-cell.header { background: transparent; font-weight: 600; text-align: center; padding-bottom: 5px; color: #a0aec0; font-size: 0.75em; }
.calendar-cell { min-height: 55px; background: #fff; border: 1px solid #edf2f7; border-radius: 8px; padding: 4px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; transition: all 0.2s ease; }
.calendar-cell.other-month { background: #fcfcfc; border-color: transparent; opacity: 0.5; }
.calendar-cell .day-number { font-size: 0.85em; font-weight: 600; color: #718096; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.calendar-cell.today .day-number { background: #007bff; color: #fff; }
.calendar-cell.has-checkin { cursor: pointer; border-color: #bee3f8; background-color: #ebf8ff; }
.calendar-cell.has-checkin:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.05); z-index: 5; }
.checkin-dots { display: flex; justify-content: center; align-items: center; height: 16px; width: 100%; padding-left: 6px; box-sizing: border-box; }
.user-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; margin-left: -6px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); flex-shrink: 0; }

/* --- Modal (修复) --- */
#fitness-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 99998; display: flex; justify-content: center; align-items: center; }
#fitness-modal-content { background: #fff; border-radius: 16px; padding: 20px; max-width: 85%; max-height: 85%; overflow-y: auto; position: relative; min-width: 300px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); box-sizing: border-box; }
#fitness-modal-close { position: absolute; top: 15px; right: 15px; font-size: 1.8em; line-height: 1; cursor: pointer; color: #cbd5e0; }
#fitness-modal-body h3 { margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 12px; font-size: 1.2em; color: #2d3748; }
#modal-user-list { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 15px; border-bottom: 1px solid #eee; margin-top: 15px; }

/* (*** 修复重点 ***) 移除强制白色文字，增加边框宽度 */
.modal-user-btn { 
    flex-grow: 1; 
    padding: 10px; 
    border: 1px solid #edf2f7; 
    background: #f7fafc; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    color: #4a5568; 
    font-size: 0.9em; 
    transition: all 0.2s ease;
}
.modal-user-btn:hover { background: #edf2f7; border-color: #cbd5e0; }

/* 选中状态：加粗边框，文字颜色由 JS 控制 (不再强制变白) */
.modal-user-btn.active { 
    font-weight: 800; 
    border-width: 2px;
}

.modal-checkin-item { margin-top: 15px; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.modal-checkin-header { padding: 10px 15px; font-size: 1em; font-weight: bold; }
.modal-checkin-item img { display: block; width: auto; height: auto; max-width: 100%; max-height: 60vh; margin: 0 auto; }