/* ============================================
   量化交易系统 - 自定义弹窗样式
   美观的暗色主题设计，与系统整体风格一致
   ============================================ */

/* ---------- Toast 悬浮胶囊 ---------- */
/* 设计基准：提示悬浮胶囊UI.jpg —— 居中悬浮的柔和胶囊，
   大圆角 + 柔散阴影 + 加粗高对比文字，状态以小圆点表达 */
.toast-container {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast-container,
.toast-container * {
    box-sizing: border-box;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: 999px;
    background: rgba(18, 21, 27, 0.9);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5),
                0 4px 12px rgba(0, 0, 0, 0.25);
    animation: toastDropIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    max-width: calc(100vw - 32px);
}

.toast.hiding {
    animation: toastDropOut 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* 状态圆点 —— 取代原侧边色条与图标方块 */
.toast-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #4299e1;
    box-shadow: 0 0 6px rgba(66, 153, 225, 0.6);
}

.toast-success .toast-dot {
    background: #38b2ac;
    box-shadow: 0 0 6px rgba(56, 178, 172, 0.6);
}

.toast-error .toast-dot {
    background: #ff6b6b;
    box-shadow: 0 0 6px rgba(229, 62, 62, 0.6);
}

.toast-warning .toast-dot {
    background: #ed8936;
    box-shadow: 0 0 6px rgba(237, 137, 54, 0.6);
}

/* Toast 内容 */
.toast-content {
    min-width: 0;
    text-align: center;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(238, 241, 244, 0.72);
    line-height: 1.4;
    word-break: break-word;
}

.toast-title + .toast-message {
    margin-top: 3px;
}

.toast-message {
    font-size: 15px;
    font-weight: 700;
    color: #eef1f4;
    line-height: 1.5;
    word-break: break-word;
}

/* ---------- Modal 弹窗 ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
    border-radius: 24px;
    border: 1px solid rgba(74, 85, 104, 0.6);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

/* Modal 头部 */
.modal-header {
    padding: 24px 24px 0;
    text-align: center;
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
}

.modal-icon.success {
    background: linear-gradient(135deg, rgba(56, 178, 172, 0.2) 0%, rgba(56, 178, 172, 0.1) 100%);
    color: #38b2ac;
    box-shadow: 0 8px 32px rgba(56, 178, 172, 0.3);
}

.modal-icon.error {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.2) 0%, rgba(229, 62, 62, 0.1) 100%);
    color: #e53e3e;
    box-shadow: 0 8px 32px rgba(229, 62, 62, 0.3);
}

.modal-icon.warning {
    background: linear-gradient(135deg, rgba(237, 137, 54, 0.2) 0%, rgba(237, 137, 54, 0.1) 100%);
    color: #ed8936;
    box-shadow: 0 8px 32px rgba(237, 137, 54, 0.3);
}

.modal-icon.info {
    background: linear-gradient(135deg, rgba(66, 153, 225, 0.2) 0%, rgba(66, 153, 225, 0.1) 100%);
    color: #4299e1;
    box-shadow: 0 8px 32px rgba(66, 153, 225, 0.3);
}

.modal-icon.confirm {
    background: linear-gradient(135deg, rgba(159, 122, 234, 0.2) 0%, rgba(159, 122, 234, 0.1) 100%);
    color: #9f7aea;
    box-shadow: 0 8px 32px rgba(159, 122, 234, 0.3);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 8px;
}

/* Modal 内容 */
.modal-body {
    padding: 16px 24px 24px;
    text-align: center;
}

.modal-message {
    font-size: 15px;
    color: #a0aec0;
    line-height: 1.6;
    white-space: pre-line;
}

/* Modal 输入框 */
.modal-input-wrapper {
    margin-top: 16px;
    text-align: left;
}

.modal-input-label {
    display: block;
    font-size: 13px;
    color: #a0aec0;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #4a5568;
    border-radius: 12px;
    background: rgba(26, 32, 44, 0.8);
    color: #e2e8f0;
    font-size: 15px;
    transition: all 0.2s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #38b2ac;
    box-shadow: 0 0 0 3px rgba(56, 178, 172, 0.2);
}

.modal-input::placeholder {
    color: #718096;
}

/* Modal 底部按钮 */
.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(56, 178, 172, 0.4);
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 178, 172, 0.5);
}

.modal-btn-secondary {
    background: rgba(74, 85, 104, 0.6);
    color: #e2e8f0;
}

.modal-btn-secondary:hover {
    background: rgba(74, 85, 104, 0.8);
}

.modal-btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(229, 62, 62, 0.4);
}

.modal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.5);
}

/* ---------- 动画 ---------- */
@keyframes toastDropIn {
    from {
        transform: translateY(-18px) scale(0.9);
        opacity: 0;
        filter: blur(6px);
    }
    60% {
        filter: blur(0);
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes toastDropOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
    to {
        transform: translateY(-14px) scale(0.94);
        opacity: 0;
        filter: blur(4px);
    }
}

/* ---------- 响应式设计 ---------- */
@media (max-width: 480px) {
    .toast-container {
        top: 16px;
        max-width: calc(100vw - 24px);
    }

    .toast {
        padding: 12px 20px;
        max-width: calc(100vw - 24px);
    }

    .toast-message {
        font-size: 14px;
    }
    
    .modal {
        max-width: none;
        margin: 0 10px;
    }
    
    .modal-header {
        padding: 20px 20px 0;
    }
    
    .modal-body {
        padding: 12px 20px 20px;
    }
    
    .modal-footer {
        padding: 0 20px 20px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* ---------- 浅色主题适配 ---------- */
/* 浅色胶囊即设计基准图（提示悬浮胶囊UI.jpg）的原样呈现 */
body.light-theme .toast {
    background: rgba(250, 250, 252, 0.92);
    border-color: rgba(15, 18, 25, 0.04);
    box-shadow: 0 18px 44px -10px rgba(24, 32, 44, 0.18),
                0 4px 12px rgba(24, 32, 44, 0.08);
}

body.light-theme .toast-title {
    color: rgba(23, 26, 32, 0.55);
}

body.light-theme .toast-message {
    color: #17181c;
}

body.light-theme .toast-dot {
    background: #3182ce;
    box-shadow: none;
}

body.light-theme .toast-success .toast-dot {
    background: #319795;
}

body.light-theme .toast-error .toast-dot {
    background: #e53e3e;
}

body.light-theme .toast-warning .toast-dot {
    background: #dd6b20;
}

body.light-theme .modal {
    background: linear-gradient(145deg, #ffffff 0%, #f7fafc 100%);
    border-color: rgba(226, 232, 240, 0.8);
}

body.light-theme .modal-title {
    color: #2d3748;
}

body.light-theme .modal-message {
    color: #4a5568;
}

body.light-theme .modal-input {
    background: rgba(247, 250, 252, 0.8);
    border-color: #e2e8f0;
    color: #2d3748;
}

body.light-theme .modal-input:focus {
    border-color: #38b2ac;
    box-shadow: 0 0 0 3px rgba(56, 178, 172, 0.15);
}

body.light-theme .modal-btn-secondary {
    background: rgba(226, 232, 240, 0.8);
    color: #4a5568;
}

body.light-theme .modal-btn-secondary:hover {
    background: rgba(226, 232, 240, 1);
}
