/* wechat-char-schedule.css */

/* 须高于 #wechat-char-moments-host(2700)，否则从好友资料 → 他的行程 时被资料页盖住 */
#app #wechat-char-schedule-host {
    position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 2710;
    display: none; flex-direction: column;
    background: #b8a896; font-family: -apple-system, "PingFang SC", sans-serif;
}
/* 须与上一选择器同权重，否则 cs-open 无法覆盖 display:none */
#app #wechat-char-schedule-host.cs-open {
    display: flex;
}

/* 顶栏：保留微信导航条本色，避免与原模块冲突 */
.cs-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 52px; padding: 0 12px;
    background: #ede4d3; border-bottom: 1px solid #cdbfa8; flex-shrink: 0;
}
.cs-topbar-title {
    font-size: 16px; font-weight: 600; color: #4a3f2f;
    flex: 1; text-align: center; letter-spacing: 1px;
}
.cs-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cs-topbar-btn {
    background: none; border: none; cursor: pointer;
    padding: 6px; color: #6b5a44; font-size: 20px; line-height: 1;
}

/* ============= 周视图：台历风格 ============= */
#cs-week-view {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
    background: #b8a896;
    padding: 14px 12px 16px;
    box-sizing: border-box;
}

/* 周导航：上下翻周（手写风字体） */
.cs-week-nav {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    padding: 6px 4px 10px; background: transparent; flex-shrink: 0;
}
.cs-week-nav-btn {
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: #f5efe2; padding: 4px 10px;
    font-family: "Caveat", "Comic Sans MS", "楷体", cursive;
    letter-spacing: 0.5px;
}
.cs-week-nav-btn:hover { color: #fff; }
.cs-week-label {
    font-size: 13px; color: #f5efe2; font-weight: 500;
    font-family: "Caveat", "Comic Sans MS", "楷体", cursive;
    letter-spacing: 1px;
}

/* 英文星期表头 */
.cs-week-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #a9b89a;
    border-radius: 14px 14px 0 0;
    padding: 10px 14px 0;
    flex-shrink: 0;
    margin: 0 0 0 0;
}
.cs-header-cell {
    text-align: center;
    font-size: 11px;
    font-family: "Caveat", "Comic Sans MS", cursive;
    color: #f5efe2;
    letter-spacing: 1px;
    padding: 4px 0 6px;
    font-weight: 600;
}

/* 台历主体：绿色边框 + 米白纸 */
.cs-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    column-gap: 0;
    row-gap: 0;
    padding: 0 14px 16px;
    overflow-y: auto;
    flex: 1;
    background: #a9b89a;
    border-radius: 0 0 18px 18px;
    box-shadow:
        inset 0 0 0 1px #95a585,
        0 6px 14px rgba(0,0,0,.18);
    position: relative;
}

/* 连日拖选进行中：抑浏览器把垂直滑动抢成滚动/取消 pointer（真机长按扩选必备） */
#cs-week-grid.cs-trip-range-dragging {
    touch-action: none;
    overscroll-behavior: contain;
}

/* 真机触摸刚 down 时即按住 touch-action: none，避免浏览器把抖动当成滚动而吞掉后续 pointer 流（导致长按超时未触发或拖到下一日失败） */
#cs-week-grid.cs-trip-grid-pending-press {
    touch-action: none;
    overscroll-behavior: contain;
}

