/* ================================================
   Windows XP 风格弹窗 - 全新实现
   ================================================ */

/* 遮罩层 */
.xp-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.xp-modal-overlay.active {
    display: block;
}

/* 弹窗容器 */
.xp-modal-window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ece9d8;
    border: 3px solid;
    border-color: #0054e3 #0054e3 #0054e3 #0054e3;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    width: 400px;
    min-width: 0;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    z-index: 9999;
    font-family: Tahoma, "Microsoft YaHei", sans-serif;
}

.xp-modal-window.active {
    display: flex;
    flex-direction: column;
}

/* 标题栏 */
.xp-modal-titlebar {
    flex-shrink: 0;
    background: linear-gradient(180deg,
        #0a246a 0%, #0a246a 3%, #0f3c8c 6%, #18529c 10%,
        #1c5ea4 14%, #1e64a8 19%, #1e68ac 23%, #1e6cb0 28%,
        #1e6eb4 33%, #1e70b4 38%, #1e70b8 43%, #1e6eb4 48%,
        #1e6cb0 52%, #1e68ac 57%, #1e64a8 62%, #1c5ea4 67%,
        #18529c 72%, #1248a0 77%, #0a3c94 82%, #083490 87%,
        #042c88 92%, #002884 100%);
    color: #ffffff;
    padding: 3px 5px 3px 8px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    height: 28px;
    border-bottom: 1px solid #0a246a;
}

.xp-modal-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    color: #ffffff;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.xp-modal-title > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xp-modal-title-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="%23ffffff"/><circle cx="8" cy="8" r="4" fill="%231e70b8"/></svg>') center/contain no-repeat;
}

/* 关闭按钮 */
.xp-modal-close-btn {
    width: 21px;
    height: 21px;
    min-height: 21px;
    background: linear-gradient(180deg,
        #d86048 0%, #d86048 15%, #e06858 30%,
        #e87068 45%, #f07878 60%, #e06858 75%,
        #d86048 100%);
    border: 1px solid #5d0000;
    border-radius: 2px;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    line-height: 19px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.xp-modal-close-btn:hover {
    background: linear-gradient(180deg,
        #f07878 0%, #f08080 50%, #f88888 100%);
    border-color: #8d0000;
}

.xp-modal-close-btn:active {
    background: linear-gradient(180deg,
        #c05040 0%, #d06050 50%, #d86048 100%);
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 内容区 */
.xp-modal-body {
    padding: 15px;
    background: #ece9d8;
    color: #000000;
    font-size: 12px;
    max-height: 70vh;
    overflow-y: auto;
    min-height: 0;
    overflow-wrap: anywhere;
}

/* 底部按钮区 */
.xp-modal-footer {
    flex-shrink: 0;
    flex-wrap: wrap;
    padding: 10px 15px;
    background: #ece9d8;
    border-top: 1px solid #dfcedb;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 弹窗内的按钮 */
.xp-modal-footer .xp-btn,
.xp-modal-footer .btn {
    background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 50%, #e3e3e3 51%, #d8d8d8 100%);
    border: 1px solid #003c74;
    border-radius: 3px;
    color: #000000;
    font-size: 11px;
    font-family: Tahoma, sans-serif;
    font-weight: normal;
    padding: 4px 15px;
    min-width: 75px;
    height: 23px;
    line-height: 13px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 #ffffff;
}

.xp-modal-footer .xp-btn:hover,
.xp-modal-footer .btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 50%, #e9e9e9 51%, #e0e0e0 100%);
    border-color: #0055a4;
}

.xp-modal-footer .xp-btn:active,
.xp-modal-footer .btn:active {
    background: linear-gradient(180deg, #d8d8d8 0%, #e3e3e3 50%, #f0f0f0 51%, #ffffff 100%);
}

.xp-modal-footer .xp-btn-primary,
.xp-modal-footer .btn-primary {
    background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 50%, #e3e3e3 51%, #d8d8d8 100%);
    border: 2px solid #003c74;
    box-shadow: inset 0 1px 0 #ffffff, 0 0 0 1px #4080c0;
    font-weight: bold;
}

/* 弹窗内的表单元素 */
.xp-modal-body .form-control,
.xp-modal-body input[type="text"],
.xp-modal-body input[type="password"],
.xp-modal-body input[type="email"],
.xp-modal-body textarea,
.xp-modal-body select {
    background: #ffffff;
    border: 2px solid;
    border-color: #8f8680 #dfcedb #dfcedb #8f8680;
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    padding: 4px 6px;
    color: #000000;
    width: 100%;
    box-sizing: border-box;
}

.xp-modal-body .form-control:focus,
.xp-modal-body input:focus,
.xp-modal-body textarea:focus,
.xp-modal-body select:focus {
    outline: none;
    border-color: #0066cc #dfcedb #dfcedb #0066cc;
}

/* 列表组样式 */
.xp-modal-body .list-group-item {
    background: #ece9d8;
    border: 1px solid #dfcedb;
    padding: 10px;
    margin-bottom: 8px;
    color: #000000;
}

/* 输入组 */
.xp-modal-body .input-group {
    display: flex;
    align-items: stretch;
}

.xp-modal-body .input-group .form-control {
    flex: 1;
    min-width: 0;
    border-radius: 0;
}

.xp-modal-body .input-group-addon {
    background: linear-gradient(180deg, #e8e4d9 0%, #d4cfc1 100%);
    border: 2px solid;
    border-color: #dfcedb #8f8680 #8f8680 #dfcedb;
    padding: 4px 10px;
    font-size: 12px;
    color: #0066cc;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.xp-modal-body .input-group-addon:hover {
    background: linear-gradient(180deg, #f0f0f0 0%, #dfdfdf 100%);
    color: #0052a3;
}

/* 响应式 */
@media (max-width: 768px) {
    .xp-modal-window {
        max-width: calc(100vw - 24px);
        min-width: 0;
    }

    .xp-modal-body {
        max-height: 60vh;
    }
}

/* 动画效果 */
@keyframes xpModalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.xp-modal-window.active {
    animation: xpModalFadeIn 0.2s ease-out;
}

/* 确保文字颜色正确 */
.xp-modal-titlebar,
.xp-modal-titlebar * {
    color: #ffffff !important;
}

.xp-modal-body,
.xp-modal-body *:not(.btn):not(.xp-btn) {
    color: #000000 !important;
}

.xp-modal-footer .btn,
.xp-modal-footer .xp-btn {
    color: #000000 !important;
}
