/* 弹窗样式文件 - 完整版 */

/* 全局密码弹窗样式 */
.password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.password-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 420px; /* 保持420px，与公告弹窗接近 */
    width: 90%;
    max-height: 70vh; /* 限制最大高度 */
    overflow-y: auto; /* 内容过多时显示滚动条 */
    position: relative;
    animation: modalShow 0.3s ease;
    margin: 30px auto; /* 增加上下边距 */
}

.password-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.password-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}

.password-modal-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.password-modal-body {
    padding: 16px;
    max-height: calc(70vh - 130px); /* 计算可用高度 */
    overflow-y: auto;
}

.password-instruction {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    max-height: 120px; /* 限制说明高度 */
    overflow-y: auto;
}

.password-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 12px;
    transition: border-color 0.3s;
    box-sizing: border-box; /* 确保padding不影响宽度 */
}

.password-input:focus {
    outline: none;
    border-color: #4e54c8;
}

.password-error {
    color: #ff4757;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.password-modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 1;
}

/* 独立密码弹窗样式 */
.individual-password-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.individual-password-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 420px; /* 缩小宽度 */
    width: 90%;
    max-height: 70vh; /* 限制最大高度 */
    overflow-y: auto; /* 内容过多时显示滚动条 */
    position: relative;
    animation: modalShow 0.3s ease;
    margin: 30px auto; /* 增加上下边距 */
}

.individual-password-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.individual-password-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}

.individual-password-modal-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.individual-password-modal-body {
    padding: 16px;
    max-height: calc(70vh - 130px); /* 计算可用高度 */
    overflow-y: auto;
}

.individual-password-instruction {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    max-height: 120px; /* 限制说明高度 */
    overflow-y: auto;
}

.individual-password-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 12px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.individual-password-input:focus {
    outline: none;
    border-color: #4e54c8;
}

.individual-password-error {
    color: #ff4757;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.individual-password-modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: white;
    z-index: 1;
}

/* 应用弹窗样式 */
.app-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.app-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px; /* 稍微放大一点，比公告弹窗稍大 */
    width: 90%;
    max-height: 75vh; /* 限制最大高度为视口的75% */
    overflow: hidden;
    position: relative;
    animation: modalShow 0.3s ease;
    display: flex;
    flex-direction: column;
    margin: 30px auto; /* 增加上下边距 */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

@keyframes modalShow {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.app-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.app-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.app-modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.app-modal-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(75vh - 140px); /* 计算主体内容的最大高度 */
}

.app-modal-image {
    width: 100%;
    max-height: 200px; /* 限制图片最大高度 */
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
    display: block;
}

.app-modal-description {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 200px; /* 限制描述文本最大高度 */
    overflow-y: auto; /* 内容过多时显示滚动条 */
}

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    background: #5a6fd8;
}

.copy-btn.copied {
    background: #2ed573;
}

.app-modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    background: white;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.app-modal-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    white-space: nowrap;
}

.app-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.app-btn-cancel:hover {
    background: #eee;
}

.app-btn-confirm {
    background: #4e54c8;
    color: white;
}

.app-btn-confirm:hover {
    background: #3f43a8;
    transform: translateY(-1px);
}

.app-btn-backup {
    background: #667eea;
    color: white;
}

.app-btn-backup:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

/* 微信弹窗样式 */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    max-width: 320px; /* 缩小宽度 */
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
    animation: modalShow 0.3s ease;
    margin: 30px auto;
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.modal-header i {
    color: #07C160;
    font-size: 22px;
    margin-right: 8px;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.modal-body {
    margin-bottom: 16px;
    max-height: calc(70vh - 160px);
    overflow-y: auto;
}

.modal-body p {
    margin: 0;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-btn {
    padding: 7px 16px;
    border-radius: 18px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-cancel:hover {
    background: #eee;
}

.btn-primary {
    background: #07C160;
    color: white;
}

.btn-primary:hover {
    background: #06b058;
    transform: translateY(-1px);
}

.wechat-id {
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-family: monospace;
    font-size: 15px;
    color: #333;
    text-align: center;
}

/* 客服弹窗样式 */
.service-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.service-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 380px; /* 缩小宽度 */
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
    animation: modalShow 0.3s ease;
    margin: 30px auto;
}

.service-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.service-modal-header i {
    color: #667eea;
    font-size: 22px;
}

.service-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    flex: 1;
}

.service-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-close:hover {
    color: #333;
}

.service-modal-body {
    padding: 16px;
    max-height: calc(70vh - 160px);
    overflow-y: auto;
}

.service-qr-code {
    text-align: center;
    margin-bottom: 16px;
}

.service-qr-code img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.service-id-section {
    text-align: center;
    margin-bottom: 16px;
}

.service-id-section p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 14px;
}

