/**
 * UI 工具样式
 * 包含：骨架屏加载、空状态、通用动画等
 */

/* ============================================================
   骨架屏加载效果 (Skeleton Loading)
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 100%; }

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-button {
    width: 100px;
    height: 36px;
    border-radius: 8px;
}

.skeleton-card {
    padding: 1.5rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* 表格骨架屏 */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-table-cell {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-table-cell:nth-child(1) { flex: 0.5; }
.skeleton-table-cell:nth-child(2) { flex: 1.5; }

/* ============================================================
   空状态样式 (Empty State)
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #86868b;
}

.empty-state-icon {
    font-size: 4rem;
    color: #d1d1d6;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
}

.empty-state-message {
    font-size: 1rem;
    color: #86868b;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-action {
    margin-top: 1rem;
}

/* 不同类型的空状态 */
.empty-state.no-data .empty-state-icon { color: #5AC8FA; }
.empty-state.no-search .empty-state-icon { color: #FF9500; }
.empty-state.error .empty-state-icon { color: #FF3B30; }

/* ============================================================
   加载状态 (Loading States)
   ============================================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #007AFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #007AFF;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ============================================================
   通用动画 (Animations)
   ============================================================ */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.4s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 延迟动画类 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ============================================================
   Toast 通知样式
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    min-width: 300px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid #007AFF;
}

.toast-item.success { border-left-color: #34C759; }
.toast-item.warning { border-left-color: #FF9500; }
.toast-item.error { border-left-color: #FF3B30; }
.toast-item.info { border-left-color: #5AC8FA; }

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-item.success .toast-icon { color: #34C759; }
.toast-item.warning .toast-icon { color: #FF9500; }
.toast-item.error .toast-icon { color: #FF3B30; }
.toast-item.info .toast-icon { color: #5AC8FA; }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.9rem;
    color: #86868b;
}

.toast-close {
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================================
   改进的表格样式
   ============================================================ */
.table-modern {
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-modern thead th {
    background: transparent;
    color: #86868b;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border: none;
}

.table-modern tbody tr {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

.table-modern tbody tr:hover {
    background: #fafafa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.table-modern tbody td {
    padding: 1rem;
    border: none;
    vertical-align: middle;
}

.table-modern tbody td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.table-modern tbody td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* ============================================================
   改进的徽章样式
   ============================================================ */
.badge-modern {
    padding: 0.4em 0.8em;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.badge-modern.success {
    background: rgba(52, 199, 89, 0.12);
    color: #1e7b34;
}

.badge-modern.warning {
    background: rgba(255, 149, 0, 0.12);
    color: #b36b00;
}

.badge-modern.danger {
    background: rgba(255, 59, 48, 0.12);
    color: #c4261d;
}

.badge-modern.info {
    background: rgba(90, 200, 250, 0.12);
    color: #006ee6;
}

.badge-modern.primary {
    background: rgba(0, 122, 255, 0.12);
    color: #006ee6;
}

.badge-modern.secondary {
    background: rgba(142, 142, 147, 0.12);
    color: #555558;
}

/* ============================================================
   响应式优化
   ============================================================ */
@media (max-width: 768px) {
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state-icon {
        font-size: 3rem;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
    }
    
    .toast-item {
        min-width: auto;
        max-width: none;
    }
    
    .table-modern tbody td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* ============================================================
   工具类
   ============================================================ */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 渐变文字 */
.text-gradient {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 玻璃态效果 */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 悬浮卡片效果 */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

console.log('UI Utils CSS loaded');

