/**
 * 用户体验优化样式
 * 步骤15：加载体验优化
 * 步骤16：交互体验优化
 * 步骤17：响应式设计优化
 * 步骤18：无障碍功能
 */

/* ============================================
   步骤15：加载体验优化
   ============================================ */

/* 骨架屏 */
.skeleton-screen {
    padding: 20px;
}

.skeleton-item {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

/* 进度条 */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: #007bff;
    z-index: 9999;
    transition: width 0.3s ease;
}

/* 加载动画 */
.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-message {
    margin-top: 10px;
    color: #666;
}

/* 离线提示 */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffc107;
    color: #000;
    text-align: center;
    padding: 10px;
    z-index: 10000;
}

/* ============================================
   步骤16：交互体验优化
   ============================================ */

/* Toast通知 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-info {
    background: #17a2b8;
}

.toast-success {
    background: #28a745;
}

.toast-warning {
    background: #ffc107;
    color: #000;
}

.toast-error {
    background: #dc3545;
}

/* 表单验证 */
.is-invalid {
    border-color: #dc3545;
}

.is-valid {
    border-color: #28a745;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
}

/* 确认对话框 */
.confirm-modal {
    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;
}

.confirm-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

/* ============================================
   步骤17：响应式设计优化
   ============================================ */

/* 移动端优化 */
@media (max-width: 768px) {
    .toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .confirm-content {
        width: 95%;
        margin: 10px;
    }
    
    /* 触摸操作优化 */
    button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
    }
}

/* 平板端适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 90%;
    }
}

/* 横竖屏适配 */
@media (orientation: landscape) and (max-height: 500px) {
    .offline-banner {
        padding: 5px;
        font-size: 0.875rem;
    }
}

/* ============================================
   步骤18：无障碍功能
   ============================================ */

/* 键盘导航支持 */
*:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* 屏幕阅读器支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 颜色对比度优化 */
.text-muted {
    color: #6c757d !important;
}

/* 字体大小可调节 */
html {
    font-size: 16px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