.service-id {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 15px;
    color: #333;
    margin-bottom: 12px;
    word-break: break-all;
}

.service-notes {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.service-notes p {
    margin: 0;
    white-space: pre-wrap;
}

.service-modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.service-btn {
    padding: 8px 16px;
    border-radius: 18px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.service-btn.secondary {
    background: #f5f5f5;
    color: #666;
}

.service-btn.secondary:hover {
    background: #eee;
}

.service-btn.primary {
    background: #07C160;
    color: white;
}

.service-btn.primary:hover {
    background: #06b058;
    transform: translateY(-1px);
}

/* 聊天弹窗样式 */
.chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.chat-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 380px;
    width: 90%;
    height: 70vh; /* 限制高度为视口的70% */
    display: flex;
    flex-direction: column;
    position: relative;
    animation: modalShow 0.3s ease;
    margin: 30px auto;
}

.chat-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}

.chat-modal-header i {
    color: #667eea;
    font-size: 22px;
}

.chat-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    flex: 1;
}

.chat-modal-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-modal-footer {
    padding: 12px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 18px;
    outline: none;
    font-size: 14px;
}

.chat-send-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-upload-container {
    display: flex;
    justify-content: center;
}

.chat-upload {
    display: none;
}

.chat-upload-label {
    background: #f5f5f5;
    color: #666;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-upload-label:hover {
    background: #eee;
}

/* 聊天消息样式 */
.chat-message {
    display: flex;
    margin-bottom: 12px;
}

.user-message {
    justify-content: flex-end;
}

.system-message {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
}

.user-message .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.system-message .message-bubble {
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-text {
    word-wrap: break-word;
    font-size: 14px;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.message-image img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 6px;
}

/* 公告弹窗样式 - 参考应用弹窗样式 */
.announcement-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.announcement-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    animation: modalShow 0.3s ease;
    display: flex;
    flex-direction: column;
    margin: 30px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.announcement-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.announcement-modal-header i {
    color: #4e54c8;
    font-size: 22px;
}

.announcement-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    flex: 1;
}

.announcement-close {
    background: #f5f5f5;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.announcement-close:hover {
    background: #eee;
    color: #333;
    transform: rotate(90deg);
}

.announcement-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(85vh - 150px); /* 计算主体内容的最大高度 */
}

.announcement-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.announcement-image {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
    display: block;
}

.announcement-content {
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 14px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 300px; /* 限制内容最大高度 */
    overflow-y: auto; /* 内容过多时显示滚动条 */
}

.announcement-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.announcement-modal-footer .form-check {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.announcement-modal-footer .form-check-input {
    margin-top: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.announcement-modal-footer .form-check-input:checked {
    background-color: #4e54c8;
    border-color: #4e54c8;
}

.announcement-modal-footer .form-check-label {
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.announcement-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    white-space: nowrap;
    font-weight: 500;
}

.announcement-btn.btn-primary {
    background: #4e54c8;
    color: white;
}

.announcement-btn.btn-primary:hover {
    background: #3f43a8;
    transform: translateY(-1px);
}

/* 响应式调整 */
@media (max-width: 768px) {
    /* 所有弹窗在移动端的调整 */
    .app-modal-content,
    .password-modal-content,
    .individual-password-modal-content,
    .modal-content,
    .service-modal-content,
    .chat-modal-content,
    .announcement-modal-content {
        max-width: 95%;
        margin: 20px auto;
        max-height: 85vh;
    }
    
    .app-modal-footer {
        flex-wrap: wrap;
    }
    
    .app-modal-btn {
        flex: 1;
        min-width: auto;
    }
    
    .announcement-modal-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .announcement-modal-footer .form-check {
        align-self: flex-start;
    }
    
    .announcement-btn {
        width: 100%;
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    /* 小屏幕手机的特殊调整 */
    .app-modal-content,
    .password-modal-content,
    .individual-password-modal-content,
    .modal-content,
    .service-modal-content,
    .chat-modal-content,
    .announcement-modal-content {
        max-width: 98%;
        margin: 10px auto;
        max-height: 90vh;
    }
    
    .app-modal-header,
    .password-modal-header,
    .individual-password-modal-header,
    .announcement-modal-header {
        padding: 12px;
    }
    
    .app-modal-body,
    .password-modal-body,
    .individual-password-modal-body,
    .announcement-modal-body {
        padding: 12px;
    }
    
    .app-modal-footer,
    .password-modal-footer,
    .individual-password-modal-footer,
    .announcement-modal-footer {
        padding: 12px;
    }
}