/* ============================================================
   IBD营养周期管理系统 - 自定义样式
   主色：#2b6c8c  背景：#f0f4f8
   ============================================================ */

:root {
    --app-primary: #2b6c8c;
    --app-primary-dark: #235a75;
    --app-primary-light: #e8f1f6;
    --app-bg: #f0f4f8;
    --app-sidebar-bg: #1e3445;
    --app-sidebar-hover: #2b6c8c;
    --app-danger: #d9534f;
    --app-success: #28a745;
}

body {
    background-color: var(--app-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.925rem;
    color: #333;
}

/* ---------------- 顶部导航 ---------------- */
.app-navbar {
    background: linear-gradient(135deg, var(--app-primary-dark), var(--app-primary));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 1030;
}

.app-navbar .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s;
}

.app-navbar .nav-link:hover {
    color: #fff;
}

/* ---------------- 左侧边栏 ---------------- */
.app-sidebar {
    background-color: var(--app-sidebar-bg);
    min-height: calc(100vh - 56px);
    padding-top: 16px;
}

.app-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    border-radius: 6px;
    margin: 2px 10px;
    padding: 10px 14px;
    transition: all 0.2s;
}

.app-sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-link.active {
    color: #fff;
    background-color: var(--app-sidebar-hover);
    font-weight: 600;
}

.app-sidebar .nav-link i {
    margin-right: 6px;
    width: 20px;
    text-align: center;
}

/* ---------------- 内容区 ---------------- */
.app-main {
    padding-top: 20px;
    padding-bottom: 60px;
}

.page-title {
    color: var(--app-primary-dark);
    font-weight: 700;
}

.section-title {
    color: var(--app-primary);
    border-left: 4px solid var(--app-primary);
    padding-left: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

/* ---------------- 卡片 ---------------- */
.card {
    border-radius: 10px;
    overflow: hidden;
}

.card-header {
    font-size: 0.95rem;
}

.card.shadow-sm {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

/* ---------------- 统计卡片 ---------------- */
.stat-card {
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(43, 108, 140, 0.15) !important;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: #2c3e50;
}

.stat-label {
    font-size: 0.8rem;
    color: #7f8c9a;
}

/* ---------------- 按钮 ---------------- */
.btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-primary:hover {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

/* ---------------- 表格 ---------------- */
.table thead th {
    color: #4a5a68;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f5f9fc;
}

/* ---------------- 时间线（周期历史） ---------------- */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #dde6ee;
}

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

.timeline-dot {
    position: absolute;
    left: -21px;
    top: 18px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #dde6ee;
}

.timeline-content {
    border-radius: 10px;
}

/* ---------------- 食品选择器 ---------------- */
.food-picker {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid #e3eaf0;
    border-radius: 8px;
    padding: 12px;
    background: #fafcfd;
}

.food-group {
    margin-bottom: 12px;
}

.food-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--app-primary);
    padding: 4px 0;
    border-bottom: 1px dashed #dde6ee;
    margin-bottom: 8px;
}

.food-item {
    cursor: pointer;
    border: 1px solid #e3eaf0;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.food-item:hover {
    border-color: var(--app-primary);
    background: var(--app-primary-light);
}

.food-item.checked {
    border-color: var(--app-primary);
    background: var(--app-primary-light);
}

.food-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    background: #eef3f7;
}

/* ---------------- 日历 ---------------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7f8c9a;
    padding: 4px 0;
}

.calendar-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 6px;
    color: #555;
    cursor: default;
    position: relative;
}

.calendar-cell.empty {
    visibility: hidden;
}

.calendar-cell.today {
    background: var(--app-primary-light);
    font-weight: 700;
    color: var(--app-primary-dark);
}

.calendar-cell.has-record::after {
    content: "";
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--app-success);
}

.calendar-cell.has-record:hover {
    background: var(--app-primary-light);
    cursor: pointer;
}

/* ---------------- 登录页 ---------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3445 0%, #2b6c8c 60%, #3d8bb0 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    color: #fff;
    margin-bottom: 20px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.login-logo h2 {
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.login-logo p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.captcha-text {
    font-weight: 700;
    color: var(--app-primary);
    min-width: 90px;
    justify-content: center;
    background: var(--app-primary-light);
}

/* ---------------- 页脚 ---------------- */
.app-footer {
    text-align: center;
    color: #9aa7b4;
    font-size: 0.78rem;
    padding: 14px 0 18px;
}

/* ---------------- 其他 ---------------- */
.fw-bold {
    font-weight: 600 !important;
}

.nav-tabs .nav-link {
    color: #5a6b7a;
}

.nav-tabs .nav-link.active {
    color: var(--app-primary);
    font-weight: 600;
}

.w-40 {
    width: 40%;
}

.badge {
    font-weight: 500;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(43, 108, 140, 0.15);
}

/* 面包屑式提示条 */
.alert {
    border-radius: 8px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 767.98px) {
    .app-sidebar {
        min-height: auto;
    }

    .app-sidebar .nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .app-sidebar .nav-link {
        margin: 2px 4px;
        padding: 6px 10px;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}
