/* ============================================
   宝贝计划 - 全局样式
   温馨粉色主题 | 移动优先
   ============================================ */

:root {
    --pink-light: #FFF0F5;
    --pink-main: #FFB6C1;
    --pink-deep: #FF69B4;
    --pink-dark: #DB7093;
    --white: #FFFFFF;
    --text: #333333;
    --text-light: #888888;
    --text-white: #FFFFFF;
    --shadow: 0 4px 20px rgba(255, 182, 193, 0.3);
    --shadow-lg: 0 8px 30px rgba(255, 182, 193, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
    --green: #4CAF50;
    --red: #E91E63;
    --blue: #2196F3;
    --orange: #FF9800;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--pink-light) 0%, #FFE4E1 50%, var(--pink-light) 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

/* ===== 登录/注册页容器 ===== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.5s ease;
}

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

.auth-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--pink-deep);
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--pink-main);
    pointer-events: none;
}

.input-wrapper .icon svg {
    width: 20px;
    height: 20px;
    fill: var(--pink-main);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid #F0E0E8;
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    background: #FFFAFD;
    transition: all 0.3s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--pink-main);
    box-shadow: 0 0 0 3px rgba(255, 182, 193, 0.2);
    background: var(--white);
}

.input-wrapper input::placeholder {
    color: #D0C0C8;
}

/* 带单位的输入框 */
.input-with-unit {
    position: relative;
}
.input-with-unit input {
    padding-right: 40px;
}
.input-with-unit .unit {
    position: absolute;
    right: 14px;
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pink-deep), var(--pink-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255, 105, 180, 0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-outline {
    background: var(--white);
    color: var(--pink-dark);
    border: 2px solid var(--pink-main);
}
.btn-outline:hover { background: var(--pink-light); }

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 17px;
}

/* 喂养类型按钮 */
.btn-feed {
    padding: 10px 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    transition: all 0.2s;
}
.btn-feed:active { transform: scale(0.96); }

.btn-breast    { background: var(--green); }
.btn-formula   { background: var(--red); }
.btn-supplement { background: var(--blue); }
.btn-poop      { background: var(--orange); }
.btn-diaper    { background: #9C27B0; }

.btn-danger {
    background: #F44336;
    color: var(--text-white);
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--white);
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--pink-deep);
}

.navbar-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.navbar-links a {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.navbar-links a:hover,
.navbar-links a.active {
    background: var(--pink-light);
    color: var(--pink-dark);
}

/* 汉堡菜单（移动端） */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--pink-dark);
    cursor: pointer;
}

/* ===== 主内容区 ===== */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--pink-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 今日汇总 ===== */
.today-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}

.summary-item {
    padding: 16px 8px;
    border-radius: var(--radius-sm);
    background: var(--pink-light);
}

.summary-item .label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}
.summary-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--pink-dark);
}
.summary-item .unit {
    font-size: 12px;
    color: var(--text-light);
}

.summary-item.breast .value { color: var(--green); }
.summary-item.formula .value { color: var(--red); }
.summary-item.supplement .value { color: var(--blue); }

/* ===== 喂养输入区 ===== */
.feed-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.feed-input-row .input-wrapper {
    flex: 1;
}

.feed-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* ===== 详细列表 ===== */
.detail-list {
    width: 100%;
    border-collapse: collapse;
}

.detail-list th {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    padding: 8px 6px;
    text-align: left;
    border-bottom: 2px solid var(--pink-light);
}

.detail-list td {
    padding: 10px 6px;
    font-size: 14px;
    border-bottom: 1px solid #F5F0F3;
}

.detail-list .type-breast { color: var(--green); font-weight: 600; }
.detail-list .type-formula { color: var(--red); font-weight: 600; }
.detail-list .type-supplement { color: var(--blue); font-weight: 600; }

.detail-list .summary-row td {
    font-weight: 700;
    border-top: 2px solid var(--pink-main);
    background: var(--pink-light);
}

.edit-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}
.edit-btn:hover { color: var(--pink-deep); background: var(--pink-light); }
.edit-btn svg { width: 16px; height: 16px; }

.diaper-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--pink-light);
}

.diaper-stat {
    text-align: center;
    flex: 1;
}
.diaper-stat .count {
    font-size: 28px;
    font-weight: 700;
    color: var(--pink-dark);
}
.diaper-stat .label {
    font-size: 12px;
    color: var(--text-light);
}

/* ===== 底部按钮组 ===== */
.bottom-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

/* ===== 历史数据页 ===== */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.history-table th {
    padding: 10px 6px;
    text-align: left;
    border-bottom: 2px solid var(--pink-light);
    font-size: 11px;
    color: var(--text-light);
}
.history-table td {
    padding: 10px 6px;
    border-bottom: 1px solid #F5F0F3;
}
.history-table tr:hover td { background: #FFFAFD; }

/* ===== 数据分析页 ===== */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}
.chart-container canvas {
    width: 100% !important;
}

.month-picker {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.month-picker select, .month-picker input {
    padding: 8px 12px;
    border: 2px solid var(--pink-main);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    outline: none;
}

.month-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.stat-card {
    background: var(--pink-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--pink-dark);
}
.stat-card .label {
    font-size: 12px;
    color: var(--text-light);
}

/* ===== 个人信息页 ===== */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--pink-main);
    margin: 0 auto 16px;
    display: block;
    background: var(--pink-light);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--pink-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: var(--pink-main);
    border: 3px solid var(--pink-main);
}

/* ===== 弹窗 / 模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 360px;
    animation: fadeInUp 0.3s ease;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--pink-dark);
    margin-bottom: 16px;
    text-align: center;
}

.modal-body { margin-bottom: 20px; }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--text-white);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: #F44336; }

/* ===== 页脚 ===== */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-light);
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .auth-card { padding: 30px 20px; }
    .main-content { padding: 12px; }
    .card { padding: 16px; border-radius: var(--radius-sm); }

    .navbar-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }
    .navbar-links.open { display: flex; }
    .navbar-toggle { display: block; }

    .today-summary { gap: 8px; }
    .summary-item { padding: 12px 4px; }
    .summary-item .value { font-size: 20px; }

    .feed-input-row { flex-direction: column; }
    .history-table { font-size: 11px; }
    .history-table th, .history-table td { padding: 6px 3px; }
}

/* ===== 加载动画 ===== */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--pink-light);
    border-top-color: var(--pink-deep);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-state svg { width: 60px; height: 60px; margin-bottom: 12px; opacity: 0.3; }
