/**
 * 田径赛事报名系统 - 弹窗组件样式
 * 版本: V1.0
 * 日期: 2026-08-06
 * 
 * 说明: 模态框、抽屉、Toast提示、确认框等组件样式
 */

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-container {
    background: var(--bg-container);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
}

.modal-overlay.closing .modal-container {
    animation: slideDown 0.25s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* 模态框尺寸 */
.modal-container.small {
    width: 400px;
    max-width: 90vw;
}

.modal-container.medium {
    width: 600px;
    max-width: 90vw;
}

.modal-container.large {
    width: 800px;
    max-width: 95vw;
}

.modal-container.full {
    width: 95vw;
    height: 90vh;
}

.modal-container.xlarge {
    width: 60vw;
    max-width: 60vw;
    height: 80vh;
}

/* 模态框结构 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color-split);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: 16px 24px;
    border-top: 1px solid var(--border-color-split);
}

/* 弹窗底部按钮样式优化 */
.modal-footer .btn {
    height: 38px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
}

/* 取消按钮 - 浅灰色次要按钮 */
.modal-footer .btn-default,
.modal-footer .modal-cancel {
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    color: #595959;
}

.modal-footer .btn-default:hover,
.modal-footer .modal-cancel:hover {
    background: #e8e8e8;
    border-color: #bfbfbf;
    color: #262626;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* 创建/保存按钮 - 蓝色主高亮按钮 */
.modal-footer .btn-primary,
.modal-footer .modal-confirm {
    background: #1a73e8;
    border: 1px solid #1a73e8;
    color: #fff;
}

.modal-footer .btn-primary:hover,
.modal-footer .modal-confirm:hover {
    background: #1557b0;
    border-color: #1557b0;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
    transform: translateY(-1px);
}

.modal-footer .btn-primary:active,
.modal-footer .modal-confirm:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(26, 115, 232, 0.3);
}

/* ==================== 抽屉 ==================== */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.drawer-container {
    position: fixed;
    top: 0;
    bottom: 0;
    background: var(--bg-container);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: slideIn 0.25s ease;
}

.drawer-container.left {
    left: 0;
    width: 400px;
    max-width: 90vw;
}

.drawer-container.right {
    right: 0;
    width: 400px;
    max-width: 90vw;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-container.left {
    animation: slideInLeft 0.25s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color-split);
}

.drawer-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.drawer-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color-split);
}

/* ==================== 确认对话框 ==================== */
.confirm-dialog {
    text-align: center;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-md);
    font-size: 24px;
}

.confirm-icon.warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.confirm-icon.danger {
    background: var(--error-light);
    color: var(--error-color);
}

.confirm-icon.info {
    background: var(--primary-light);
    color: var(--primary-color);
}

.confirm-icon.success {
    background: var(--success-light);
    color: var(--success-color);
}

.confirm-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.confirm-message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

/* ==================== Toast提示 ==================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 12px 16px;
    background: var(--bg-container);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border-left: 4px solid;
    min-width: 280px;
    max-width: 420px;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
}

.toast-item.leaving {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-item.success {
    border-left-color: var(--success-color);
}

.toast-item.error {
    border-left-color: var(--error-color);
}

.toast-item.warning {
    border-left-color: var(--warning-color);
}

.toast-item.info {
    border-left-color: var(--primary-color);
}

.toast-icon {
    font-size: 20px;
    line-height: 1;
}

.toast-item.success .toast-icon { color: var(--success-color); }
.toast-item.error .toast-icon { color: var(--error-color); }
.toast-item.warning .toast-icon { color: var(--warning-color); }
.toast-item.info .toast-icon { color: var(--primary-color); }

.toast-content {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
}

.toast-close {
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ==================== 消息提示(页面内) ==================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
}

.alert-success {
    background: var(--success-light);
    border-color: #b7eb8f;
    color: var(--success-color);
}

.alert-error {
    background: var(--error-light);
    border-color: #ffccc7;
    color: var(--error-color);
}

.alert-warning {
    background: var(--warning-light);
    border-color: #ffe58f;
    color: var(--warning-color);
}

.alert-info {
    background: var(--primary-light);
    border-color: #91d5ff;
    color: var(--primary-color);
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-close {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ==================== 加载遮罩 ==================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.loading-overlay .spinner {
    width: 36px;
    height: 36px;
}

/* ==================== 弹窗工具提示 ==================== */
.popover {
    position: absolute;
    background: var(--bg-container);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    z-index: 100;
    min-width: 200px;
}

.popover::before {
    content: '';
    position: absolute;
    border-style: solid;
}

.popover.top::before {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent var(--bg-container) transparent;
}

.popover.bottom::before {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-color: var(--bg-container) transparent transparent transparent;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .modal-container.small,
    .modal-container.medium,
    .modal-container.large,
    .modal-container.xlarge {
        width: 95vw;
        max-width: 95vw;
    }
    
    .drawer-container.left,
    .drawer-container.right {
        width: 100%;
        max-width: 100%;
    }
    
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
    }
    
    .toast-item {
        min-width: auto;
        max-width: 100%;
    }
}
