/* 自定义全局样式 */
body {
    -webkit-font-smoothing: antialiased;
    background-color: #f8f9fa; /* light mode */
}
[data-bs-theme="dark"] body {
    background-color: var(--bs-body-bg);
}

/* Safe area：所有模式下 navbar 顶部间距 */
.navbar {
    padding-top: max(0.5rem, env(safe-area-inset-top));
}
/* standalone 模式额外补偿状态栏 */
@media screen and (display-mode: standalone) {
    body { padding-top: env(safe-area-inset-top); }
}

/* 卡片样式优化 */
.card {
    transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

/* 列表高亮 */
.cam-highlight {
    background-color: #fff3cd !important;
}

/* 搜索高亮 */
mark {
    padding: 0;
    background-color: rgba(255, 193, 7, 0.4);
}

/* 触控目标优化 (iOS HIG) */
.btn {
    min-height: 44px;
    display: inline-flex;   /* inline-flex 保持内联，不破坏表格和按钮组 */
    align-items: center;
    justify-content: center;
}
.nav-link, .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
}
.dropdown-item {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* 防止 iOS 输入框自动缩放（字号 ≥ 16px） */
input.form-control,
select.form-select,
textarea.form-control {
    font-size: max(16px, 1rem);
}

/* === Premium Action Button Colors === */
.btn-cam-red {
    background-color: #b85c58;
    border-color: #b85c58;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.btn-cam-red:hover, .btn-cam-red:focus {
    background-color: #9e4c49;
    border-color: #9e4c49;
    color: #fff;
    box-shadow: 0 2px 8px rgba(184, 92, 88, 0.35);
}
.btn-cam-red:disabled, .btn-cam-red.disabled {
    background-color: #b85c58;
    border-color: #b85c58;
    color: #fff;
    opacity: 0.45;
}

.btn-cam-amber {
    background-color: #c8921a;
    border-color: #c8921a;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.btn-cam-amber:hover, .btn-cam-amber:focus {
    background-color: #ad7c15;
    border-color: #ad7c15;
    color: #fff;
    box-shadow: 0 2px 8px rgba(200, 146, 26, 0.35);
}
.btn-cam-amber:disabled, .btn-cam-amber.disabled {
    background-color: #c8921a;
    border-color: #c8921a;
    color: #fff;
    opacity: 0.45;
}

.btn-cam-teal {
    background-color: #3a8a6e;
    border-color: #3a8a6e;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.btn-cam-teal:hover, .btn-cam-teal:focus {
    background-color: #2f725a;
    border-color: #2f725a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(58, 138, 110, 0.35);
}
.btn-cam-teal:disabled, .btn-cam-teal.disabled {
    background-color: #3a8a6e;
    border-color: #3a8a6e;
    color: #fff;
    opacity: 0.45;
}

/* 浮动操作按钮 FAB (移动端新增地址) */
.cam-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}
@media (max-width: 767.98px) {
    /* 为底部导航栏腾出空间 */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom) + 1rem) !important;
    }
    /* FAB 浮在底部导航栏上方 */
    .cam-fab {
        bottom: calc(56px + env(safe-area-inset-bottom) + 12px);
    }
    /* Toast 不被底部导航遮挡 */
    .toast-container {
        bottom: calc(56px + env(safe-area-inset-bottom) + 8px) !important;
    }
    /* 表单提交按钮：sticky 贴在底部导航上方，始终可见 */
    #addressForm .card-footer {
        position: sticky;
        bottom: calc(56px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #dee2e6 !important;
        border-radius: 0 !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
        z-index: 500;
        padding: 0.75rem 1.25rem;
    }
}

/* ============================================================
   底部标签导航栏 (Mobile only, < md)
   ============================================================ */
.cam-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.07);
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
}

.cam-bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    min-height: unset;      /* 覆盖全局 .btn 44px 规则 */
    color: #6c757d;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.cam-bnav-item i {
    font-size: 1.4rem;
    line-height: 1;
}

.cam-bnav-item.active {
    color: #0d6efd;
}

.cam-bnav-item:active {
    opacity: 0.7;
}

/* Offcanvas 更多菜单 — 应用图标网格 */
.cam-app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #212529;
    text-decoration: none;
}

.cam-app-icon-img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.cam-app-icon span {
    font-size: 0.7rem;
    text-align: center;
    white-space: nowrap;
    color: #212529;
}

/* ============================================================
   主题切换按钮
   ============================================================ */
.cam-theme-group .btn {
    min-height: unset;   /* 覆盖全局 44px 规则，导航栏内紧凑显示 */
    padding: 0.2rem 0.45rem;
    line-height: 1.4;
}

/* ============================================================
   暗色模式覆盖
   ============================================================ */
[data-bs-theme="dark"] .cam-bottom-nav {
    background: var(--bs-body-bg);
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .cam-bnav-item {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .cam-bnav-item.active {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .cam-app-icon,
[data-bs-theme="dark"] .cam-app-icon span {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .cam-highlight {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

[data-bs-theme="dark"] mark {
    background-color: rgba(255, 193, 7, 0.25);
    color: inherit;
}

/* 所有写死 bg-white 的 card-footer 在暗色模式下透明化，继承卡片背景 */
[data-bs-theme="dark"] .card-footer.bg-white {
    background-color: transparent !important;
}

/* 搜索栏图标容器 */
[data-bs-theme="dark"] .input-group-text.bg-white {
    background-color: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-secondary-color) !important;
}

/* 表单提交按钮 sticky footer — 暗色模式 */
[data-bs-theme="dark"] #addressForm .card-footer {
    background: var(--bs-card-bg) !important;
    border-top-color: var(--bs-border-color) !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.25);
}

/* === Dashboard === */
.cam-kpi-card {
    display: block;
    background: var(--bs-card-bg, #fff);
    border-radius: 14px;
    padding: 14px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    color: inherit;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    min-height: 100px;
}
.cam-kpi-card:not(.cam-kpi-disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: inherit;
}
.cam-kpi-disabled { cursor: default; opacity: 0.6; }
.cam-kpi-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.cam-kpi-value {
    font-size: 1.6rem;
    line-height: 1.1;
    font-weight: 700;
}
.cam-kpi-label {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    margin-top: 2px;
}
@media (min-width: 768px) {
    .cam-kpi-value { font-size: 1.9rem; }
    .cam-kpi-label { font-size: 0.85rem; }
}

.cam-pending-icon,
.cam-activity-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.cam-quick-action {
    min-height: 44px;
    transition: transform 0.1s ease;
}
.cam-quick-action:hover { transform: translateX(2px); }

/* 桌面端：快捷操作 sticky，跟随滚动 */
@media (min-width: 768px) {
    .cam-dashboard-sticky {
        position: sticky;
        top: 84px;
    }
}

/* 时间线行：移动端紧凑些 */
@media (max-width: 575.98px) {
    .cam-activity-icon { width: 32px; height: 32px; font-size: 0.95rem; }
}
