* {
    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: #f7f6f3;
    min-height: 100vh;
    color: #2c2c2c;
    line-height: 1.6;
}

/* ---------- 页面切换 ---------- */
.page {
    display: block;
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none;
}

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

/* ---------- 容器 ---------- */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
    border: 1px solid #f0ede8;
}

/* ---------- 登录 / 注册 ---------- */
#loginPage .container,
#registerPage .container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#loginPage .card,
#registerPage .card {
    width: 100%;
    max-width: 400px;
}

h1 {
    text-align: center;
    color: #b8a08a;
    margin-bottom: 28px;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #6b6b6b;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e8e4dd;
    border-radius: 8px;
    font-size: 15px;
    background: #fafaf8;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #c4a88c;
    box-shadow: 0 0 0 3px rgba(196, 168, 140, 0.12);
    background: #fff;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 14px;
    color: #888;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #c4a88c;
}

/* ---------- 按钮 ---------- */
.btn {
    width: 100%;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #c4a88c;
    color: #fff;
}

.btn-primary:hover {
    background: #b39373;
    box-shadow: 0 2px 8px rgba(180, 150, 120, 0.25);
}

.btn-secondary {
    background: #f3f1ed;
    color: #7a7a7a;
}

.btn-secondary:hover {
    background: #ebe7e0;
    color: #555;
}

.btn-small {
    width: auto;
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 6px;
}

.error-message {
    color: #d9756a;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
}

/* ---------- 主页面头部 ---------- */
.header {
    background: #fff;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0ede8;
    position: relative;
    z-index: 10;
}

.header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #b8a08a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    font-weight: 500;
    color: #8b8b8b;
    font-size: 14px;
}

/* ---------- 侧边栏布局 ---------- */
.main-layout {
    display: flex;
    min-height: calc(100vh - 57px);
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #f0ede8;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
}

.sidebar-tab {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #8b8b8b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.sidebar-tab:hover {
    background: #f3f1ed;
    color: #5a5a5a;
}

.sidebar-tab.active {
    background: #faf6f0;
    color: #c4a88c;
    font-weight: 600;
}

/* 侧边栏统计 */
.sidebar-stats {
    margin-top: auto;
    padding: 20px 12px 0;
    border-top: 1px solid #f0ede8;
}

.sidebar-stat {
    padding: 12px 14px;
    text-align: center;
}

.sidebar-stat + .sidebar-stat {
    border-top: 1px solid #f8f6f2;
}

.sidebar-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #c4a88c;
    line-height: 1.2;
}

.sidebar-stat-label {
    font-size: 12px;
    color: #aaa;
    margin-top: 2px;
}

/* ---------- 内容区 ---------- */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-width: 0;
}

.tab-content {
    animation: fadeIn 0.25s ease;
}

/* ---------- 打卡卡片 ---------- */
.checkin-card h2 {
    color: #b8a08a;
    margin-bottom: 18px;
    font-size: 18px;
    font-weight: 600;
}

#checkinStatus {
    text-align: center;
    padding: 24px;
    font-size: 16px;
    color: #8faa7c;
    font-weight: 500;
}

.upload-label {
    display: block;
    text-align: center;
    padding: 36px;
    border: 2px dashed #e0d9cf;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafaf8;
}

.upload-label:hover {
    border-color: #c4a88c;
    background: #fdfbf7;
}

.upload-label span {
    font-size: 16px;
    color: #b8a08a;
}

.upload-label input[type="file"] {
    display: none;
}

.photo-preview {
    margin-top: 18px;
    text-align: center;
}

.photo-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ---------- 视图控制 ---------- */
.view-controls {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0ede8;
}

