/* 坐姿检测模块样式 */

/* 主容器 */
.posture-monitor {
    position: fixed;
    bottom: 100px;
    right: 40px;
    background: var(--bg, #F5F1E8);
    border: 1px solid var(--accent, #7A9E7E);
    border-radius: 12px;
    padding: 16px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(61, 74, 58, 0.1);
    transition: all 0.3s ease;
    min-width: 180px;
    backdrop-filter: blur(10px);
}

.posture-monitor:hover {
    box-shadow: 0 6px 30px rgba(61, 74, 58, 0.15);
    transform: translateY(-2px);
}

/* 状态指示器 */
.posture-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.posture-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(122, 158, 126, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.posture-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.posture-text {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted, #9E9B8E);
}

.posture-state {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #3D4A3A);
    transition: color 0.3s ease;
}

/* 详情面板 */
.posture-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(122, 158, 126, 0.2);
    animation: slideDown 0.3s ease;
}

/* 开关行 */
.posture-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.posture-toggle-label {
    font-size: 12px;
    color: var(--muted, #9E9B8E);
}

/* 简约开关 */
.posture-toggle-switch {
    width: 36px;
    height: 20px;
    background: rgba(158, 155, 142, 0.3);
    border: none;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}

.posture-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.posture-toggle-switch.on {
    background: var(--accent, #7A9E7E);
}

.posture-toggle-switch.on::after {
    transform: translateX(16px);
}

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

.posture-video-container {
    width: 160px;
    height: 120px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.posture-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.posture-video-container canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.posture-info {
    font-size: 12px;
}

.posture-confidence {
    color: var(--muted, #9E9B8E);
    margin-bottom: 8px;
}

.posture-confidence span {
    color: var(--text, #3D4A3A);
    font-weight: 600;
}

.posture-issues {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.issue-item {
    color: var(--accent, #7A9E7E);
    font-size: 11px;
    padding: 4px 8px;
    background: rgba(122, 158, 126, 0.1);
    border-radius: 4px;
}

.issue-item.good {
    color: var(--success, #8FAE93);
    background: rgba(143, 174, 147, 0.15);
}

/* 状态样式 */
.posture-monitor.loading .posture-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

.posture-monitor.active .posture-icon {
    background: rgba(122, 158, 126, 0.2);
}

.posture-monitor.good .posture-icon {
    background: rgba(143, 174, 147, 0.25);
    animation: gentle-pulse 2s ease-in-out infinite;
}

.posture-monitor.good .posture-state {
    color: var(--success, #8FAE93);
}

.posture-monitor.bad .posture-icon {
    background: rgba(231, 76, 60, 0.15);
    animation: shake 0.5s ease-in-out;
}

.posture-monitor.bad .posture-state {
    color: #E74C3C;
}

.posture-monitor.inactive .posture-icon {
    background: rgba(158, 155, 142, 0.1);
}

.posture-monitor.error .posture-icon {
    background: rgba(231, 76, 60, 0.2);
}

.posture-monitor.error .posture-state {
    color: #E74C3C;
}

/* 动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* 禅模式适配 */
.zen-mode .posture-monitor {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.zen-mode .posture-monitor:hover {
    opacity: 1;
}

/* 黑白模式适配 */
.monochrome .posture-monitor {
    border-color: var(--accent, #666666);
    background: var(--bg, #FFFFFF);
}

.monochrome .posture-icon {
    background: rgba(0, 0, 0, 0.05);
}

.monochrome .posture-monitor.good .posture-icon {
    background: rgba(0, 0, 0, 0.1);
}

.monochrome .posture-monitor.bad .posture-icon {
    background: rgba(0, 0, 0, 0.15);
}

/* 响应式 */
@media (max-width: 768px) {
    .posture-monitor {
        bottom: 80px;
        right: 20px;
        padding: 12px;
        min-width: 150px;
    }

    .posture-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .posture-text {
        font-size: 10px;
    }

    .posture-state {
        font-size: 12px;
    }
}

/* 提示信息 */
.posture-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text, #3D4A3A);
    color: var(--bg, #F5F1E8);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
}

.posture-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text, #3D4A3A);
}

.posture-monitor:hover .posture-tooltip {
    opacity: 1;
}
