/* ===================== 通话个性化设置（语音设置 / 视频设置） =====================
 * 语音通话/视频通话面板挂在 #app 内、各 .page 外，z-index 高达 100145（见 voice-call.css /
 * 本文件 .video-call-global-root），普通 .modal 的默认 z-index:1000 会被它们盖住导致弹层
 * 打开了却看不见——.cp-modal 必须显式给到更高的 z-index。 */
.cp-modal {
    z-index: 100500;
}

.cp-settings-modal-content,
.cp-friend-list-modal-content,
.cp-ringtone-picker-modal-content {
    width: min(92vw, 400px);
    max-width: 400px;
    max-height: min(80vh, 560px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部固定；body 吃掉剩余高度，内部列表才能真正滚动 */
.cp-settings-modal-content > .wallet-modal-header,
.cp-friend-list-modal-content > .wallet-modal-header,
.cp-ringtone-picker-modal-content > .wallet-modal-header {
    flex-shrink: 0;
}

.cp-friend-list-modal-content > .wallet-modal-body,
.cp-ringtone-picker-modal-content > .wallet-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 12px;
    padding-bottom: 8px;
}

/* 主菜单（语音设置 / 视频设置）：标题居中，关闭钮贴右并与返回钮同款圆形风格 */
.cp-settings-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cp-settings-header h3 {
    margin: 0;
    padding: 0 40px;
    text-align: center;
}

.cp-friend-list-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cp-friend-list-header h3 {
    flex: 1;
    min-width: 0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 二级页去掉关闭钮后，右侧占位与左侧返回钮等宽，保证标题视觉居中 */
.cp-header-spacer {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    visibility: hidden;
    pointer-events: none;
}

.cp-back-btn,
.cp-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.12s ease;
}

.cp-back-btn:active,
.cp-close-btn:active {
    background: rgba(0, 0, 0, 0.12);
    transform: scale(0.94);
}

.cp-settings-header .cp-close-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.cp-settings-header .cp-close-btn:active {
    transform: translateY(-50%) scale(0.94);
}

html[data-appearance="dark"] .cp-back-btn,
html[data-appearance="dark"] .cp-close-btn {
    background: rgba(255, 255, 255, 0.1);
}

html[data-appearance="dark"] .cp-back-btn:active,
html[data-appearance="dark"] .cp-close-btn:active {
    background: rgba(255, 255, 255, 0.18);
}

.cp-friend-list-hint {
    flex-shrink: 0;
    font-size: 12.5px;
    opacity: 0.7;
    margin: 0 16px 8px;
    line-height: 1.5;
}

.cp-ringtone-picker-modal-content > .wallet-modal-body > .wallet-modal-hint {
    flex-shrink: 0;
}

/* 主菜单：来电铃声 / 来电背景 两行 */
.cp-menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
}

.cp-menu-row:last-child {
    border-bottom: none;
}

.cp-menu-row:active {
    background: rgba(0, 0, 0, 0.04);
}

.cp-menu-row-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffe6c9, #ffd1e0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #b3557a;
}

.cp-menu-row-icon svg {
    width: 18px;
    height: 18px;
}

.cp-menu-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-menu-row-title {
    font-size: 15px;
    font-weight: 600;
}

.cp-menu-row-sub {
    font-size: 12px;
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-menu-row-arrow {
    font-size: 20px;
    opacity: 0.35;
    flex-shrink: 0;
}

/* 来电背景警示语（1MB 提示），持续悬浮在好友列表顶部，不因滚动消失 */
.cp-bg-warning-banner {
    flex-shrink: 0;
    margin: 0 16px 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255, 149, 62, 0.12);
    border: 1px solid rgba(255, 149, 62, 0.35);
    color: #b5651d;
    font-size: 12.5px;
    line-height: 1.55;
}

html[data-appearance="dark"] .cp-bg-warning-banner {
    background: rgba(255, 149, 62, 0.16);
    border-color: rgba(255, 149, 62, 0.4);
    color: #ffb066;
}

