/**
 * 纯CSS提示模态框样式
 * 配合modal-alert.js使用
 */

/* 模态框覆盖层 */
.modal-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5) !important;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    animation: modalFadeIn 0.3s ease-out;
}

.modal-alert-overlay.active {
    display: flex;
}

/* 模态框内容 */
.modal-alert-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 480px;
    height: 220px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    transform-origin: center;
    position: relative; /* 添加相对定位，作为绝对定位按钮的参照 */
    margin: 20px; /* 添加边距，避免贴边 */
}

/* 动画效果 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 模态框顶部红色线条 */
.modal-alert-top-line {
    height: 4px;
    background: #ef4444;
    width: 100%;
    border-radius: 2px 2px 0 0;
}

/* 模态框主体布局 */
.modal-alert-main {
    padding: 24px;
    padding-top: 69px; /* 24px + 45px = 69px */
    display: flex;
    align-items: flex-start;
    gap: 16px;
    height: calc(100% - 93px); /* 220px - 4px(顶部线条) - 24px(底部) - 69px(顶部) = 123px */
    position: relative;
    box-sizing: border-box;
}

.modal-alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 图标样式 */
.modal-alert-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.modal-alert-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.modal-alert-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.modal-alert-icon.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* 右侧文本区域 */
.modal-alert-text {
    flex: 1;
    min-width: 0;
}

.modal-alert-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.modal-alert-message {
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
    margin: 0;
    word-wrap: break-word;
}

/* 模态框底部 */
.modal-alert-footer {
    padding: 0 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* 按钮样式 - 固定宽度60px */
.modal-alert-btn {
    width: 60px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    outline: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.modal-alert-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.modal-alert-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 主要按钮 */
.modal-alert-btn.primary {
    background: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
}

.modal-alert-btn.primary:hover {
    background: #2563eb;
    border-color: #1d4ed8;
}

/* 次要按钮 */
.modal-alert-btn.secondary {
    background: #6b7280;
    color: white;
    border: 1px solid #4b5563;
}

.modal-alert-btn.secondary:hover {
    background: #4b5563;
    border-color: #374151;
}

/* 危险按钮 */
.modal-alert-btn.danger {
    background: #ef4444;
    color: white;
    border: 1px solid #dc2626;
}

.modal-alert-btn.danger:hover {
    background: #dc2626;
    border-color: #b91c1c;
}

/* 成功按钮 */
.modal-alert-btn.success {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
}

.modal-alert-btn.success:hover {
    background: #059669;
    border-color: #047857;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-alert-content {
        width: 480px;
        height: 220px;
        margin: 20px auto;
    }
    
    .modal-alert-main {
        padding: 20px;
        padding-top: 65px; /* 20px + 45px = 65px */
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
        height: calc(100% - 85px); /* 220px - 4px(顶部线条) - 20px(底部) - 65px(顶部) = 131px */
    }
    
    .modal-alert-footer {
        padding: 0 20px 20px 20px;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
    }
    
    .modal-alert-btn {
        width: 60px;
        height: 36px;
        font-size: 13px;
    }
    
    .modal-alert-title {
        font-size: 18px;
    }
    
    .modal-alert-message {
        font-size: 15px;
    }
}

@media (max-width: 520px) {
    .modal-alert-content {
        width: 95%;
        max-width: 480px;
        height: 220px;
        margin: 10px auto;
    }
    
    .modal-alert-main {
        padding: 16px;
        padding-top: 61px; /* 16px + 45px = 61px */
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
        height: calc(100% - 77px); /* 220px - 4px(顶部线条) - 16px(底部) - 61px(顶部) = 139px */
    }
    
    .modal-alert-footer {
        padding: 0 16px 16px 16px;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .modal-alert-btn {
        width: 55px;
        height: 34px;
        font-size: 12px;
    }
    
    .modal-alert-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .modal-alert-title {
        font-size: 17px;
    }
    
    .modal-alert-message {
        font-size: 14px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .modal-alert-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .modal-alert-title {
        color: #f9fafb;
    }
    
    .modal-alert-message {
        color: #d1d5db;
    }
}

/* 无障碍支持 */
.modal-alert-btn:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.modal-alert-btn.secondary:focus {
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3);
}

.modal-alert-btn.danger:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.modal-alert-btn.success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* 打印样式 */
@media print {
    .modal-alert-overlay {
        display: none !important;
    }
}