/**
 * 用户体验增强样式 - yyznt系统
 * 包含：离线横幅、上传进度、会话超时、错误反馈
 */

/* ===== 离线横幅 ===== */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #b71c1c 0%, #c62828 100%);
    color: #fff;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.offline-banner.show {
    max-height: 60px;
    padding: 12px 20px;
}

.offline-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.offline-icon {
    font-size: 20px;
    animation: pulse 2s infinite;
}

.offline-text {
    font-size: 14px;
    font-weight: 500;
}

.offline-retry-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.offline-retry-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.offline-retry-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 在线状态指示 */
.dot.offline {
    background: #e74c3c !important;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}


/* ===== 上传进度容器 ===== */
.upload-progress-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-height: 400px;
    background: #1a2540;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    overflow: hidden;
    transition: all 0.3s ease;
}

.upload-progress-container.hidden {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #12192a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-progress-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.upload-progress-close {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.upload-progress-close:hover {
    color: #999;
}

.upload-progress-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 10px;
}

.upload-progress-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.upload-progress-item:last-child {
    margin-bottom: 0;
}

.upload-progress-item.removing {
    transform: translateX(100%);
    opacity: 0;
}

.upload-progress-item.completed {
    background: rgba(76, 175, 80, 0.1);
}

.upload-progress-item.error {
    background: rgba(244, 67, 54, 0.1);
}

.upload-file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.upload-filename {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.upload-filesize {
    font-size: 11px;
    color: #888;
}

.upload-progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.upload-progress-bar.completed {
    background: #4caf50;
}

.upload-progress-bar.error {
    background: #f44336;
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.upload-progress-percent {
    font-size: 12px;
    color: #4fc3f7;
    font-weight: 600;
}

.upload-progress-percent.completed {
    color: #81c784;
}

.upload-progress-percent.error {
    color: #ef5350;
}

.upload-progress-speed,
.upload-progress-eta {
    font-size: 11px;
    color: #888;
}

.upload-progress-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.upload-btn-pause,
.upload-btn-cancel,
.upload-btn-retry {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn-pause {
    background: rgba(255, 255, 255, 0.1);
    color: #9e9e9e;
}

.upload-btn-cancel {
    background: rgba(244, 67, 54, 0.2);
    color: #ef5350;
}

.upload-btn-retry {
    background: rgba(33, 150, 243, 0.2);
    color: #42a5f5;
}

.upload-btn-pause:hover,
.upload-btn-cancel:hover,
.upload-btn-retry:hover {
    opacity: 0.8;
}

.upload-status-success {
    color: #81c784;
    font-size: 12px;
}

.upload-status-error {
    color: #ef5350;
    font-size: 11px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ===== 会话超时弹窗 ===== */
.session-timeout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    display: none;
    align-items: center;
    justify-content: center;
}

.session-timeout-modal.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.session-timeout-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.session-timeout-content {
    position: relative;
    background: #1a2540;
    border-radius: 16px;
    padding: 35px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

.session-timeout-icon {
    font-size: 56px;
    margin-bottom: 15px;
}

.session-timeout-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.session-timeout-message {
    font-size: 14px;
    color: #9e9e9e;
    line-height: 1.7;
    margin-bottom: 25px;
}

.session-timeout-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.session-timeout-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.session-timeout-btn.primary {
    background: #1976d2;
    color: #fff;
}

.session-timeout-btn.primary:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

.session-timeout-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #9e9e9e;
}

.session-timeout-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* ===== Toast通知增强 ===== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10003;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 22px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
}

.toast-error {
    background: linear-gradient(135deg, #e53935, #c62828);
}

.toast-success {
    background: linear-gradient(135deg, #43a047, #2e7d32);
}

.toast-warning {
    background: linear-gradient(135deg, #fb8c00, #ef6c00);
}

.toast-info {
    background: linear-gradient(135deg, #1e88e5, #1565c0);
}


/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
    .offline-banner-content {
        flex-direction: column;
        gap: 8px;
    }

    .upload-progress-container {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 10px;
    }

    .session-timeout-content {
        padding: 25px 20px;
    }

    .session-timeout-actions {
        flex-direction: column;
    }

    .session-timeout-btn {
        width: 100%;
    }

    #toast-container {
        left: 10px;
        right: 10px;
    }

    .toast {
        max-width: none;
    }
}


/* ===== 滚动条美化 ===== */
.upload-progress-list::-webkit-scrollbar {
    width: 4px;
}

.upload-progress-list::-webkit-scrollbar-track {
    background: transparent;
}

.upload-progress-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.upload-progress-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
