/**
 * UI 组件样式
 * 配合 ui-components.js 使用
 */

/* ========== 加载指示器 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay--show {
    opacity: 1;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5f8f7a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    color: #52657a;
    font-size: 14px;
    margin: 0;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 280px;
    max-width: 400px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(450px);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 10000;
}

.toast--show {
    transform: translateX(0);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

.toast--success {
    border-left: 4px solid #059669;
}

.toast--success .toast-icon {
    background: #d1fae5;
    color: #059669;
}

.toast--error {
    border-left: 4px solid #dc2626;
}

.toast--error .toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.toast--warning {
    border-left: 4px solid #ca8a04;
}

.toast--warning .toast-icon {
    background: #fef3c7;
    color: #ca8a04;
}

.toast--info {
    border-left: 4px solid #3b82f6;
}

.toast--info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.toast-message {
    flex: 1;
    color: #25384f;
    font-size: 14px;
    line-height: 1.5;
}

/* ========== 骨架屏 ========== */
.skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton {
    padding: 16px;
    background: white;
    border-radius: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-header {
    height: 24px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    animation: shimmer 1.5s infinite;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 8px;
    animation: shimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== 模态框 ========== */
.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: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay--show {
    opacity: 1;
}

.modal-overlay--show .modal {
    transform: scale(1);
    opacity: 1;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #25384f;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #25384f;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    color: #52657a;
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .toast {
        right: 12px;
        left: 12px;
        min-width: auto;
        max-width: none;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
}

