/* ============================================================
   习惯打卡 habit.s1.css
   翠绿渐变主题 linear-gradient(135deg,#10b981,#14b8a6) + 玻璃拟态，移动端自适应
   ============================================================ */

.habit-card {
    background: linear-gradient(160deg, rgba(255,255,255,0.96), rgba(236,253,245,0.92));
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.10);
    padding: 22px;
    position: relative;
    overflow: hidden;
}
.habit-card::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(20,184,166,0.10), transparent 70%);
    pointer-events: none;
}
.habit-card::after {
    content: '';
    position: absolute;
    bottom: -40px; left: -40px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(16,185,129,0.08), transparent 70%);
    pointer-events: none;
}
.habit-icon {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
    animation: habit-breath 3s ease-in-out infinite;
}
@keyframes habit-breath {
    0%, 100% { box-shadow: 0 6px 18px rgba(16,185,129,0.35); }
    50% { box-shadow: 0 6px 26px rgba(20,184,166,0.55); }
}

/* ---------- 登录引导 ---------- */
.habit-login-guide { text-align: center; padding: 34px 16px 26px; position: relative; z-index: 1; }
.habit-login-guide i { font-size: 40px; background: linear-gradient(135deg,#10b981,#14b8a6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.habit-login-guide h3 { margin: 12px 0 6px; font-size: 1.05rem; color: #1e293b; }
.habit-login-guide p { margin: 0 0 18px; font-size: 0.85rem; color: #64748b; }
.habit-login-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.habit-login-btns a {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 26px; border-radius: 999px; text-decoration: none;
    font-size: 0.9rem; font-weight: 600; transition: all .25s ease;
}
.habit-login-btns a.main { background: linear-gradient(135deg,#10b981,#14b8a6); color: #fff; box-shadow: 0 6px 16px rgba(16,185,129,0.35); }
.habit-login-btns a.main:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,184,166,0.45); }
.habit-login-btns a.ghost { border: 1.5px solid rgba(16,185,129,0.45); color: #059669; background: rgba(255,255,255,0.7); }
.habit-login-btns a.ghost:hover { background: rgba(16,185,129,0.08); }

/* ---------- Tabs ---------- */
.habit-tabs {
    display: flex; gap: 5px; margin: 6px 0 16px;
    background: rgba(236,253,245,0.55); border: 1px solid rgba(16,185,129,0.28);
    padding: 5px; border-radius: 14px;
    position: relative; z-index: 1;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.habit-tabs::-webkit-scrollbar { display: none; }
.habit-tab {
    flex: 1 0 auto; border: none; background: transparent; cursor: pointer;
    padding: 9px 12px; border-radius: 10px; font-size: 0.85rem; font-weight: 600;
    color: #94a3b8; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    transition: all .22s ease; white-space: nowrap;
}
.habit-tab i { font-size: 0.8rem; }
.habit-tab:hover { color: #059669; }
.habit-tab.active {
    background: linear-gradient(135deg,#10b981,#14b8a6); color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.habit-pane { display: none; animation: habit-slide-in .3s ease; position: relative; z-index: 1; }
.habit-pane.active { display: block; }
@keyframes habit-slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 新增按钮 ---------- */
.habit-add-row { display: flex; margin-bottom: 16px; }
.habit-add-btn {
    border: none; cursor: pointer;
    padding: 12px 22px; border-radius: 14px;
    font-size: 0.9rem; font-weight: 600; color: #fff;
    background: linear-gradient(135deg,#10b981,#14b8a6);
    box-shadow: 0 6px 16px rgba(16,185,129,0.35);
    display: inline-flex; align-items: center; gap: 8px;
    transition: all .25s ease;
}
.habit-add-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,184,166,0.45); }

/* ---------- 表单 ---------- */
.habit-form-card {
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(16,185,129,0.22);
    border-radius: 16px; padding: 18px;
    margin-bottom: 16px;
}
.habit-form-title { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 700; color: #065f46; margin-bottom: 16px; }
.habit-form-title i { color: #10b981; }

.habit-field-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.habit-field { flex: 1; min-width: 130px; margin-bottom: 14px; }
.habit-field label { display: block; font-size: 0.82rem; font-weight: 600; color: #475569; margin-bottom: 7px; }
.habit-field label i { color: #10b981; margin-right: 4px; }
.habit-field input[type="text"], .habit-field input[type="number"], .habit-field select {
    width: 100%; padding: 10px 12px; border: 1.5px solid rgba(16,185,129,0.25);
    border-radius: 10px; font-size: 0.88rem; color: #1e293b;
    background: #fff; box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.habit-field input:focus, .habit-field select:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.12); }

.habit-save-row { display: flex; gap: 10px; margin-top: 6px; }
.habit-save-btn {
    flex: 1; border: none; cursor: pointer;
    padding: 12px 20px; border-radius: 12px;
    font-size: 0.92rem; font-weight: 600; color: #fff;
    background: linear-gradient(135deg,#10b981,#14b8a6);
    box-shadow: 0 6px 16px rgba(16,185,129,0.35);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: all .25s ease;
}
.habit-save-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,184,166,0.45); }
.habit-cancel-btn {
    border: 1.5px solid rgba(16,185,129,0.4); cursor: pointer;
    padding: 12px 20px; border-radius: 12px;
    font-size: 0.92rem; font-weight: 600; color: #059669; background: rgba(255,255,255,0.7);
    transition: all .2s;
}
.habit-cancel-btn:hover { background: rgba(16,185,129,0.08); }

/* ---------- 习惯卡片列表 ---------- */
.habit-list { display: flex; flex-direction: column; gap: 12px; }
.habit-card-item {
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: 16px; padding: 16px;
    display: flex; align-items: center; gap: 14px;
    transition: all .2s;
}
.habit-card-item:hover { box-shadow: 0 6px 18px rgba(16,185,129,0.12); transform: translateY(-1px); }
.habit-card-icon {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.habit-card-info { flex: 1; min-width: 0; }
.habit-card-name { font-size: 1rem; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.habit-card-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: #64748b; }
.habit-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.habit-card-meta i { font-size: 0.72rem; }
.habit-streak-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, rgba(251,146,60,0.15), rgba(239,68,68,0.12));
    color: #ea580c; padding: 2px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
}
.habit-streak-badge i { color: #f97316; }
.habit-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.habit-card-btn {
    border: none; background: rgba(16,185,129,0.08); color: #059669;
    width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
    font-size: 0.82rem; transition: all .2s;
}
.habit-card-btn:hover { background: rgba(16,185,129,0.18); }
.habit-card-btn.del { color: #ef4444; background: rgba(239,68,68,0.08); }
.habit-card-btn.del:hover { background: rgba(239,68,68,0.18); }
.habit-check-btn {
    border: none; cursor: pointer;
    padding: 10px 18px; border-radius: 12px;
    font-size: 0.85rem; font-weight: 600; color: #fff;
    background: linear-gradient(135deg,#10b981,#14b8a6);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    display: inline-flex; align-items: center; gap: 6px;
    transition: all .2s;
    flex-shrink: 0;
}
.habit-check-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20,184,166,0.4); }
.habit-check-btn.done {
    background: rgba(16,185,129,0.12); color: #059669;
    box-shadow: none; border: 1.5px solid rgba(16,185,129,0.4);
}
.habit-check-btn.done:hover { background: rgba(16,185,129,0.2); }

/* 进度条 */
.habit-progress { height: 6px; background: rgba(16,185,129,0.12); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.habit-progress-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }

/* ---------- 统计页 ---------- */
.habit-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.habit-stat-card {
    background: rgba(255,255,255,0.8); border-radius: 14px; padding: 14px;
    border: 1px solid rgba(16,185,129,0.18);
}
.habit-stat-card.c1 { background: linear-gradient(135deg, #d1fae5, #fff); }
.habit-stat-card.c2 { background: linear-gradient(135deg, #cffafe, #fff); }
.habit-stat-card.c3 { background: linear-gradient(135deg, #ffedd5, #fff); }
.habit-stat-card.c4 { background: linear-gradient(135deg, #ede9fe, #fff); }
.habit-stat-label { font-size: 0.78rem; color: #64748b; margin-bottom: 6px; }
.habit-stat-label i { margin-right: 4px; }
.habit-stat-value { font-size: 1.5rem; font-weight: 800; color: #1e293b; }
.habit-stat-value small { font-size: 0.8rem; font-weight: 500; color: #64748b; }

.habit-top-title { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 700; color: #065f46; margin: 18px 0 12px; }
.habit-top-title i { color: #10b981; }

.habit-stats-list { display: flex; flex-direction: column; gap: 10px; }
.habit-stat-item {
    background: rgba(255,255,255,0.8); border: 1px solid rgba(16,185,129,0.18);
    border-radius: 14px; padding: 14px;
}
.habit-si-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.habit-si-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.9rem; flex-shrink: 0; }
.habit-si-name { font-size: 0.9rem; font-weight: 600; color: #1e293b; flex: 1; }
.habit-si-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.habit-si-cell { text-align: center; background: rgba(16,185,129,0.06); border-radius: 10px; padding: 8px 4px; }
.habit-si-cell .habit-si-num { font-size: 1.1rem; font-weight: 700; color: #059669; }
.habit-si-cell .habit-si-lbl { font-size: 0.7rem; color: #94a3b8; margin-top: 2px; }

/* ---------- 日历 ---------- */
.habit-cal-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 0.85rem; color: #475569; flex-wrap: wrap; }
.habit-cal-filter select {
    padding: 7px 12px; border: 1.5px solid rgba(16,185,129,0.25);
    border-radius: 10px; font-size: 0.85rem; color: #1e293b; background: #fff;
}
.habit-cal-filter select:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.12); }

.habit-month-nav {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    margin-bottom: 14px;
}
.habit-month-nav button {
    border: none; background: rgba(16,185,129,0.1); color: #059669;
    width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
    font-size: 0.85rem; transition: all .2s;
}
.habit-month-nav button:hover { background: rgba(16,185,129,0.2); }
.habit-month-label { font-size: 1.05rem; font-weight: 700; color: #065f46; }

.habit-calendar {
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(16,185,129,0.22);
    border-radius: 16px; padding: 12px;
}
.habit-cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.habit-cal-week span { text-align: center; font-size: 0.72rem; color: #94a3b8; font-weight: 600; padding: 4px 0; }
.habit-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.habit-cal-cell {
    aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 0.82rem; cursor: pointer; position: relative;
    color: #475569; transition: all .15s;
}
.habit-cal-cell:hover { background: rgba(16,185,129,0.08); }
.habit-cal-cell.other { color: #cbd5e1; }
.habit-cal-cell.today { font-weight: 700; }
.habit-cal-cell.today::after { content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: #10b981; }
.habit-cal-cell.checked { background: linear-gradient(135deg,#34d399,#10b981); color: #fff; font-weight: 600; }
.habit-cal-cell.checked.today::after { background: #fff; }

.habit-cal-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 14px; font-size: 0.75rem; color: #64748b; }
.habit-cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.habit-leg-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.habit-leg-dot.checked { background: linear-gradient(135deg,#34d399,#10b981); }
.habit-leg-dot.today { border: 2px solid #10b981; background: #fff; }

/* ---------- 空状态 ---------- */
.habit-empty { text-align: center; padding: 28px 16px; color: #94a3b8; }
.habit-empty i { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }
.habit-empty div { font-size: 0.85rem; }

/* ---------- Toast ---------- */
.habit-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: #fff; padding: 12px 20px; border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex; align-items: center; gap: 10px;
    font-size: 0.88rem; font-weight: 500; z-index: 999999;
    border-left: 4px solid #10b981;
    animation: habit-toast-in .3s ease;
    max-width: 90vw;
}
.habit-toast.success { border-left-color: #10b981; }
.habit-toast.error { border-left-color: #ef4444; }
.habit-toast.warning { border-left-color: #f59e0b; }
.habit-toast.info { border-left-color: #3b82f6; }
.habit-toast i { font-size: 1rem; }
.habit-toast.success i { color: #10b981; }
.habit-toast.error i { color: #ef4444; }
.habit-toast.warning i { color: #f59e0b; }
.habit-toast.info i { color: #3b82f6; }
@keyframes habit-toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-15px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---------- 弹窗 ---------- */
.habit-modal-mask {
    position: fixed; inset: 0; background: rgba(15,23,42,0.45);
    z-index: 999998; display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: habit-fade .2s ease;
}
@keyframes habit-fade { from { opacity: 0; } to { opacity: 1; } }
.habit-modal {
    background: #fff; border-radius: 18px; max-width: 420px; width: 100%;
    padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: habit-pop .25s ease;
    max-height: 85vh; overflow-y: auto;
}
@keyframes habit-pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.habit-modal-title { font-size: 1.05rem; font-weight: 700; color: #065f46; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.habit-modal-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
.habit-modal-row:last-child { border-bottom: none; }
.habit-modal-row .habit-mr-label { color: #64748b; }
.habit-modal-row .habit-mr-val { font-weight: 600; color: #1e293b; }
.habit-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.habit-modal-btn {
    flex: 1; border: none; cursor: pointer; padding: 10px; border-radius: 10px;
    font-size: 0.88rem; font-weight: 600; transition: all .2s;
}
.habit-modal-btn.primary { background: linear-gradient(135deg,#10b981,#14b8a6); color: #fff; }
.habit-modal-btn.primary:hover { transform: translateY(-1px); }
.habit-modal-btn.ghost { background: rgba(16,185,129,0.08); color: #059669; }
.habit-modal-btn.danger { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
    .habit-card { padding: 14px; border-radius: 16px; }
    .habit-tab { padding: 8px 10px; font-size: 0.78rem; }
    .habit-tab i { display: none; }
    .habit-card-item { flex-wrap: wrap; }
    .habit-card-actions { width: 100%; justify-content: flex-end; }
    .habit-check-btn { width: 100%; }
    .habit-field-row { gap: 8px; }
    .habit-stat-grid { gap: 8px; }
    .habit-stat-card { padding: 12px; }
    .habit-stat-value { font-size: 1.25rem; }
    .habit-si-grid { gap: 6px; }
}