.view-controls h2 {
    color: #b8a08a;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.view-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-view {
    flex: 1;
    min-width: 100px;
    background: #f3f1ed;
    color: #8b8b8b;
    font-size: 13px;
    padding: 9px 14px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-view.active {
    background: #c4a88c;
    color: #fff;
}

.btn-view:hover {
    background: #e8e4dc;
}

.btn-view.active:hover {
    background: #b39373;
}

/* ---------- 视图容器 ---------- */
.view-container {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0ede8;
    animation: fadeIn 0.25s ease;
}

/* ---------- 网格视图 ---------- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    aspect-ratio: 3 / 4;
}

.grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: #fff;
    padding: 16px 14px 12px;
}

.grid-item-date {
    font-size: 12px;
    margin-bottom: 3px;
    opacity: 0.85;
}

.grid-item-day {
    font-size: 15px;
    font-weight: 600;
}

/* ---------- 时间线视图 ---------- */
.timeline-container {
    position: relative;
    padding-left: 36px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: #e8e4dd;
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 36px;
    padding-left: 16px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c4a88c;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #c4a88c;
}

.timeline-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.timeline-photo {
    flex-shrink: 0;
}

.timeline-photo img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timeline-info {
    flex: 1;
    padding-top: 4px;
}

.timeline-date {
    font-size: 16px;
    font-weight: 600;
    color: #4a4a4a;
    margin-bottom: 6px;
}

.timeline-day {
    font-size: 14px;
    color: #999;
}

/* ---------- 对比视图 ---------- */
.comparison-controls {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #fafaf8;
    border-radius: 10px;
    border: 1px solid #f0ede8;
}

.comparison-controls p {
    margin-bottom: 10px;
    color: #888;
    font-size: 14px;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.comparison-side {
    text-align: center;
}

.comparison-side h3 {
    color: #b8a08a;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
}

.compare-slot {
    width: 100%;
    height: 380px;
    border: 2px dashed #e0d9cf;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 14px;
    background: #fafaf8;
    position: relative;
    overflow: hidden;
}

.compare-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.compare-slot-filled {
    border: 2px solid #c4a88c;
    background: #fff;
}

#comparisonGrid .grid-item {
    border: 2px solid transparent;
    border-radius: 10px;
}

#comparisonGrid .grid-item.selected {
    border-color: #c4a88c;
}

/* ---------- 日历视图 ---------- */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #fafaf8;
    border-radius: 10px;
    border: 1px solid #f0ede8;
}

.calendar-controls h3 {
    color: #5a5a5a;
    font-size: 18px;
    font-weight: 600;
}

.calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid #f0ede8;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #fafaf8;
    font-size: 13px;
    color: #ccc;
    overflow: hidden;
}

.calendar-day-header {
    font-weight: 600;
    color: #b8a08a;
    padding: 8px;
    text-align: center;
    font-size: 13px;
}

.calendar-day-number {
    font-size: 13px;
    color: #bbb;
}

.calendar-day-checkin {
    border-color: #d4c4ab;
    background: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calendar-day-checkin:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.calendar-day-checkin img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.calendar-day-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #c4a88c;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c2c2c;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    animation: fadeIn 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        min-height: auto;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid #f0ede8;
    }

    .sidebar-nav {
        flex-direction: row;
        padding: 8px 12px;
        flex: 1;
    }

    .sidebar-tab {
        text-align: center;
        font-size: 13px;
        padding: 8px 12px;
    }

    .sidebar-stats {
        display: flex;
        flex-direction: row;
        margin: 0;
        padding: 8px 12px;
        border-top: none;
        border-left: 1px solid #f0ede8;
        gap: 0;
    }

    .sidebar-stat {
        padding: 4px 10px;
        text-align: center;
    }

    .sidebar-stat + .sidebar-stat {
        border-top: none;
        border-left: 1px solid #f8f6f2;
    }

    .sidebar-stat-value {
        font-size: 20px;
    }

    .sidebar-stat-label {
        font-size: 10px;
    }

    .content {
        padding: 16px;
    }

    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .comparison-container {
        grid-template-columns: 1fr;
    }

    .compare-slot {
        height: 280px;
    }

    .timeline-content {
        flex-direction: column;
    }

    .timeline-photo img {
        width: 100%;
        height: auto;
    }

    .view-buttons {
        flex-direction: column;
    }

    .btn-view {
        width: 100%;
    }

    .calendar-container {
        gap: 4px;
    }

    .calendar-day {
        border-radius: 6px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .card {
        padding: 20px;
    }

    .view-container {
        padding: 16px;
    }
}
