/* 瘦吧减脂 APP 公共样式 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 主色调和设计规范 */
:root {
    --primary-color: #1ABC9C;
    --secondary-color: #16A085;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --background: #FFFFFF;
    --border-color: #E8E8E8;
    --shadow: 0 2px 12px rgba(26, 188, 156, 0.1);
}

/* 全局字体设置 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background);
}

/* 响应式移动端适配 */
html {
    font-size: 16px;
}

@media screen and (max-width: 414px) {
    html {
        font-size: 14px;
    }
}

@media screen and (max-width: 375px) {
    html {
        font-size: 13px;
    }
}

/* 底部导航样式 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.bottom-nav .nav-item.active {
    color: #1ABC9C !important;
}

.bottom-nav .nav-item.active .nav-text {
    color: #1ABC9C !important;
    font-weight: bold;
}

.bottom-nav .nav-item.active .nav-icon {
    color: var(--primary-color) !important;
}

.bottom-nav .nav-item.active .nav-icon svg {
    stroke: var(--primary-color) !important;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-light);
    transition: stroke 0.3s ease;
}

.nav-item:hover .nav-icon svg {
    stroke: var(--primary-color);
}

.nav-item:hover .nav-text {
    color: var(--primary-color);
}

.nav-text {
    font-size: 12px;
}

.nav-label {
    font-size: 12px;
    color: inherit;
}

/* 公共组件样式 */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

.page {
    min-height: 100vh;
    background: var(--background);
}

/* 页面头部样式 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.page-header .back-btn,
.page-header .help-btn,
.page-header .calendar-btn,
.page-header .history-btn,
.page-header .menu-btn,
.page-header .sync-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
    font-size: 16px;
}

.page-header .back-btn:hover,
.page-header .help-btn:hover,
.page-header .calendar-btn:hover,
.page-header .history-btn:hover,
.page-header .menu-btn:hover,
.page-header .sync-btn:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.page-header .page-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin: 0;
    flex: 1;
    text-align: center;
}

.page-header .back-icon,
.page-header .help-icon,
.page-header .calendar-icon,
.page-header .history-icon,
.page-header .menu-icon,
.page-header .sync-icon {
    font-size: 18px;
    line-height: 1;
}

.header {
    padding: 16px 0;
    background: var(--primary-color);
    color: white;
    text-align: center;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.button:hover {
    background: var(--secondary-color);
    text-decoration: none;
    color: white;
}

.button:disabled {
    background: #BDC3C7;
    cursor: not-allowed;
}

.button.secondary {
    background: #ECF0F1;
    color: var(--text-color);
}

.button.secondary:hover {
    background: #D5DBDB;
    color: var(--text-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    border-color: var(--primary-color);
}

.form-input:disabled {
    background: #F8F9FA;
    color: var(--text-light);
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-light);
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
        padding-bottom: 70px;
    }
}

/* 首页模块样式 */
.home-module {
    padding: 0 16px;
    padding-bottom: 80px;
}

/* 虚拟人像区域 */
.avatar-section {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    margin: 16px 0;
    color: white;
}

.avatar-container {
    position: relative;
    display: inline-block;
}

.virtual-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    cursor: pointer;
    transition: transform 0.3s ease;
    user-select: none;
}

.avatar-controls {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.rotate-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.rotate-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.progress-ring {
    margin-top: 16px;
}

.progress-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-value {
    font-size: 24px;
    font-weight: bold;
}

.progress-label {
    font-size: 14px;
    opacity: 0.9;
}

/* 核心数据卡片 */
.data-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.data-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(26, 188, 156, 0.2);
}

.card-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.card-unit {
    font-size: 12px;
    color: var(--text-light);
}

.card-label {
    font-size: 12px;
    color: var(--text-color);
    margin-top: 4px;
}

/* 快捷功能区 */
.quick-actions {
    margin: 24px 0;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 16px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.action-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.action-item:hover {
    transform: translateY(-2px);
}

.action-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.action-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 4px;
}

.action-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

.action-status.completed {
    background: #E8F5E8;
    color: #27AE60;
}

.action-status.pending {
    background: #FFF3E0;
    color: #F39C12;
}

/* 功能模块导航 */
.feature-navigation {
    margin: 24px 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.feature-item {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.feature-item:hover {
    transform: translateY(-3px);
}

.feature-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.feature-label {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 4px;
}

.feature-desc {
    font-size: 12px;
    color: var(--text-light);
}

/* 最新动态 */
.notifications {
    margin: 24px 0;
}

.notification-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.notification-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    font-size: 24px;
    margin-right: 12px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-light);
}

/* 打卡弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.btn-cancel {
    background: #F8F8F8;
    color: var(--text-color);
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
}

.btn-confirm:hover {
    background: var(--secondary-color);
}

/* 表单元素 */
.input-field,
.select-field,
.textarea-field {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.textarea-field {
    min-height: 80px;
    resize: vertical;
}

.diet-input,
.exercise-input {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
