/* ============================================
   量化交易系统 - 自定义弹窗样式
   美观的暗色主题设计，与系统整体风格一致
   ============================================ */

/* ---------- Toast 提示框 ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 16px 20px;
    border-radius: 16px;
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 85, 104, 0.6);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

/* Toast 类型样式 */
.toast-success {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.98) 0%, rgba(56, 178, 172, 0.15) 100%);
}

.toast-success::before {
    background: linear-gradient(180deg, #38b2ac 0%, #319795 100%);
}

.toast-error {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.98) 0%, rgba(229, 62, 62, 0.15) 100%);
}

.toast-error::before {
    background: linear-gradient(180deg, #e53e3e 0%, #c53030 100%);
}

.toast-warning {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.98) 0%, rgba(237, 137, 54, 0.15) 100%);
}

.toast-warning::before {
    background: linear-gradient(180deg, #ed8936 0%, #dd6b20 100%);
}

.toast-info {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.98) 0%, rgba(66, 153, 225, 0.15) 100%);
}

.toast-info::before {
    background: linear-gradient(180deg, #4299e1 0%, #3182ce 100%);
}

/* Toast 图标 */
.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.toast-success .toast-icon {
    background: rgba(56, 178, 172, 0.2);
    color: #38b2ac;
}

.toast-error .toast-icon {
    background: rgba(229, 62, 62, 0.2);
    color: #e53e3e;
}

.toast-warning .toast-icon {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.toast-info .toast-icon {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
}

/* Toast 内容 */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
    line-height: 1.4;
}

.toast-message {
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Toast 关闭按钮 */
.toast-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #a0aec0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 14px;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Toast 进度条 */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0 0 0 16px;
    animation: toastProgress 3s linear forwards;
}

.toast-success .toast-progress {
    background: rgba(56, 178, 172, 0.5);
}

.toast-error .toast-progress {
    background: rgba(229, 62, 62, 0.5);
}

.toast-warning .toast-progress {
    background: rgba(237, 137, 54, 0.5);
}

.toast-info .toast-progress {
    background: rgba(66, 153, 225, 0.5);
}

/* ---------- 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 toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* ---------- 响应式设计 ---------- */
@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    .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%;
    }
}

/* ---------- 浅色主题适配 ---------- */
body.light-theme .toast {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.05);
}

body.light-theme .toast-success {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(56, 178, 172, 0.1) 100%);
}

body.light-theme .toast-error {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(229, 62, 62, 0.1) 100%);
}

body.light-theme .toast-warning {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(237, 137, 54, 0.1) 100%);
}

body.light-theme .toast-info {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(66, 153, 225, 0.1) 100%);
}

body.light-theme .toast-title {
    color: #2d3748;
}

body.light-theme .toast-message {
    color: #4a5568;
}

body.light-theme .toast-close {
    background: rgba(0, 0, 0, 0.05);
    color: #718096;
}

body.light-theme .toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #2d3748;
}

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);
}
