/* ========== 角色输入弹窗样式（命名空间 character-input-modal-） ========== */


.character-input-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 98;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}
.character-input-modal-container {
    width: 90%;
    max-width: 450px;
    max-height: 85vh;
    background: var(--bg-color);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s;
}
@media (max-width: 550px) {
    .character-input-modal-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}
.character-input-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    border: 0.5px solid rgba(255,255,255,0.2);
}
.character-input-modal-close i {
    font-size: 14px;
    color: var(--text-color-8);
}
.character-input-modal-close:hover {
    background: var(--text-color-1);
}
.character-input-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 28px;
    scrollbar-width: thin;
}
.character-input-modal-form-group {
    margin-bottom: 28px;
}
.character-input-modal-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}
/* 头像区域 */
.character-input-modal-avatar-section {
    position: relative;
    margin-bottom: 32px;
    padding-top: 12px;
}
.character-input-modal-avatar-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}
.character-input-modal-avatar-backdrop {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-size: cover;
    background-position: center 30%;
    background-repeat: no-repeat;
    filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0 0 60px 60px;
    pointer-events: none;
    z-index: 0;
}
.character-input-modal-avatar-backdrop.has-backdrop {
    opacity: 0.7;
}
.character-input-modal-avatar-backdrop::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 100%);
    pointer-events: none;
    border-radius: inherit;
}
.character-input-modal-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a2e, #1a1a1e);
    border: 3px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
}
.character-input-modal-avatar:hover {
    border-color: rgba(122, 65, 219, 0.6);
    transform: scale(1.02);
}
.character-input-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.character-input-modal-avatar-placeholder {
    font-size: 52px;
    color: rgba(255, 255, 255, 0.3);
}

.character-input-modal-avatar-capsule {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 35, 0.9);
    backdrop-filter: blur(12px);
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    border: 0.5px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    pointer-events: none;
    z-index: 3;
    letter-spacing: -0.2px;
}
.character-input-modal-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    outline: none;
    transition: all 0.2s;
}
.character-input-modal-field:focus {
    border-color: #7a41db;
    background: rgba(255, 255, 255, 0.08);
}
.character-input-modal-field.error {
    border-color: #e76262;
}
.character-input-modal-error-msg {
    font-size: 12px;
    color: #e76262;
    margin-top: 6px;
    /*padding-left: 14px;*/
    display: none;
}
.character-input-modal-gender-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.character-input-modal-gender-option {
    flex: 1;
    min-width: 80px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-color-6);
}
.character-input-modal-gender-option i {
    font-size: 16px;
    color: inherit;
}
.character-input-modal-gender-option span {
    font-size: 14px;
    font-weight: 500;
    color: inherit;
}



.character-input-modal-gender-option.selected.male {
    border-color: var(--male-color);
    background: rgba(41, 128, 185, 0.1);
    color: var(--male-color);
}

.character-input-modal-gender-option.selected.female {
    border-color: var(--female-color);
    background: rgba(255, 192, 203, 0.1);
    color: var(--female-color);
}

.character-input-modal-gender-option.selected.none {
    border-color: var(--text-color-8);
    background: var(--text-color-1);
    color: var(--text-color-8);
}



.character-input-modal-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 400;
    color: #ffffff;
    outline: none;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    min-height: 120px;
}
.character-input-modal-textarea:focus {
    border-color: #7a41db;
    background: rgba(255, 255, 255, 0.08);
}
.character-input-modal-word-count {
    text-align: right;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
}
.character-input-modal-word-count.warning {
    color: #e76262;
}
/* 声音选择器 */
.character-input-modal-voice-selector {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.character-input-modal-voice-selector:hover {
    background: var(--text-color-1);
}

.character-input-modal-voice-selector.no-voice .character-input-modal-voice-name{
    opacity: 0.5;
}

.character-input-modal-voice-selector.no-voice .character-input-modal-waveform{
    opacity: 0.5;
}

.character-input-modal-voice-selector.has-error {
    border-color: #e76262;
}
.voice-selector-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.voice-selector-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 0 12px 18px;
    cursor: pointer;
    width: fit-content;
}
.voice-selector-arrow {
    padding: 12px 18px;
    cursor: pointer;
    /*color: rgba(255, 255, 255, 0.4);*/
    font-size: 14px;
    flex-shrink: 0;
}

