/**
 * 移动端诊断页面增强功能样式
 * 更新时间：2026-01-22
 */

/* ========== 增强Toast提示 ========== */
.enhanced-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 85%;
}

.enhanced-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.enhanced-toast-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.enhanced-toast-error {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.enhanced-toast-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.enhanced-toast-info {
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
}

.toast-icon {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

/* ========== 增强加载器 ========== */
.enhanced-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: loaderFadeIn 0.3s ease;
}

.enhanced-loader.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes loaderFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loader-content {
    background: white;
    padding: 32px 40px;
    border-radius: 20px;
    text-align: center;
    min-width: 240px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: loaderSlideUp 0.3s ease;
}

@keyframes loaderSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #E5E7EB;
    border-top-color: #6366F1;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

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

.loader-message {
    font-size: 15px;
    color: #374151;
    margin-bottom: 16px;
    font-weight: 500;
}

.loader-progress-container {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loader-progress-text {
    font-size: 12px;
    color: #6B7280;
}

/* ========== 离线指示器 ========== */
.offline-indicator {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.offline-indicator svg {
    width: 14px;
    height: 14px;
}

/* ========== 增强模态框 ========== */
.enhanced-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.enhanced-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.enhanced-modal .modal-container {
    position: relative;
    width: 90%;
    max-width: 360px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.enhanced-modal .modal-header {
    padding: 20px 24px 0;
}

.enhanced-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.enhanced-modal .modal-body {
    padding: 16px 24px;
}

.enhanced-modal .modal-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #4B5563;
}

.enhanced-modal .modal-footer {
    display: flex;
    padding: 16px 24px 24px;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
}

.modal-btn-primary:active {
    transform: scale(0.98);
}

.modal-btn-secondary {
    background: #F3F4F6;
    color: #374151;
}

.modal-btn-secondary:active {
    background: #E5E7EB;
}

/* ========== 新手引导 ========== */
.onboarding-guide {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
}

.onboarding-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.onboarding-highlight {
    position: absolute;
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    transition: all 0.3s ease;
}

.onboarding-tooltip {
    position: absolute;
    width: 280px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: tooltipFadeIn 0.3s ease;
    z-index: 100001;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onboarding-tooltip .tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
}

.onboarding-tooltip.top .tooltip-arrow {
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
}

.onboarding-tooltip.bottom .tooltip-arrow {
    top: -8px;
    left: 50%;
    margin-left: -8px;
}

.onboarding-tooltip h4 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.onboarding-tooltip p {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #6B7280;
}

.tooltip-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-progress {
    font-size: 12px;
    color: #9CA3AF;
}

.tooltip-buttons {
    display: flex;
    gap: 8px;
}

.tooltip-buttons .btn-skip {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #6B7280;
    font-size: 13px;
    cursor: pointer;
}

.tooltip-buttons .btn-next {
    padding: 8px 20px;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.tooltip-buttons .btn-next:active {
    transform: scale(0.98);
}

/* ========== 增强诊断加载动画 ========== */
.diagnosis-loading-enhanced {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.diagnosis-loading-enhanced .loading-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
    position: relative;
}

.diagnosis-loading-enhanced .loading-icon::before,
.diagnosis-loading-enhanced .loading-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
}

.diagnosis-loading-enhanced .loading-icon::before {
    border-top-color: #EC4899;
    animation: spin 1s linear infinite;
}

.diagnosis-loading-enhanced .loading-icon::after {
    border-bottom-color: #8B5CF6;
    animation: spin 1.5s linear infinite reverse;
}

.diagnosis-loading-enhanced .loading-text {
    font-size: 14px;
    color: #6B7280;
    text-align: center;
}

.diagnosis-loading-enhanced .loading-progress {
    width: 100%;
    max-width: 200px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.diagnosis-loading-enhanced .loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #EC4899 0%, #8B5CF6 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========== 增强消息样式 ========== */
.inline-message-content.with-retry {
    position: relative;
}

.retry-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    color: #EF4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-button:hover {
    background: rgba(239, 68, 68, 0.15);
}

.retry-button svg {
    width: 14px;
    height: 14px;
}

/* ========== 增强诊断结果卡片 ========== */
.diagnosis-result-enhanced {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.diagnosis-result-enhanced .result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
}

.diagnosis-result-enhanced.tongue .result-header {
    background: linear-gradient(135deg, #EC4899 0%, #F472B6 100%);
}

.diagnosis-result-enhanced.face .result-header {
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
}

.result-header .result-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.result-header .result-info {
    flex: 1;
}

.result-header .result-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.result-header .result-time {
    font-size: 12px;
    opacity: 0.8;
}

.result-header .result-actions {
    display: flex;
    gap: 8px;
}

.result-header .btn-save,
.result-header .btn-share {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.result-body {
    padding: 16px;
}

.result-section {
    margin-bottom: 16px;
}

.result-section:last-child {
    margin-bottom: 0;
}

.result-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-section h4 .section-icon {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.result-section p {
    font-size: 14px;
    line-height: 1.6;
    color: #6B7280;
    margin: 0;
}

.result-section ul {
    margin: 0;
    padding-left: 20px;
}

.result-section li {
    font-size: 14px;
    line-height: 1.6;
    color: #6B7280;
    margin-bottom: 4px;
}

.result-footer {
    padding: 12px 16px;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-footer .disclaimer {
    font-size: 11px;
    color: #9CA3AF;
}

.result-footer .confidence {
    font-size: 12px;
    color: #6366F1;
    font-weight: 500;
}

/* ========== 骨架屏加载 ========== */
.skeleton-loader {
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 8px;
}

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

.skeleton-message {
    padding: 16px;
    border-radius: 16px;
    background: #F3F4F6;
}

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

.skeleton-message .skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
}

/* ========== 网络状态指示 ========== */
.network-status-bar {
    position: fixed;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    z-index: 1000;
    animation: statusBarSlideUp 0.3s ease;
}

@keyframes statusBarSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.network-status-bar.reconnecting {
    color: #F59E0B;
}

.network-status-bar.connected {
    color: #10B981;
}

.network-status-bar.disconnected {
    color: #EF4444;
}

.network-status-bar .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: statusPulse 1.5s infinite;
}

.network-status-bar.reconnecting .status-dot {
    background: #F59E0B;
}

.network-status-bar.connected .status-dot {
    background: #10B981;
}

.network-status-bar.disconnected .status-dot {
    background: #EF4444;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* ========== 操作反馈动画 ========== */
.operation-feedback {
    position: fixed;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    animation: feedbackFade 2s ease forwards;
}

@keyframes feedbackFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ========== 会话恢复提示 ========== */
.session-restore-banner {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 440px;
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    animation: bannerSlideDown 0.3s ease;
}

@keyframes bannerSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes bannerSlideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.session-restore-banner .banner-text {
    font-size: 14px;
    color: #374151;
}

.session-restore-banner .banner-actions {
    display: flex;
    gap: 8px;
}

.session-restore-banner .btn-restore {
    padding: 6px 14px;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.session-restore-banner .btn-dismiss {
    padding: 6px 14px;
    background: #F3F4F6;
    color: #6B7280;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* ========== 响应式适配 ========== */
@media (max-width: 360px) {
    .onboarding-tooltip {
        width: 260px;
        padding: 16px;
    }
    
    .loader-content {
        padding: 24px 30px;
        min-width: 200px;
    }
    
    .enhanced-modal .modal-container {
        width: 95%;
    }
}

/* ========== 深色模式支持（预留） ========== */
@media (prefers-color-scheme: dark) {
    /* 可根据需要添加深色模式样式 */
}

/* ========== 错误消息样式 ========== */
.error-message {
    color: #EF4444;
    font-size: 14px;
    line-height: 1.5;
}

.error-message .retry-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    color: #EF4444;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.error-message .retry-button:hover,
.error-message .retry-button:active {
    background: rgba(239, 68, 68, 0.2);
}

.error-message .retry-button svg {
    width: 14px;
    height: 14px;
}

/* ========== 诊断加载增强动画 ========== */
.diagnosis-loading-enhanced {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
}

.diagnosis-loading-enhanced .loading-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    position: relative;
}

.diagnosis-loading-enhanced .loading-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #E5E7EB;
    border-top-color: #EC4899;
    animation: spin 1s linear infinite;
}

.diagnosis-loading-enhanced .loading-icon::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: #8B5CF6;
    animation: spin 1.5s linear infinite reverse;
}

.diagnosis-loading-enhanced .loading-text {
    font-size: 14px;
    color: #6B7280;
    text-align: center;
    margin-bottom: 12px;
}

.diagnosis-loading-enhanced .loading-progress {
    width: 100%;
    max-width: 200px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    overflow: hidden;
}

.diagnosis-loading-enhanced .loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #EC4899 0%, #8B5CF6 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}