/* 好友列表（来电铃声 / 来电背景 / 主动来电 二级页共用）：可滚动 + 隐形滚动条 */
.cp-friend-list {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cp-friend-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.cp-friend-empty {
    padding: 32px 8px;
    text-align: center;
    font-size: 13px;
    opacity: 0.55;
}

.cp-friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cp-friend-row:last-child {
    border-bottom: none;
}

.cp-friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f6c1d9, #f6a6c1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.cp-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cp-friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-friend-name {
    font-size: 14.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-friend-sub {
    font-size: 12px;
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-friend-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cp-friend-action-btn {
    border: none;
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 12.5px;
    font-weight: 500;
    background: linear-gradient(135deg, #ff9fb8, #ff7aa2);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.cp-friend-action-btn:active {
    transform: scale(0.96);
}

.cp-friend-clear-btn {
    border: none;
    background: none;
    color: #999;
    font-size: 12px;
    padding: 4px 4px;
    cursor: pointer;
    text-decoration: underline;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

/* 铃声选择表：可滚动 + 隐形滚动条 */
.cp-ring-list {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cp-ring-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.cp-ring-loading {
    padding: 24px 8px;
    text-align: center;
    font-size: 13px;
    opacity: 0.55;
}

.cp-ring-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 6px;
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cp-ring-row:active {
    background: rgba(0, 0, 0, 0.04);
}

.cp-ring-row.is-selected {
    background: rgba(255, 122, 162, 0.12);
}

.cp-ring-preview-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #ff7aa2;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.cp-ring-preview-btn.is-playing {
    background: #ff7aa2;
    color: #fff;
}

.cp-ring-preview-btn.is-disabled {
    opacity: 0.3;
    cursor: default;
}

.cp-ring-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cp-ring-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-ring-sub-text {
    font-size: 11.5px;
    opacity: 0.55;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-ring-check {
    color: #ff7aa2;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.cp-ring-delete-btn {
    border: none;
    background: none;
    color: #c65;
    font-size: 12px;
    padding: 4px 4px;
    cursor: pointer;
    text-decoration: underline;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.cp-ring-divider {
    margin: 10px 4px 4px;
    font-size: 11.5px;
    opacity: 0.5;
    letter-spacing: 0.05em;
}

.cp-ring-upload-btn {
    width: 100%;
    margin-top: 8px;
    padding: 11px 0;
    border: 1.5px dashed rgba(255, 122, 162, 0.55);
    border-radius: 12px;
    background: rgba(255, 122, 162, 0.06);
    color: #ff7aa2;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cp-ring-upload-btn:active {
    transform: scale(0.98);
}

@media (max-width: 360px) {
    .cp-friend-action-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 主动来电：好友行右侧的开关（复用全局 .toggle-switch/.toggle-slider） */
.cp-proactive-toggle {
    flex-shrink: 0;
}

/* 语音功能/视频功能选择弹层里的「语音设置/视频设置」入口按钮：与「取消」并排，样式区别于
   取消（灰白）与语音通话/分享屏幕（强调色），走中性可点击的浅色，避免抢主操作的视觉重心。 */
.cp-settings-entry-btn {
    border-right: 1px solid #e0e0e0;
    color: #4a7fb5;
    background: #eef6fb;
}

.cp-settings-entry-btn:hover {
    background: #e2eff8;
}

html[data-appearance="dark"] .cp-settings-entry-btn {
    background: rgba(74, 127, 181, 0.16);
    color: #8fc1ea;
    border-right-color: rgba(255, 255, 255, 0.08);
}

/* ===================== Char 主动来电（语音设置/视频设置 · 主动来电）通用来电全屏 =====================
 * 独立于闹钟叫醒的 ssc-incoming-overlay：由 call-proactive-scheduler.js 驱动，覆盖整个视口，
 * z-index 高于 .cp-modal（100500），确保任意页面/任意弹层下都能盖住振铃。 */
.cp-incoming-overlay {
    position: fixed;
    inset: 0;
    z-index: 100550;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(160deg, #23324a 0%, #2f5d8a 55%, #3f8fc0 100%);
    padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 56px) 24px calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 48px);
    box-sizing: border-box;
    text-align: center;
}

.cp-incoming-overlay.is-open {
    display: flex;
}

.cp-incoming-top {
    width: 100%;
}

.cp-incoming-label {
    font-size: 14px;
    letter-spacing: 2px;
    opacity: 0.8;
}

.cp-incoming-name {
    margin-top: 12px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 1px;
}

.cp-incoming-sub {
    margin-top: 8px;
    font-size: 14px;
    opacity: 0.78;
}

.cp-incoming-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cp-incoming-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.16);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
    animation: cp-incoming-pulse 1.8s ease-out infinite;
}

@keyframes cp-incoming-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.34); }
    70%  { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.cp-incoming-actions {
    width: 100%;
    max-width: 320px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.cp-incoming-act {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cp-incoming-act-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.cp-incoming-act-decline .cp-incoming-act-btn {
    background: #ff4b55;
}

.cp-incoming-act-accept .cp-incoming-act-btn {
    background: #2ecc71;
    animation: cp-incoming-accept-bounce 1.4s ease-in-out infinite;
}

@keyframes cp-incoming-accept-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.cp-incoming-act-label {
    font-size: 13px;
    opacity: 0.9;
}

@media (max-width: 380px) {
    .cp-incoming-avatar { width: 104px; height: 104px; font-size: 40px; }
    .cp-incoming-name { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    .cp-incoming-avatar,
    .cp-incoming-act-accept .cp-incoming-act-btn { animation: none; }
}

