/**
 * PC端通用工具样式
 * 配合 utils.js 使用
 * @author Claude Code
 * @date 2025-10-09
 */

/* ==================== Toast 提示 ==================== */
.utils-toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.utils-toast-show {
    top: 24px;
}

.utils-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
}

.utils-toast-content i {
    font-size: 20px;
    flex-shrink: 0;
}

/* Toast 类型样式 */
.utils-toast-success {
    background: rgba(34, 197, 94, 0.95);
    color: white;
}

.utils-toast-error {
    background: rgba(239, 68, 68, 0.95);
    color: white;
}

.utils-toast-warning {
    background: rgba(245, 158, 11, 0.95);
    color: white;
}

.utils-toast-info {
    background: rgba(59, 130, 246, 0.95);
    color: white;
}

/* ==================== Loading 加载 ==================== */
.utils-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.utils-loading-overlay {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.utils-loading-content {
    background: white;
    padding: 32px 48px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.utils-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border: 4px solid #e5e7eb;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: utils-spin 0.8s linear infinite;
}

@keyframes utils-spin {
    to {
        transform: rotate(360deg);
    }
}

.utils-loading-text {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

/* ==================== Dialog 对话框 ==================== */
.utils-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.utils-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.utils-dialog-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 450px;
    animation: utils-dialog-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes utils-dialog-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.utils-dialog-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.utils-dialog-header i {
    font-size: 28px;
}

.utils-dialog-icon-warning {
    color: #f59e0b;
}

.utils-dialog-icon-error {
    color: #ef4444;
}

.utils-dialog-icon-info {
    color: #3b82f6;
}

.utils-dialog-icon-success {
    color: #22c55e;
}

.utils-dialog-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.utils-dialog-body {
    padding: 0 24px 24px;
}

.utils-dialog-body p {
    font-size: 15px;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
}

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

/* ==================== Button 按钮 ==================== */
.utils-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.utils-btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.utils-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.utils-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.utils-btn-secondary:hover {
    background: #e5e7eb;
}

/* ==================== Error State 错误状态 ==================== */
.utils-error-state {
    padding: 80px 20px;
    text-align: center;
}

.utils-error-icon {
    font-size: 64px;
    color: #ef4444;
    margin-bottom: 24px;
}

.utils-error-message {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
}

.utils-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ==================== Empty State 空状态 ==================== */
.utils-empty-state {
    padding: 80px 20px;
    text-align: center;
}

.utils-empty-icon {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 24px;
}

.utils-empty-message {
    font-size: 16px;
    color: #9ca3af;
    margin-bottom: 24px;
}

/* ==================== Skeleton 骨架屏 ==================== */
.utils-skeleton-wrapper {
    display: grid;
    gap: 20px;
}

.utils-skeleton-card,
.utils-skeleton-list,
.utils-skeleton-text {
    animation: utils-skeleton-pulse 1.5s ease-in-out infinite;
}

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

.utils-skeleton-card {
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
}

.utils-skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: utils-skeleton-shimmer 1.5s infinite;
}

.utils-skeleton-content {
    padding: 16px;
}

.utils-skeleton-line {
    height: 12px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: utils-skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
}

.utils-skeleton-title {
    height: 16px;
    width: 60%;
}

.utils-skeleton-list {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
}

.utils-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: utils-skeleton-shimmer 1.5s infinite;
}

.utils-skeleton-text {
    padding: 16px;
}

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .utils-toast {
        min-width: 280px;
        max-width: 90%;
    }

    .utils-loading-content {
        padding: 24px 32px;
    }

    .utils-dialog-content {
        max-width: 90%;
    }

    .utils-dialog-footer {
        flex-direction: column;
    }

    .utils-btn {
        width: 100%;
    }
}

/* ==================== 暗黑模式支持 ==================== */
.dark-mode .utils-loading-content,
.dark-mode .utils-dialog-content {
    background: #1e293b;
}

.dark-mode .utils-dialog-header h3 {
    color: #f1f5f9;
}

.dark-mode .utils-dialog-body p,
.dark-mode .utils-loading-text {
    color: #94a3b8;
}

.dark-mode .utils-dialog-footer {
    border-top-color: #334155;
}

.dark-mode .utils-btn-secondary {
    background: #334155;
    color: #cbd5e1;
}

.dark-mode .utils-btn-secondary:hover {
    background: #475569;
}

.dark-mode .utils-skeleton-card,
.dark-mode .utils-skeleton-list,
.dark-mode .utils-skeleton-text {
    background: #1e293b;
}

.dark-mode .utils-skeleton-image,
.dark-mode .utils-skeleton-line,
.dark-mode .utils-skeleton-avatar {
    background: linear-gradient(90deg, #334155 0%, #475569 50%, #334155 100%);
}