.voice-selector-arrow  i {
    font-size: 12px;
}

.character-input-modal-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16px;
}
.character-input-modal-wave-bar {
    background-color: white;
    width: 2px;
    margin: 0 1px;
    border-radius: 2px;
    height: 100%;
    transition: height 0.2s ease;
}
.character-input-modal-wave-bar:nth-child(1) { height: 30%; }
.character-input-modal-wave-bar:nth-child(2) { height: 70%; }
.character-input-modal-wave-bar:nth-child(3) { height: 50%; }
.character-input-modal-wave-bar:nth-child(4) { height: 90%; }
.character-input-modal-wave-bar:nth-child(5) { height: 40%; }


.character-input-modal-waveform.playing .character-input-modal-wave-bar {
    animation: wave 1s infinite ease-in-out;
}

.character-input-modal-waveform.playing .character-input-modal-wave-bar:nth-child(1) {
    animation-delay: 0s;
}

.character-input-modal-waveform.playing .character-input-modal-wave-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.character-input-modal-waveform.playing .character-input-modal-wave-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.character-input-modal-waveform.playing .character-input-modal-wave-bar:nth-child(4) {
    animation-delay: 0.3s;
}

.character-input-modal-waveform.playing .character-input-modal-wave-bar:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1);
    }
}

.character-input-modal-voice-name-gender {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.character-input-modal-voice-name {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}


.character-input-modal-footer {
    padding: 20px 24px 28px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-color);
}
.character-input-modal-submit {
    width: 100%;
    background: var(--primary-btn-bg);
    border: none;
    border-radius: 60px;
    padding: 14px 0;
    font-weight: 600;
    font-size: 17px;
    color: var(--primary-btn-text-color);
    cursor: pointer;
    transition: all 0.2s;
}
.character-input-modal-submit:hover {
    background: #936df5;
    transform: scale(0.98);
}

.character-input-modal-submit.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.character-input-modal-submit.disabled:hover {
    background: var(--primary-btn-bg);
}

.character-input-modal-delete {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 60px;
    padding: 12px 0;
    margin-top: 12px;
    font-weight: 500;
    font-size: 15px;
    color: #e76262;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.character-input-modal-delete:hover {
    background: rgba(231, 98, 98, 0.08);
}
/* 确认气泡 */
.confirm-bubble {
    position: fixed;
    background: rgba(30, 30, 35, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 20px;
    width: 260px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.1);
    z-index: 10010;
    text-align: center;
    transform-origin: center top;
    animation: bubbleSlideUp 0.2s ease-out;
}
@keyframes bubbleSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.confirm-bubble p {
    color: white;
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 500;
}
.bubble-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.bubble-cancel, .bubble-confirm {
    flex: 1;
    padding: 10px 0;
    border-radius: 40px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    text-align: center;
}
.bubble-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.bubble-confirm {
    background: #e76262;
    color: white;
}
@media (max-width: 550px) {
    .confirm-bubble { width: 240px; padding: 18px; }
}
/* 裁剪弹窗 */
.character-crop-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    z-index: 10020;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
}
.character-crop-container {
    width: 90%;
    max-width: 500px;
    background: #1c1c1e;
    border-radius: 32px;
    overflow: hidden;
}
.character-crop-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.character-crop-header h3 { font-size: 18px; font-weight: 600; color: white; }
.character-crop-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.character-crop-body { padding: 20px; }
.character-crop-img-container {
    max-width: 100%;
    max-height: 50vh;
    margin-bottom: 20px;
    text-align: center;
}
.character-crop-img-container img { max-width: 100%; display: block; }
.character-crop-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.character-crop-btn {
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}
.character-crop-cancel { background: rgba(255,255,255,0.1); color: white; }
.character-crop-confirm { background: #7a41db; color: white; }