/* 每个格子（月历单元格）*/
.cs-day-cell {
    display: flex; flex-direction: column; align-items: center;
    background: #f7f0df;
    border: none;
    border-right: 1px solid #d8c9a8;
    border-bottom: 1px solid #d8c9a8;
    border-radius: 0;
    padding: 4px 2px;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
    min-height: 44px;
    overflow: hidden;
    /* 关键：真机上若使用 manipulation，浏览器会把指头微抖判为滚动并取消触摸——长按计时还没到就被吃掉。
       这里直接禁用所有原生手势，台历本身能完全显示无需在格内滑动；真要滚动可在外层做。 */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.cs-day-cell:hover { background: #fbf6e8; }
/* 每行最后一格去掉右边框 */
.cs-day-cell:nth-child(7n) { border-right: none; }
/* 最后一行去掉底边框 */
.cs-day-cell:nth-last-child(-n+7) { border-bottom: none; }

/* 日期数字 */
.cs-day-num {
    font-size: 13px;
    color: #6b5a44;
    font-weight: 600;
    font-family: "Caveat", "Comic Sans MS", "楷体", cursive;
    line-height: 1.4;
}

/* 非本月日期置灰 */
.cs-day-cell.cs-other-month { background: #ede6d4; }
.cs-day-cell.cs-other-month .cs-day-num { color: #bfb09a; }

/* 今日高亮 */
.cs-day-cell.cs-today { background: #fff7d6; }
.cs-day-cell.cs-today .cs-day-num { color: #b07a1a; font-weight: 700; }

/* 事件指示：把原"圆点"改为底部彩色小条（保留 cs-hidden 逻辑） */
.cs-day-dot {
    width: auto; height: 6px;
    border-radius: 3px;
    background: #c9b07a;
    margin: auto 10px 10px;          /* 推到底部 */
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.cs-day-cell:nth-child(7n+1) .cs-day-dot { background: #e7a3a3; }
.cs-day-cell:nth-child(7n+2) .cs-day-dot { background: #c8b6dc; }
.cs-day-cell:nth-child(7n+3) .cs-day-dot { background: #f0b97a; }
.cs-day-cell:nth-child(7n+4) .cs-day-dot { background: #b6d2a7; }
.cs-day-cell:nth-child(7n+5) .cs-day-dot { background: #f0d27a; }
.cs-day-cell:nth-child(7n+6) .cs-day-dot { background: #a7c8d2; }
.cs-day-cell:nth-child(7n+7) .cs-day-dot { background: #d2a7b9; }
.cs-day-dot.cs-hidden { visibility: hidden; }

/* ============= 日程详情页 ============= */
#cs-detail-view { display: none; flex-direction: column; flex: 1; overflow: hidden; background: #f0edf8; }
#cs-detail-view.cs-open { display: flex; }

.cs-detail-topbar {
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 12px;
    background: #ede4d3; border-bottom: 1px solid #cdbfa8; flex-shrink: 0;
}
.cs-detail-back {
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: #6b5a44; padding: 4px;
}
.cs-detail-date { font-size: 15px; font-weight: 600; color: #4a3f2f; flex: 1; }
.cs-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    background: none; border: 1px solid #8aa07a; border-radius: 16px;
    color: #5d7a4a; font-size: 12px; padding: 4px 10px; cursor: pointer;
    min-width: 4.25rem;
    box-sizing: border-box;
}
.cs-refresh-btn:disabled { opacity: .5; cursor: default; }
/* 加载中：保留可辨别的动效，不靠全屏遮罩 */
.cs-refresh-btn.cs-refresh-btn--loading:disabled {
    opacity: 1;
    cursor: wait;
}

/* 「刷新」进行中：仅三点（替代整段标签） */
.cs-refresh-btn--loading {
    min-width: 4.25rem;
}
.cs-refresh-btn .cs-refresh-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-left: 0;
}
.cs-refresh-btn .cs-refresh-dots > span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: cs-schedule-refresh-dot 0.95s infinite ease-in-out both;
}
.cs-refresh-btn--loading .cs-refresh-dots > span {
    width: 5px;
    height: 5px;
}
.cs-refresh-btn .cs-refresh-dots > span:nth-child(2) { animation-delay: 0.12s; }
.cs-refresh-btn .cs-refresh-dots > span:nth-child(3) { animation-delay: 0.24s; }
@keyframes cs-schedule-refresh-dot {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.cs-detail-body { display: flex; flex: 1; overflow: hidden; }

/* 时间表：可爱紫色计划表风格（滚动条隐形，仍可触控/滚轮滚动） */
.cs-timeline {
    width: 55%; overflow-y: auto; border-right: 1px solid #ddd8f0;
    padding: 10px 8px; background: #f5f2fc;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cs-timeline::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.cs-time-slot {
    display: flex; align-items: center; padding: 5px 6px;
    border-bottom: 1px dashed #d8d0f0; cursor: pointer; gap: 8px;
    transition: background .12s;
}
.cs-time-slot:hover { background: #ede8f8; }
.cs-time-label {
    font-size: 11px; color: #fff; width: 42px; flex-shrink: 0;
    background: #b0a8d8; border-radius: 10px;
    text-align: center; padding: 2px 0; font-weight: 600;
    letter-spacing: 0.3px;
}
/* 含结束时间的区间徽章：纵向叠两行，避免横向变得太宽挤压正文宽度 */
.cs-time-label.cs-time-label--range {
    display: flex; flex-direction: column; align-items: center;
    gap: 1px; padding: 3px 0; line-height: 1.05;
}
.cs-time-label.cs-time-label--range .cs-time-start { font-size: 11px; }
.cs-time-label.cs-time-label--range .cs-time-end {
    font-size: 9.5px; opacity: .85;
    border-top: 1px solid rgba(255,255,255,.5);
    width: 60%; padding-top: 1px;
}
.cs-time-label.cs-time-label--range .cs-time-end::before {
    content: '~';
    margin-right: 1px;
    opacity: .85;
}
.cs-time-content {
    flex: 1; font-size: 12px; color: #4a4060;
    min-height: 18px; word-break: break-all; line-height: 1.5;
}
.cs-time-content.cs-empty { color: #c0b8d8; font-style: italic; font-size: 11px; }

.cs-right-panel { width: 45%; display: flex; flex-direction: column; overflow: hidden; }
.cs-map-area {
    height: 45%; border-bottom: 1px solid rgba(101, 85, 63, .14);
    background:
        linear-gradient(180deg, rgba(255,255,255,.48), rgba(244,236,221,.2)),
        #fffdf8;
    position: relative; overflow: hidden; flex-shrink: 0;
}
.cs-map-area::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 14% 18%, rgba(216, 151, 102, .14) 0 1px, transparent 1.5px),
        radial-gradient(circle at 78% 68%, rgba(108, 146, 129, .12) 0 1px, transparent 1.5px);
    background-size: 18px 18px, 24px 24px;
    pointer-events: none;
}
.cs-map-title {
    position: absolute; top: 7px; left: 8px; font-size: 10.5px; color: #433432;
    background: rgba(255,253,248,.9); padding: 3px 7px; border-radius: 999px;
    z-index: 2;
    border: 1px solid rgba(67, 52, 50, .13);
    box-shadow: 0 2px 7px rgba(61, 45, 31, .08);
}
.cs-map-hint { font-size: 9.5px; color: #71926f; margin-left: 4px; }
.cs-map-svg { width: 100%; height: 100%; display: block; }

/* 便签：随手贴风格 */
.cs-note-area {
    flex: 1; display: flex; flex-direction: column;
    padding: 8px; overflow: hidden;
    background: #f5f2fc;
}
.cs-note-title {
    font-size: 11px; color: #9888c8; margin-bottom: 6px; flex-shrink: 0;
    font-weight: 600; letter-spacing: 0.5px;
}
.cs-note-text {
    flex: 1; font-size: 12px; color: #4a4060; line-height: 1.7;
    overflow-y: auto; white-space: pre-wrap; word-break: break-all;
    background: #fffde8;
    border-radius: 2px 8px 8px 8px;
    padding: 8px 10px;
    border: none;
    box-shadow:
        2px 2px 0 #e8e0a0,
        3px 3px 6px rgba(0,0,0,.10);
    position: relative;
}
.cs-note-text::before {
    content: '';
    position: absolute; top: -6px; left: 10px;
    width: 28px; height: 8px;
    background: #f0d060;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.cs-note-text.cs-empty { color: #c8c0a0; font-style: italic; }

/* 编辑弹窗 */
.cs-edit-overlay {
    position: absolute; inset: 0; z-index: 3200;
    background: rgba(0,0,0,.45); display: flex;
    align-items: center; justify-content: center;
}
.cs-edit-sheet {
    width: 88%; max-width: 300px;
    background: #fff; border-radius: 14px;
    padding: 16px; box-sizing: border-box;
}
.cs-edit-sheet h4 { margin: 0 0 10px; font-size: 15px; color: #111; }
.cs-edit-sheet textarea {
    width: 100%; height: 90px; border: 1px solid #ddd; border-radius: 8px;
    padding: 8px; font-size: 14px; resize: none; box-sizing: border-box; font-family: inherit;
}
.cs-edit-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.cs-edit-actions button { padding: 7px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; }
.cs-edit-save { background: #8aa07a; color: #fff; }
.cs-edit-cancel { background: #f0f0f0; color: #555; }

/* 设置面板 */
.cs-settings-overlay {
    position: absolute; inset: 0; z-index: 3200;
    background: rgba(0,0,0,.45); display: flex;
    align-items: center; justify-content: center;
}
.cs-settings-sheet {
    width: 88%; max-width: 320px; max-height: 80%;
    overflow-y: auto;
    background: #fff; border-radius: 16px;
    padding: 16px 16px 20px; box-sizing: border-box;
}
.cs-settings-sheet h3 { margin: 0 0 14px; font-size: 16px; color: #111; }
.cs-settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid #f0f0f0;
}
.cs-settings-row:last-of-type { border-bottom: none; }
.cs-settings-label { font-size: 14px; color: #333; }
.cs-settings-sub { font-size: 12px; color: #999; margin-top: 2px; }

.cs-toggle { position: relative; width: 44px; height: 24px; }
.cs-toggle input { opacity: 0; width: 0; height: 0; }
.cs-toggle-slider {
    position: absolute; inset: 0; background: #ccc; border-radius: 24px;
    cursor: pointer; transition: background .2s;
}
.cs-toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s;
}
.cs-toggle input:checked + .cs-toggle-slider { background: #8aa07a; }
.cs-toggle input:checked + .cs-toggle-slider::before { transform: translateX(20px); }

.cs-time-input {
    border: 1px solid #ddd; border-radius: 8px; padding: 5px 10px;
    font-size: 14px; width: 90px; text-align: center;
}
.cs-settings-close {
    width: 100%; margin-top: 14px; padding: 11px;
    background: #8aa07a; color: #fff; border: none; border-radius: 10px;
    font-size: 15px; cursor: pointer;
}

/* 小地图包装器 */
.cs-map-mini-wrapper {
    width: calc(100% - 14px); height: calc(100% - 36px);
    margin: 30px 7px 6px;
    cursor: pointer; position: relative;
    border-radius: 13px;
    overflow: hidden;
    background: #fffdf8;
    box-shadow:
        inset 0 0 0 1px rgba(63, 49, 42, .08),
        0 4px 12px rgba(80, 62, 41, .08);
}
.cs-map-mini-wrapper:hover::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(255,255,255,.18); border-radius: 13px;
    pointer-events: none;
}
.cs-map-hint {
    font-size: 9.5px; color: #71926f; margin-left: 4px;
}

/* 大地图覆盖层 */
.cs-large-map-overlay {
    position: absolute; inset: 0; z-index: 4000;
    background: rgba(30,23,20,.54);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.cs-large-map-inner {
    position: relative;
    /* 与手机屏幕等宽等高 */
    width: 100%; height: 100%;
    background: #fffdf8;
    overflow: hidden;
}
.cs-large-map-svg {
    width: 100%; height: 100%;
    display: block;
}
.cs-large-map-close {
    position: absolute; top: 10px; right: 12px; z-index: 10;
    background: rgba(255,253,248,.92); border: 1px solid rgba(63, 49, 42, .12); border-radius: 50%;
    width: 28px; height: 28px; font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #5a4030; box-shadow: 0 3px 10px rgba(0,0,0,.18);
}

.cs-map-area.cs-map-area--trip-away::before {
    opacity: 0.35;
}
.cs-map-area.cs-map-area--trip-away .cs-map-title {
    max-width: calc(100% - 86px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-virtual-map-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    max-width: 58%;
    pointer-events: auto;
}
.cs-virtual-map-btn {
    appearance: none;
    border: 1px solid rgba(67, 52, 50, .2);
    background: rgba(255,253,248,.94);
    color: #4a3933;
    font-size: 9px;
    font-weight: 600;
    padding: 4px 7px;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.1;
    box-shadow: 0 1px 4px rgba(61, 45, 31, .1);
}
.cs-virtual-map-btn:active { transform: scale(0.97); }
.cs-virtual-map-btn--ghost {
    background: transparent;
    color: #7a665c;
    font-weight: 500;
}

/* 加载遮罩 */
.cs-loading-mask {
    position: absolute; inset: 0; background: rgba(255,255,255,.75);
    display: flex; align-items: center; justify-content: center; z-index: 10;
}
.cs-spinner {
    width: 28px; height: 28px; border: 3px solid #e0e0e0;
    border-top-color: #8aa07a; border-radius: 50%;
    animation: cs-spin .7s linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }

/* ===== 日行程顶栏右侧按钮组 ===== */
.cs-detail-topbar-right {
    display: flex; align-items: center; gap: 6px;
}
.cs-add-slot-btn {
    background: none; border: none; font-size: 22px; color: #07c160;
    cursor: pointer; padding: 0 4px; line-height: 1;
}

/* ===== 长按多选高亮 ===== */
.cs-day-cell.cs-drag-selected {
    background: rgba(7, 193, 96, 0.18) !important;
    outline: 2px solid #07c160;
}

/* ===== 出差/旅行角标 ===== */
.cs-day-trip {
    position: absolute; top: 2px; right: 2px;
    font-size: 9px; font-weight: 700; border-radius: 3px;
    padding: 0 2px; line-height: 14px;
}
.cs-day-trip--business { background: #ff7043; color: #fff; }
.cs-day-trip--travel   { background: #7c6af7; color: #fff; }
.cs-day-cell { position: relative; }
.cs-day-trip--work     { background: #4a90d9; color: #fff; }
.wechat-char-trip-badge {
    display: inline-block; margin-left: 6px;
    font-size: 11px; color: #ff7043; font-weight: normal;
    vertical-align: middle;
}
